Mi Casa Verde Vera2

Got a good idea? You can suggest new features here.

Re: Mi Casa Verde Vera2

Postby Livin » Sat Jul 28, 2012 11:30 pm

I got it working. What would be key to me is to be able to trigger Vera Scenes. Especially if I can use EventGhost Macros to be the 'automation' engine... things like: check for time of day before triggering Vera Scene; checking status of light(s), from Vera, before triggering; etc

I found a plugin called Twilight, it calculates several dusk/dawn settings... Twilight does not set global variables itself, but I've created some simple macros that do, using Twlight - I'm sure Twlight could be easily modified by a decent Python coder, like yourself to have them natively.

It would be cool if you could add to your plugin, the ability to check global variables before triggering the Vera command.

Specifically trigger vera actions based on dawn/dusk plus the ability to have a time offset, for each individual Action.

Example:

Macro: WATCH MOVIE
-- Action: turn on tv
-- Action: turn on dvd player
-- Action: IF Dawn/Dusk Status >= astronomical.dawn + 30 minutes THEN continue macro, ELSE stop macro
-- Action: turn on light to 30%

Is this something you could add?


radengr wrote:As far as XBMC... I wrote this so that the VeraClient class is abstracted away from both the event loop code and the code that grabs http data. For someone that knows what they are doing it shouldn't be hard to get a XBMC plugin for Vera based on this.


the bold is the key... I'm a hack, at best... it might be a good idea to announce + post the code on the MiCasaVerde Vera forums and see if there are any daring souls who would attempt an XBMC integration.

I suspect what may be needed is to intercept XBMC's JSON API notifications and create a mapping between the JSON notifications and Vera triggers/scenes

Also, we might be able to get some assistance from Jonib, on this forum, since he is the guru behind the XBMC EG plugin. Possibly even directly integrating XBMC JSON API connections directly into your EG Vera plugin - what do you think?
setup... XBMC, W7MC for DVR & Live OTA TV, JRMC for multi-zone audio, EG, MiCasaVerde Vera3, USB-UIRT IR receiver, Harmony remote, 5.2 home theater system
User avatar
Livin
Experienced User
 
Posts: 749
Joined: Wed Oct 08, 2008 4:56 am

Re: Mi Casa Verde Vera2

Postby radengr » Sun Jul 29, 2012 2:10 am

Livin wrote:I got it working. What would be key to me is to be able to trigger Vera Scenes.


Glad it is working for you! I added some support this afternoon for other things (motion sensors, temperature sensors, etc). If anything is missing for you (or anyone else) I can add it but I might need some text from your lu_sdata.

It is easy to add the ability to trigger a scene. I have actions for "Switch" and "Dimmable Lights" already, scenes are handled the same way. I probably should clean up those actions to use names instead of devices, and the same for scenes.

Livin wrote:It would be cool if you could add to your plugin, the ability to check global variables before triggering the Vera command.


I'm sure this could be added somehow. Maybe I can make a "conditional" action where you give it a global var (or several) in addition to the scene to trigger. I'll need to think about it a bit, but I don't see why it couldn't be done.

Livin wrote:Also, we might be able to get some assistance from Jonib, on this forum, since he is the guru behind the XBMC EG plugin. Possibly even directly integrating XBMC JSON API connections directly into your EG Vera plugin - what do you think?


Sounds good to me. Can you give me a use case for the XBMC integration? If you just want to trigger scenes based on XBMC events I think you can do that with EventGhost and this plugin (once I fix running scenes) already through the XBMC Event Receiver. I know you are more experienced with EventGhost that me by far so I assume you have something else in mind, like being able to control Vera with XBMC through an interactive plugin in XBMC? That sounds a bit harder, but I like XBMC so I'm happy to try, especially if we have someone to kick us in the right direction.
radengr
 
Posts: 18
Joined: Sat Sep 17, 2011 6:31 am

Re: Mi Casa Verde Vera2

Postby Livin » Sun Jul 29, 2012 5:28 am

