Author Topic: EventGhost Plugin for Vera Control (runs on EventGhost)  (Read 5529 times)

radarengineer

  • Sr. Member
  • ****
  • Posts: 397
EventGhost Plugin for Vera Control (runs on EventGhost)
« on: September 18, 2011, 07:57:32 pm »
I have created a basic EventGhost plugin that allows control of Vera. I'm not sure if this is exactly the right place to post this, as it is a plugin, even though it isn't a mios plugin.

It is in Python which is *not* my favorite language but the EventGhost framework was pretty straightforward so I think it is right.

Right now the only thing you can do is turn lights on/off and dim lights. It is fairly straightforward to extend, but I'm still working out the intricacies of the framework.

I think this will be a one way plugin. It is certainly possible to poll Vera "UI Simple" style from EventGhost, but I think it is better to have Vera send out messages instead. I am still trying to figure out what the best way to do that. Right now I'm leaning towards xPL (to keep it general and allow for other uses) but it is also possible to write a Vera plugin that sends events via the EventGhost HTTP interfaces.

---

EDITED:

Attachment removed, please see new version below. Full control (sending AND receiving events) included:

https://github.com/naething/vera-eventghost/
« Last Edit: July 28, 2012, 06:15:36 pm by radarengineer »

conchordian

  • Full Member
  • ***
  • Posts: 151
Re: EventGhost Plugin for Vera Control (runs on EventGhost)
« Reply #1 on: April 20, 2012, 04:27:22 pm »
Thanks very much, it works well.  Is it possible to send a run scene # too?

Cheers

Video321

  • Sr. Newbie
  • *
  • Posts: 28
Re: EventGhost Plugin for Vera Control (runs on EventGhost)
« Reply #2 on: April 20, 2012, 07:49:19 pm »
I found this yesterday and tested it out real quick... works nice!
Thanks.

conchordian

  • Full Member
  • ***
  • Posts: 151
Re: EventGhost Plugin for Vera Control (runs on EventGhost)
« Reply #3 on: April 22, 2012, 08:21:19 pm »
I found a way to run a scene from EventGhost using a tiny program called Wget. 

Start Application
Executable:
X:\wget.exe

Command Line Options:
--delete-after http://192.168.0.150:49451/data_request?id=lu_action&output_format=xml&serviceId=urn:micasaverde-com:serviceId:HomeAutomationGateway1&action=RunScene&SceneNum=2

Where 192.168.0.150 is the IP of the Vera, and the 2 in SceneNum=2 is the number of the scene you want to run.

Obviously not as flash as a plug-in, but it does the job. :)

conchordian

  • Full Member
  • ***
  • Posts: 151
Re: EventGhost Plugin for Vera Control (runs on EventGhost)
« Reply #4 on: April 24, 2012, 11:20:18 pm »
Is there any way to send EventGhost HTTP triggers via Vera?  I can only find out how to input, or control Vera via HTTP, rather than use it to send HTTP commands.

Cheers

Ap15e

  • Beta Testers
  • Sr. Hero Member
  • *****
  • Posts: 2000
Re: EventGhost Plugin for Vera Control (runs on EventGhost)
« Reply #5 on: April 25, 2012, 01:17:00 am »
 luup.inet.wget (to be used in the Luup tab for scenes).
« Last Edit: April 25, 2012, 01:34:52 am by Ap15e »

radarengineer

  • Sr. Member
  • ****
  • Posts: 397
Re: EventGhost Plugin for Vera Control (runs on EventGhost)
« Reply #6 on: April 27, 2012, 06:40:33 am »
@conchordian, one thing I've been considering is updating this plugin to have Vera changes generate events on the Eventghost side by writing an Eventghost event receiver plugin based on the Vera UI Simple examples. Then you could set up a virtual switch on Vera that would trigger some action in Eventghost. Would that work for your use case?

conchordian

  • Full Member
  • ***
  • Posts: 151
Re: EventGhost Plugin for Vera Control (runs on EventGhost)
« Reply #7 on: April 27, 2012, 08:44:30 pm »
Yes, that would work fine.  It opens up a lot of potential if EventGhost can not only send to Vera, but receive as well. 

