Jump to content

Vera Home Automation Plugin (Emby Vera)


chef

Recommended Posts

Hi,

 

No experience in FreeBsd and port dependency issues - but your post in Dev forum does contain System.Net.WebRequest and WebResponse

 

Could you change code to:

Imports System.Net.HttpWebRequest
Imports System.Net.HttpWebResponse

&&

        Public Shared Function GetStream(url As String) As String
            'GetStream = String.Empty
            Try
                Dim request As System.Net.HttpWebRequest =
                        DirectCast(System.Net.WebRequest.Create(url), 
                                   System.Net.HttpWebRequest)

Still not sure whether this is issue though:

- Is Mono Installed?  Because I would wonder whether that is the issue.

http://www.mono-project.com/archived/monofreebsd/

 

Glenn

 

The Dependencies are the "System.Net" assembly as a whole.

 

FreeBsd on Mono has the "mscorlib" attached, which lets you write in .net framework. But, the "System.Net" Namespace doesn't live in "mscorelib", it seems to just live in "System" (according to this list anyway: http://wiki.alphasoftware.com/~alphafiv/Full+list+of+preloaded+.NET+Classes+V11)

 

I think you are right though, I'm going to have to side load freebsd in mono on my dev computer, and start reading on how to make the plugin run on both flavors of OS.

 

I suppose, the plugin could try and use the Javascript engine to send requests to Vera. This is just a theory, but since the plugin loads all the webpages when the server starts, it could be possible to run a "setInterval" timer on the web page which polls for information,and use Ajax to send the request. I'm not sure I like that idea though.

Link to comment
Share on other sites

@@MEB Just to confirm, are you playing a bunch of media items in succession? Do the lights turn on between items? Example: going from episode one to episode two?

 

Yea usually playing episode shows, i guess it could be the timings from one ending to the next starting and is confusing vera with all the quick scene runs. Anyway to get the plugin to not trigger scenes between episodes?

Link to comment
Share on other sites

GlennNZ

The Dependencies are the "System.Net" assembly as a whole.

 

FreeBsd on Mono has the "mscorlib" attached, which lets you write in .net framework. But, the "System.Net" Namespace doesn't live in "mscorelib", it seems to just live in "System" (according to this list anyway: http://wiki.alphasoftware.com/~alphafiv/Full+list+of+preloaded+.NET+Classes+V11)

 

I think you are right though, I'm going to have to side load freebsd in mono on my dev computer, and start reading on how to make the plugin run on both flavors of OS.

 

I suppose, the plugin could try and use the Javascript engine to send requests to Vera. This is just a theory, but since the plugin loads all the webpages when the server starts, it could be possible to run a "setInterval" timer on the web page which polls for information,and use Ajax to send the request. I'm not sure I like that idea though.

Hi

 

I would have thought solution should be much simpler

 

I noticed there are a couple of other plugins running a including rotten tomatoes which involves http queries. Have a look at the existing plugin code to see how they dealt with it?

 

Or use the servers http Client?

 

Glenn

 

 

Sent from my iPad using Tapatalk

Edited by GlennNZ
Link to comment
Share on other sites

Yea usually playing episode shows, i guess it could be the timings from one ending to the next starting and is confusing vera with all the quick scene runs. Anyway to get the plugin to not trigger scenes between episodes?

Yes, let's see if the API returns info if the item is I. A playlist or not.

 

Let also see if it is possible the API returns info on any item which might be in a que.

Link to comment
Share on other sites

Hi

I would have thought solution should be much simpler

I noticed there are a couple of other plugins running a including rotten tomatoes which involves http queries. Have a look at the existing plugin code to see how they dealt with it?

Or use the servers http Client?

Glenn

Sent from my iPad using Tapatalk

I am about to write a new http client class to test this out. I can already see this working. Glenn with another quick idea :) let's see how it goes.

Link to comment
Share on other sites

I haven't really been following too much but we have an IHttpClient dependency that you should be pulling in to execute your http requests. We've already done the work of figuring out the cross-platform issues so just lean on that.

  • Like 1
Link to comment
Share on other sites

Indeed.

 

thank you Luke. I have just rewritten the plugin to use embys internal httpClient. As per the suggestions.

 

@@fantaxp7

 

please install this version of the dll in mono and see if you can get it to work.

 

https://dl.dropboxusercontent.com/u/46151346/SampleProject/SampleProject/bin/Debug/Vera%20Smart%20Home%20Automation.zip

 

There might be left over dependencies which need to be removed.  

Edited by chef
Link to comment
Share on other sites

fantaxp7

Indeed.

 

thank you Luke. I have just rewritten the plugin to use embys internal httpClient. As per the suggestions.

 

@@fantaxp7

 

please install this version of the dll in mono and see if you can get it to work.

 

https://dl.dropboxusercontent.com/u/46151346/SampleProject/SampleProject/bin/Debug/Vera%20Smart%20Home%20Automation.zip

 

There might be left over dependencies which need to be removed.  

 

No good. 

Link to comment
Share on other sites

LOL! I hope your not sick of this yet @@fantaxp7 because this version removes every single reference that isn't EMBY. It relies completely on Emby and its internal object/Class system to  create everything in the plugin.

 

No windows references at all.

 

If this doesn't work, I'll be a monkeys uncle...

 

https://dl.dropboxusercontent.com/u/46151346/SampleProject/SampleProject/bin/Debug/Vera%20Smart%20Home%20Automation.zip

Link to comment
Share on other sites