radengr wrote:Sounds good to me. What can you give me a use case for the XBMC integration? If you just want to trigger scenes based on XBMC events I think you can do that with EventGhost and this plugin (once I fix running scenes) already through the XBMC Event Receiver. I know you are more experienced with EventGhost that me by far so I assume you have something else in mind, like being able to control Vera with XBMC through an interactive plugin in XBMC? That sounds a bit harder, but I like XBMC so I'm happy to try, especially if we have someone to kick us in the right direction.


I was thinking that since you may already have the base code for the communications to/from Vera, just having it directly as an XBMC plugin would have these benefits...

eliminate dependance on EG
- reduce complexity of the overall solution... XBMC + your code <-> Vera ... instead of ... XBMC <-> EG + your code <-> Vera
- allow people to benefit from your great work that use XBMC on other OSes (Linux, etc)

for myself, I may move to Linux in the future - especially once a DVR app is working well with XBMC - but in the short term, reducing complexity is the main goal for me, in preparation for that move and to make troubleshooting easier.

For your code, I'd like to use it in XBMC so when I perform actions (start a movie), it checks a condition or two (30 minutes after sunset) then tells to Vera to trigger Scenes - or not if conditions are not met.

To keep the XBMC interface simple, I'd suggest an XML config file a user can fill in to tell your code what to do (xbmc action, conditions, vera scenes/devices, etc)

Check out XBMC Addon 'X10 Commander'. I made some suggestions to the coder to make his Addon extensible to support other HA devices. I don't think he did, but his code might be useable as a base - not sure.

And the Twilight EG plugin uses some python called SUN.PY which does all the dawn/dusk calculations... it should be usable as-is for you since Twilight is simply an EG based wrapper for it.
setup... XBMC, W7MC for DVR & Live OTA TV, JRMC for multi-zone audio, EG, MiCasaVerde Vera3, USB-UIRT IR receiver, Harmony remote, 5.2 home theater system
User avatar
Livin
Experienced User
 
Posts: 749
Joined: Wed Oct 08, 2008 4:56 am

Re: Mi Casa Verde Vera2

Postby radengr » Sun Jul 29, 2012 4:04 pm

I think your example is actually possible without using EventGhost / this plugin at all.

See here for triggering some basic events from XBMC:
http://www.jordanhackworth.com/home-aut ... with-xbmc/

And this post contains a couple tweaks you would want to make:
http://forum.micasaverde.com/index.php/ ... l#msg74308

It does look like this method may be depreciated, so an XBMC guru could tell us how to tweak it to bring it up to date.

It is pretty easy to create a scene in MiOS that does what you want (only run at certain parts of the day) and there are lots of examples in the forum on how to do that. If you want to avoid code completely (this would only be a line or two of LuUP so the code would be easiest) I think you could make three scenes.

1. A scene "Turn on Lights for Movie"
2. A scene to set scene 1 to "active" at dusk
3. A scene to set scene 2 to "inactive" at dawn

I would really like to expand this plugin to support some type of conditional expressions and optionally work independently of EventGhost (the client already runs independently, but I need some type of rule engine), tie into XBMC, etc. In fact the client code was not originally written to be integrated with EventGhost, I just realized I could easily do so. Unfortunately, my free time is pretty limited, so I can't make any promises of if and when I will get to it.

That isn't to say I won't try to immediately fix any bugs in this plugin, just that major functionality has some unknown amount of work involved in the implementation, and this is a hobby, which means I have to plod along as I have time. :| I'm just mentioning this because I promised some code to people on the Micasaverde forum a few months ago and I'm just now getting to it :oops: and I want to avoid making promises I can't keep in the future.

Speaking of not having enough time, Chixxi on the Micasaverde boards has written a XBMC plugin for Vera that presumably works a lot like the XBMC event watcher for Eventghost. Unfortunately, he decided not to release it because his other plugins were inundating him with support requests. Hopefully someone else can work out a similar plugin there, but it sounds like it can be done.

