HomeGenie Forum

Automation Program Plugins and Wizard Scripting => Help => Topic started by: bradvoy on May 02, 2014, 05:32:01 AM

Title: Update Parameter via web service call
Post by: bradvoy on May 02, 2014, 05:32:01 AM
I want to trigger actions in HomeGenie when my garage door opens.  I have a program running on a different computer (not the computer where HomeGenie is running) that monitors a magnetic switch attached to the garage door and knows when it opens.  I would like to make a web service call from that computer to the computer where HomeGenie is running when it detects the door opening.  But I can't figure out how to do this.  I've read the wiki page about the web service API and I see how to do other things like get and set the list of modules, groups, etc., but I can't see how to trigger a HomeGenie program via a web service call.  Is this possible? 
Title: Re: Update Parameter via web service call
Post by: Gene on May 02, 2014, 09:59:43 AM
Code: [Select]

/api/HomeAutomation.HomeGenie/Automation/Programs.Run/<program_id>/


HG WebService API documentation is not really complete. You can look the various handlers source code to see what you can do.

https://github.com/genielabs/HomeGenie/blob/master/HomeGenie/Service/Handlers/Automation.cs#L265

g.
Title: Re: Update Parameter via web service call
Post by: bradvoy on May 03, 2014, 05:03:08 AM
Thanks Gene, that worked nicely.  I can now trigger my HG program from a remote server.  The first thing my program does is make a call back to the remote server to retrieve some data (the status of the garage doors).  Is it possible for my web service call into HG to pass in this data so I don't have to make a call back to the remote server to retrieve that data?  I noticed that the Security Alarm System program has a When.WebServiceCallReceived clause, which sounds similar to what I want, but I can't quite figure out how to do something similar in my program.

By the way, HG is a great system.  I've only been experimenting with it for a few days, but I'm really impressed with what you've put together.
Title: Re: Update Parameter via web service call
Post by: Gene on May 03, 2014, 10:01:22 AM
You find an example for When.WebServiceCallReceived at the bottom of this page:

http://www.homegenie.it/docs_api/advanced.html (http://www.homegenie.it/docs_api/advanced.html)

Let me know if you need further help.

Cheers,
g.
Title: Re: Update Parameter via web service call
Post by: bradvoy on May 05, 2014, 04:17:30 PM
I successfully implemented a WebServiceCallReceived handler by following the example on that page.  Thanks for the guidance.