@@MEB it looks as though because clients handle playback and queuing of media items, there is no way For the server to know about it. This means that the "Playback Stopped" event will trigger between media items and will trigger a scene with vera briefly.

 

I could add a condition which ignores "series","season","albumArtist","Albums" from triggering scenes with Vera. But then the Playback Stopped event would never trigger for those item types.

 

What do you think? It might be worth the brief flicker...

Link to comment
Share on other sites

@@MEB it looks as though because clients handle playback and queuing of media items, there is no way For the server to know about it. This means that the "Playback Stopped" event will trigger between media items and will trigger a scene with vera briefly.

 

I could add a condition which ignores "series","season","albumArtist","Albums" from triggering scenes with Vera. But then the Playback Stopped event would never trigger for those item types.

 

What do you think? It might be worth the brief flicker...

What about just a delay after the stop and then a recheck like 5seconds later to see if emby is playing something, idk how the api works so that might be impossible.

Link to comment
Share on other sites

What about just a delay after the stop and then a recheck like 5seconds later to see if emby is playing something, idk how the api works so that might be impossible.

That had crossed my mind actually. I think I can do that.

 

I can make it wait to trigger the event in media type which might be in a queue. I'll leave movies and single audio tracks out of the condition and only check for seasons/series and albums.

 

This might work. I'll get back to ya.

Edited by chef
Link to comment
Share on other sites

fantaxp7

LOL! I hope your not sick of this yet @@fantaxp7 because this version removes every single reference that isn't EMBY. It relies completely on Emby and its internal object/Class system to  create everything in the plugin.

 

No windows references at all.

 

If this doesn't work, I'll be a monkeys uncle...

 

https://dl.dropboxusercontent.com/u/46151346/SampleProject/SampleProject/bin/Debug/Vera%20Smart%20Home%20Automation.zip

No luck with this one either.

 

I uninstalled previous, restarted and placed the new one, restarted then tested. I noticed there was a config xml, should I try and delete that as well?

Link to comment
Share on other sites

No luck with this one either.

 

I uninstalled previous, restarted and placed the new one, restarted then tested. I noticed there was a config xml, should I try and delete that as well?

Perhaps, but if it created a configuration xml then that is a good thing.

 

Could you send me a log and also a copy of that xml.

 

I am wondering if threading is an issue.

 

I get the plugin to grab it's own separate thread from the thread pool when it starts. Then it can grab info in the background while emby loads with out tying up emby.

 

This can be removed of coarse.

Edited by chef
Link to comment
Share on other sites

fantaxp7

Perhaps, but if it created a configuration xml then that is a good thing.

 

Could you send me a log and also a copy of that xml.

 

I am wondering if threading is an issue.

 

I get the plugin to grab it's own separate thread from the thread pool when it starts. Then it can grab info in the background while emby loads with out tying up emby.

 

This can be removed of coarse.

Ok, just restarted emby, I added two logs as they were both around the time I restarted emby and the xml. 

 

https://www.dropbox.com/s/9baiyy8kftnegft/server-63590534599.txt?dl=0

https://www.dropbox.com/s/unk9dsmiiuuxutl/server-63590548264.txt?dl=0

https://www.dropbox.com/s/x1wi4l5zbushgpt/Vera%20Smart%20Home%20Automation.xml?dl=0

 

Thanks

Link to comment
Share on other sites

Okay, good news. The plugin is loading, and the XML looks good. But there are still dependencies somewhere that error it out. I think it is "system.Threading" namespace which I was hoping to keep in, but I am going to remove.

 

The second log you posted , seems to be older because it was trying to load "VisualBasic". But the first log shows dependency errors which I suspect is from the Vera plugin.

 

Thanks for your patients @@fantaxp7

  • Like 1
Link to comment
Share on other sites

fantaxp7

Okay, this one  removes some system.security namespaces:

 

I'm trying not to waist your time @fanbtaxp7, I am running out of possibilities...

 

https://dl.dropboxusercontent.com/u/46151346/SampleProject/SampleProject/bin/Debug/Vera%20Smart%20Home%20Automation.zip

 

Still no good. 

 

Is there no way to just ,manually enter the IP? Or is it not that easy? I assume there's probably more to it. 

Link to comment
Share on other sites

The only issue is that without the plugin loading there is no way to utilize the http client and we can't send the commands to the vera, and we won't be able to load scenes into emby.

 

I need to go through the github repo and see how others have created the server entry point. I must be missing something.

  • Like 1
Link to comment
Share on other sites

fantaxp7

The only issue is that without the plugin loading there is no way to utilize the http client and we can't send the commands to the vera, and we won't be able to load scenes into emby.

 

I need to go through the github repo and see how others have created the server entry point. I must be missing something.

If it helps at all you can teamviewer into my system make sure things look ok...I guess it probably wouldn't be too useful lol but whatever might help,

 

Thanks 

Link to comment
Share on other sites

If it helps at all you can teamviewer into my system make sure things look ok...I guess it probably wouldn't be too useful lol but whatever might help,

 

Thanks

Yes, that might be very helpful. We can check the logs as they happen and then try a bunch of dll's in a row till it works.

  • Like 1
Link to comment
Share on other sites

@@fantaxp7

 

Hey man! check this plugin version out and see how it loads in Mono. I think I narrowed the problem down to possibly the "streamreader" object used in the HttpClient requests.

 

I have removed the object, and used a different way to read the Bytes returning from the Vera.

 

If it's still broken in Mono, please supply Logs from this test.

 

https://dl.dropboxusercontent.com/u/46151346/SampleProject/SampleProject/bin/Debug/Vera%20Smart%20Home%20Automation.zip

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...