Personally while the Vera does a great job with my lighting, motion sensors, thermostats, and door locks, I think it is never going to be very convenient to use it to control my A/V. Eventually I want something that can do everything (A/V, lighting, etc) with a combined interface (web and android). I also want to move the rules engine outside of Vera to make it easier for me to expand, and just use Vera as a basic controller on a device level. I'm not sure what that will look like but this plugin is one attempt at moving in that direction. If and when I figure that out I will definitely share my code / method :).
radengr
 
Posts: 18
Joined: Sat Sep 17, 2011 6:31 am

Re: Mi Casa Verde Vera2

Postby Livin » Sun Jul 29, 2012 5:38 pm

Yes, I do think that code you lined to is using a depreciated method (and not very flexible)... this is why I was thinking a JSON API interface would be best. Jonib, on this forum, has some code working in EG (probably works fine as standalone PY) and I also found someone ha published a JSON API HTTP Python library https://github.com/joshmarshall/jsonrpclib - this might be usable with your code? To make things even more robust, XBMC 12 will include Websockets http://wiki.xbmc.org/index.php?title=JSON-RPC_API/v5 - which there is already an EG plugin for :)

On the Vera side... I do agree with you, Vera scenes could do much of the scene work but I want to avoid making 3 scenes for every 1 actually needed... I may need to resort to using LUUP code, which I hope is easy.

So, if you want, I'll work with you to focus on making our solution work with just Vera + XBMC? I'm looking into the LUUP code now
setup... XBMC, W7MC for DVR & Live OTA TV, JRMC for multi-zone audio, EG, MiCasaVerde Vera3, USB-UIRT IR receiver, Harmony remote, 5.2 home theater system
User avatar
Livin
Experienced User
 
Posts: 749
Joined: Wed Oct 08, 2008 4:56 am

Re: Mi Casa Verde Vera2

Postby radengr » Sun Jul 29, 2012 8:01 pm

LUUP code (at least at the level you are looking at) is pretty easy. But sure, lets see what is possible with Vera + XBMC. The Vera client is getting events from Vera with JSON over HTTP so hopefully XBMC events aren't much harder.
radengr
 
Posts: 18
Joined: Sat Sep 17, 2011 6:31 am

Re: Mi Casa Verde Vera2

Postby Livin » Sun Jul 29, 2012 8:28 pm

radengr wrote:LUUP code (at least at the level you are looking at) is pretty easy. But sure, lets see what is possible with Vera + XBMC. The Vera client is getting events from Vera with JSON over HTTP so hopefully XBMC events aren't much harder.


I've been looking around a few Vera plugins we might be able to use to avoid LUUP based scenes... but in the end, the LUUP code might be less hassle.

I made a feature request to the Heliotrope plugin maker to add dawn/dusk... if he does this, it will help a ton.
setup... XBMC, W7MC for DVR & Live OTA TV, JRMC for multi-zone audio, EG, MiCasaVerde Vera3, USB-UIRT IR receiver, Harmony remote, 5.2 home theater system
User avatar
Livin
Experienced User
 
Posts: 749
Joined: Wed Oct 08, 2008 4:56 am

Re: Mi Casa Verde Vera2

Postby radengr » Sun Jul 29, 2012 9:28 pm

It looks like futzle has a virtual switch that can be used to do what you want. This means only one scene and no Luup, but you would need to add the virtual device.

I think these are the rules:
1. Astronomical dawn is sun > -18 degrees below the horizon
2. Astronomical dusk is sun < -18 degrees below the horizon

So you could start with the combination virtual switch and this post:
http://forum.micasaverde.com/index.php/ ... l#msg80470

Change the first rule to "altitude" is in range "-90" to "-18" and you have a switch for night based on astronomical dawn and dusk rather than sunset.

You can make your scene dependent on this switch being active. This doesn't *quite* solve your problem because I know you wanted + 30min, so that would probably involve the changes you requested from futzle and some Luup code.
radengr
 
Posts: 18
Joined: Sat Sep 17, 2011 6:31 am

Re: Mi Casa Verde Vera2

Postby Livin » Mon Jul 30, 2012 1:39 am