I tried the  luup.inet.wget, thanks Ap15e, but I think it's a over my head trying to get it work with EventGhost's Network Event Receiver, or the 'Android' plug-in.

Cheers

Aaron

  • Sr. Member
  • ****
  • Posts: 387
Re: EventGhost Plugin for Vera Control (runs on EventGhost)
« Reply #8 on: June 21, 2012, 08:41:41 am »
two way communications Vera <-> EG would be very useful!

Ned

  • Sr. Newbie
  • *
  • Posts: 27
Re: EventGhost Plugin for Vera Control (runs on EventGhost)
« Reply #9 on: July 28, 2012, 04:38:03 am »
Thanks for the information!  This is something I have been looking for quite some time. The Vera control plugin for EventGhost would be great, but I don't see the attachment...

Anyway, there is one more step that I am looking for, and that is the ability to read the status of Vera (device or preferably a scene) from EventGhost. I know this probably belongs more in the EG forum, but I wanted to document how I did get things working because it was not in one place that I could find.

My media room setup has z-wave lights, Samsung TV, cable box, Onkyo receiver, and a Windows 7 PC with HDMI out.  I continue to have problems with the Onkyo plugin and the TrickTV app for Samsung still has not been released.

I was about to purchase the SQ Blaster to try and solve the TV/Reciever/Cable box control when I realized that I might be able to pull the USB IR receiver off of my PC and plug it into Vera! Well, Vera doesn't recognize it so, no joy there.

My next thought was I have a PC that receives IR commands sitting right next to Vera (network wise) that should be able to do what I want... right? Oh, and I did not want to constantly have Windows Media Center up... I rarely use it.

This brought me down a twisted, winding path. I may not have found the best or shortest route over the river and through the woods, but I did get to granny's house! I needed three programs to eventually talk to Vera from my IR. I will try to detail a little about each.

The first thing is being able to see the IR commands. To do this I used WinLIRC. They did not have my remotes codes so I needed to learn them. There is good documentation for each function and you need to run them as administrator.

Next you need to be able to trigger on the IR code. That's when I found EventGhost (and this thread). Once again, another learning curve, but I think I have the basics enough.

The third piece of my puzzle was how to trigger a Vera scene and the answer was once again in this thread. wget.exe with a few options works great to send http commands to Vera. Thanks conchordian!

Ok, thats a long story, but now I can control the lights with Play/Pause/Stop and when I turn off the TV, have the Onkyo turned off and after 2 min have the lights go off... Now I need to poll Vera to see the status of my scene so when I turn the TV on, I can turn the lights on.

So, back to my question, is there an easy way to poll Vera for the status of a scene from EventGhost?

Thanks for a great forum and all the help everyone!
A ship in a harbor is safe, but this is not what a ship is built for.

radarengineer

  • Sr. Member
  • ****
  • Posts: 397
Re: EventGhost Plugin for Vera Control (runs on EventGhost)
« Reply #10 on: July 28, 2012, 07:50:07 am »
Ned, I think you probably can't see the attachment because you are a "newbie". I will upload the attachment somewhere else where you will be able to get it. There is not currently an "easy" way for EventGhost to see what Vera is doing, but it is definetly possible. I've done it a few different ways by running another program outside of EventGhost that monitors Vera and sends EventGhost commands. The best way to do this is probably a Native EventGhost plugin which I'm also working on.

To be clear, the existing plugin SENDS commands to Vera. The second one I'm working on RECEIVES events from Vera (I'll merge them into one if it makes sense). I basically haven't done a thing on home automation in a few months due to other commitments, but I've actively working on all this again. The only thing I still have to figure out is running things asyncronously in EventGhost which probably involves moving my code to asynccore in Python.

radarengineer

  • Sr. Member
  • ****
  • Posts: 397
Re: EventGhost Plugin for Vera Control (runs on EventGhost)
« Reply #11 on: July 28, 2012, 10:58:05 am »
Ned, Please see: https://github.com/naething/vera-eventghost

