Jump to content

Server- Home Automation (HA) Plugin


Xzener

Recommended Posts

I think this is why the plugin should focus on a single controller at a time.

 

Chef,

 

If you are using the notification I don't understand why it couldn't be a plugin like the other notification plugins. Although, honestly, I find those notifications to be super annoying so hopefully there is still a chance Luke adds some method for plugins to directly get play/pause notices.

:rolleyes:

  • Like 1
Link to comment
Share on other sites

Xzener

Chef, I can confirm that your app is working (thanks for the command snip Techy!).  Can you have the app spell out the command instead of a bunch of astrixes? Or have we moved on to something else, I know this was more a proof of concept than anything.

  • Like 1
Link to comment
Share on other sites

techywarrior

Chef, Looks like you got the answers to most/all of your questions already but here you go just in case.

 

Even if someone has multiple Vera controllers one is the "master" anyways so you only ever have to worry about talking to a single controller.

 

VeraEdge is the latest hardware. UI7 is indeed the latest software version but not everyone is using it yet because it requires that all Vera plugins be rewritten due to changes in the Vera API. UI6 was a complete disaster and no one uses it. Most people are on UI5. One of the few really bad things about the Vera is that their software release/writing is a bit of a joke. Usually bugs aren't really fixed and instead they just start on the next UI version. :(

 

From what I understand I don't think the commands you are going to be using have changed in the API.

 

Check Amazon for a VeraLite or VeraEdge. They have really good prices for them ($113 for the Lite with free shipping, Was $180 when I bought it years ago)

Link to comment
Share on other sites

chef

I just bought a vera-lite controller. It should be here in Thursday.

 

Now I'll have to get some switches from home depot. But hardware... Check✅

Link to comment
Share on other sites

techywarrior

Nice Chef. Once you start playing with HA it gets addicting. Nothing like pressing a button on your phone at night and turning off all the lights, adjusting the thermostat and locking the door all without moving :)

  • Like 1
Link to comment
Share on other sites

chef

I have the plugin base working nicely, it doesn't do anything yet, but getting the Configuration proper was hard. The Github explanations where a little vague.

 

I had to read through the entire Plugins repository before I started to understand how to build a Media Browser Plugin.

 

Media Browser is seeing the plugin DLL, and the configuration page built in HTML

 

I suck a html, anyone wanna design the dashboard interface for the plugin, I can explain what needs to be there if you want the job...).

 

 

 

But I still can't find the Interfaces which expose the Event arguments that @@ebr was talking about.

 

Eric,

The plug-in needs access to only three events (stop/play/pause). Those Events allow access to Session data, which is usually hidden behind Authentication.

But... I'm pretty sure Authenticating users has no place in a plug-in. Do you have any hints as to a direction I could take?

 

 

I have gone through the list of Interfaces a couple times trying to get it right. 

 

At least there is a working Plug-in DLL, and we have the code to implement Home Automation for Vera/zwave hardware.  We just have to combine the two.

Link to comment
Share on other sites

Xzener

Chef, sorry... Please add to the list of items "Media Browser Start", "Stop".

 

Actually, looking at notifications in recent activity, MBS only notifying when a user disconnects from MB3 on a certain machine. There seems to be no indication of the user starting MB3.

Edited by Xzener
  • Like 1
Link to comment
Share on other sites

Xzener

Do you mean server start stop? Why would you want that?

 

No, a user starting a client on a device.

Link to comment
Share on other sites

Xzener

Ok, for example... I start MBT in my theater room (was already playing Xbone, so lights already to my liking), the plugin senses I have started MBT "in the theater room" and turns on my black lights to charge my star mural before a movie starts. We already have a "playback has started" instance where the plugin would turn "off" lights when playback starts.

 

Just having Chef add as much functionality to the plugin as possible.

  • Like 1
Link to comment
Share on other sites

BATTLE DONKEY

@@chef

 

Would be this only work with start/pause/play commands or could ur plugin differentiate between the movie and intros/trailers?

 

I don't have any smart lights yet, but I wonder if it would be possible to set up so on a play command the lights dim to 50% during the intro and trailers, then dim down to and off as the movie begins.

 

Is this something that may be possible to do with your plugin in the future?

  • Like 1
Link to comment
Share on other sites

Vidman

Ok, for example... I start MBT in my theater room (was already playing Xbone, so lights already to my liking), the plugin senses I have started MBT "in the theater room" and turns on my black lights to charge my star mural before a movie starts. We already have a "playback has started" instance where the plugin would turn "off" lights when playback starts.

 