radengr
thx for the info, I will try it out tonight... though, as you pointed out, having my feature requests built-into Heliotrope would make it MUCH easier and less complex, overall.
setup... XBMC, W7MC for DVR & Live OTA TV, JRMC for multi-zone audio, EG, MiCasaVerde Vera3, USB-UIRT IR receiver, Harmony remote, 5.2 home theater system
User avatar
Livin
Experienced User
 
Posts: 749
Joined: Wed Oct 08, 2008 4:56 am

Re: Mi Casa Verde Vera2

Postby blaher » Tue Jul 31, 2012 6:34 am

I'm getting feedback from Vera for light switches after the vera.initialdata, but not for my Aeon Labs appliance module, which my printer is plugged into.

ImageImage
blaher
Experienced User
 
Posts: 152
Joined: Thu Nov 17, 2011 1:27 am

Re: Mi Casa Verde Vera2

Postby blaher » Tue Jul 31, 2012 6:56 am

Livin wrote:-- Action: IF Dawn/Dusk Status >= astronomical.dawn + 30 minutes THEN continue macro, ELSE stop macro


Could you just run a timer similar to the one below, except after sunrise +30 to switch on a virtual switch.
Image

Then when your macro runs, it just needs to check whether the virtual switch is on or not.
blaher
Experienced User
 
Posts: 152
Joined: Thu Nov 17, 2011 1:27 am

Re: Mi Casa Verde Vera2

Postby Livin » Tue Jul 31, 2012 2:36 pm

radengr
Walter has done a great job of putting the needed additions into SunTracker, so now, this is totally useable in EG. We'll see if Heliotrope gets the same treatment... if it does, EG will not be required, though it might still provide more flexibility since it has stronger macro/scene capabilities than Vera.
setup... XBMC, W7MC for DVR & Live OTA TV, JRMC for multi-zone audio, EG, MiCasaVerde Vera3, USB-UIRT IR receiver, Harmony remote, 5.2 home theater system
User avatar
Livin
Experienced User
 
Posts: 749
Joined: Wed Oct 08, 2008 4:56 am

Re: Mi Casa Verde Vera2

Postby Livin » Tue Aug 07, 2012 5:11 am

radengr,
SunTracker is now exactly what we need (I think) to have REAL scene automation based on sunrise/sunset, in EG.

Also, I just noticed something about your plugin... it is not logging the Room. Can you add the Room to the log, it is essential since many devices can/do have the same names. Example...

2012-08-06 22:01:56 ["'Vera.Fan", "Light.ON.71'"]Vera.Fan Light.ON.71

... there could be many rooms with a Fan Light (and in my house there are 4).

thx,
Aaron
setup... XBMC, W7MC for DVR & Live OTA TV, JRMC for multi-zone audio, EG, MiCasaVerde Vera3, USB-UIRT IR receiver, Harmony remote, 5.2 home theater system
User avatar
Livin
Experienced User
 
Posts: 749
Joined: Wed Oct 08, 2008 4:56 am

Re: Mi Casa Verde Vera2

Postby radengr » Thu Aug 16, 2012 2:50 pm

@Livin, I will be uploading a new version soon with some bug fixes and I'll make sure the room is added.
radengr
 
Posts: 18
Joined: Sat Sep 17, 2011 6:31 am

Re: Mi Casa Verde Vera2

Postby Livin » Thu Aug 16, 2012 3:24 pm

radengr wrote:@Livin, I will be uploading a new version soon with some bug fixes and I'll make sure the room is added.


cool... i'll be watching for it.
setup... XBMC, W7MC for DVR & Live OTA TV, JRMC for multi-zone audio, EG, MiCasaVerde Vera3, USB-UIRT IR receiver, Harmony remote, 5.2 home theater system
User avatar
Livin
Experienced User
 
Posts: 749
Joined: Wed Oct 08, 2008 4:56 am

PreviousNext

Return to Feature Requests

Who is online

Users browsing this forum: Exabot [Bot], Google [Bot] and 1 guest