Also, I added code so that now the plugin receives events from Vera as well! Right now I'm only handling Binary and Dimmable Lights, but I'll be tweaking this code to handle other things as well. Now that I have the framework in place it is pretty simple.

conchordian

  • Full Member
  • ***
  • Posts: 151
Re: EventGhost Plugin for Vera Control (runs on EventGhost)
« Reply #12 on: July 29, 2012, 11:05:01 pm »
Thanks very much, radarengineer.  I've been using the first version of your plug-in very successfully for a while now, mostly with the EventGhost XBMC plug-in http://www.eventghost.net/forum/viewtopic.php?f=9&t=1562

Your new one works for me to give me the events of: Vera.InitialData
& it seems to update with: Vera.NewData quite often,
but every so often it seems to crash, so I've attached a few screenshots and the error information in EventGhost.

http://i.imgur.com/2JZEu.png
http://i.imgur.com/66Aj6.png

16:31:03   error: uncaptured python exception, closing channel <eg.CorePluginModule.Vera.SimpleAsyncHTTP.AsyncHTTP connected at 0x45b4080> (<type 'exceptions.KeyError'>:'43' [asyncore.pyc|read|76] [asyncore.pyc|handle_read_event|416] [C:\Program Files (x86)\EventGhost\plugins\Vera\SimpleAsyncHTTP.py|handle_read|59] [asyncore.pyc|recv|369] [C:\Program Files (x86)\EventGhost\plugins\Vera\SimpleAsyncHTTP.py|handle_close|90] [C:\Program Files (x86)\EventGhost\plugins\Vera\VeraAsyncDispatcher.py|close|36] [C:\Program Files (x86)\EventGhost\plugins\Vera\VeraClient.py|update|117])

Thanks once again! :)

radarengineer

  • Sr. Member
  • ****
  • Posts: 397
Re: EventGhost Plugin for Vera Control (runs on EventGhost)
« Reply #13 on: July 29, 2012, 11:25:06 pm »
@conchordian, thank you for trying this out! Both crashes look like they occur at the same place. The first crash you linked was attempting to update device '43' and the second '5'. Are those normal devices on your Vera (by 'normal' I mean a standard z-wave device like a light switch)?

I'll try to add some better debugging code so that if something like that happens it is easier to figure out what has gone wrong, and I'll leave mine running overnight to see if I can get it to crash.

conchordian

  • Full Member
  • ***
  • Posts: 151
Re: EventGhost Plugin for Vera Control (runs on EventGhost)
« Reply #14 on: July 29, 2012, 11:32:31 pm »
I continue to have problems with the Onkyo plugin.

Are you using the EventGhost plug-in?  I have an Integra preamp, which uses the same plug-in as the Onkyo, and it works very well with network control.
http://www.eventghost.net/forum/viewtopic.php?f=10&t=2964

Quote
I was about to purchase the SQ Blaster to try and solve the TV/Reciever/Cable box control when I realized that I might be able to pull the USB IR receiver off of my PC and plug it into Vera! Well, Vera doesn't recognize it so, no joy there.

I plug a USB-UIRT into the Vera to control some things. It's a bit cheaper than the SQ blaster.

Quote
My next thought was I have a PC that receives IR commands sitting right next to Vera (network wise) that should be able to do what I want... right? Oh, and I did not want to constantly have Windows Media Center up... I rarely use it.

Why do you have to have Windows media centre up just to receive infrared?

Quote
The first thing is being able to see the IR commands. To do this I used WinLIRC. They did not have my remotes codes so I needed to learn them. There is good documentation for each function and you need to run them as administrator.

Why are you using WinLIRC instead of just EventGhost?  If you just want to receive infrared commands, then EventGhost can do that for you.  According to the website WinLIRC can send commands too, but I'm not sure how…

Quote
The third piece of my puzzle was how to trigger a Vera scene and the answer was once again in this thread. wget.exe with a few options works great to send http commands to Vera. Thanks conchordian!
  My pleasure :-)

Quote
Now I need to poll Vera to see the status of my scene so when I turn the TV on, I can turn the lights on.
You could use EventGhost and an infrared receiver to listen out for your TV's on signal and then execute the binary on command using radarengineer's plug-in.