Just having Chef add as much functionality to the plugin as possible.

Ok so quite specific. I agree with as much functionality as possible but also no need to over complicate things..but yes i see what you mean but a user logging into a device would be sufficient yes? Edited by Vidman
Link to comment
Share on other sites

Xzener

No, not complicated at all... As long as the events are there to utilize, and we can differentiate between users/clients/devices.

 

I don't have any smart lights yet, but I wonder if it would be possible to set up so on a play command the lights dim to 50% during the intro and trailers, then dim down to and off as the movie begins.

 

Great idea Battle Donkey!!

  • Like 1
Link to comment
Share on other sites

I really think this type of functionality might need to live somewhere other than the server because the events you are trying to watch are not events that the server will necessarily know about.

 

You said play/pause/stop - well, these are app-level events as opposed to server events.  The server would never know if something were paused and it only knows when a playback start and playback stop event is reported by the app.  The thing is, those could theoretically occur at times when the user didn't originate them.

 

I really think you will need to target these functions at the app level.

Link to comment
Share on other sites

Now, if you want more centralized control of the whole HA thing, then you could still have a server plug-in to do that.  But you should probably create a plug-in with its own API (or get Luke to design an HA API for the server that the plug-in then implements much like Live TV).  Then you have the apps send events to that API at the appropriate times.

 

I think that is the only way you get to what you are really after here.

Link to comment
Share on other sites

chef

I really think this type of functionality might need to live somewhere other than the server because the events you are trying to watch are not events that the server will necessarily know about.

 

You said play/pause/stop - well, these are app-level events as opposed to server events.  The server would never know if something were paused and it only knows when a playback start and playback stop event is reported by the app.  The thing is, those could theoretically occur at times when the user didn't originate them.

 

I really think you will need to target these functions at the app level.

 

Ha! You said it and I was already on route. thanks for you input @@ebr

 

Here is how I have made it work so far:

 

1. We have a console app (called "listener") which sits in process (no ui, no console window) which listens for events from the server and executes actions based on the EventArgs.

 

2. I have used the Plugin DLL to configure the listener app from the Plugin respository/page. The plugin DLL edits and saves an XML configuration file which controls the listener, and also starts the listener process when the server starts.

 

Note:

Configuration, like all server plugins, will need an HTML interface. any help here from Web Desginers would be great, because my JavaScript is terrible and it needs to edit the XML file and save it.

When the Save button is pressed in the Plugin Configuratrion, it needs to restart the "Listener" proccess.

 

 

3. Here is the thing about controlling a client based app from a server plugin: We need to create a hidden user account with no password for the listener to access and authenticate itself. I was thinking we call it :"Vera", since that is the controller type we are using.

 

This will allow the listener to authenticate itself and connect to the websocket without having to show a user list.

 

Your home Automation becomes its own Media Browser user... which is kind of cool actually.

 

Also, I don't want to bug luke to much, he's a pretty busy guy and asking for an entire API structure to be implemented seems like a lot of work, when we could just do it this way.

 

 

As I've mentioned, most folks don't need MB3 to control HA...so I don't know if an event engine is needed.   It's the other way around for me personally, I need HA to control MBC clients (at least play channel X or play MB Plus smartlist Y) using a simple HTTP listener. 

 

I haven't heard a scenario except a dedicated theater room that this MB events->HA would benefit anyone (as you don't want lights going on between seinfeld episodes).    Am I missing something?

 

PS - I wish I had a dedicated theater room.

 

Good point with TV Series effecting HA. we will compensate for this in the listener.

Edited by chef
  • Like 1
Link to comment
Share on other sites

chef

Update,

 

I have the Listener working. Serializing and de serializing to XML.

 

It also is client specific, you'll be able to choose which room it effects, and what client affects it.

 

:)

  • Like 2
Link to comment
Share on other sites

techywarrior

Sounds good Chef. Are you going to make the plugin pull the list of scenes and devices from the Vera to select (I think the way it should work) or just leave it a text field? I'm pretty sure that the average Vera (or any HA software) user isn't going to know how to get the URL string to make something turn on/off. Even in this thread with people who are probably a little above average I needed to supply the string to use.

  • Like 1
Link to comment
Share on other sites

Vidman

I think the best middle ground would just be for the user to enter the Vera scene number for each event which is easy enough to find

Link to comment
Share on other sites

techywarrior

It's really not that hard to get a list of scenes and devices from Vera. It's a simple REST call with a JSON response.

 

Scenes and devices have different strings that need to be used to activate them as well so either way you'd need to know if it's a scene or a simple device that has to be toggled.

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...