more G-Labs products

Author Topic: Update Parameter via web service call  (Read 1632 times)

May 02, 2014, 05:32:01 AM
Read 1632 times

bradvoy

  • ***
  • Information
  • Full Member
  • Posts: 50
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? 

May 02, 2014, 09:59:43 AM
Reply #1

Gene

  • *****
  • Information
  • Administrator
  • Posts: 1472
  • Tangible is the future!
    • Yet Another Programmer
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.
« Last Edit: May 02, 2014, 10:02:57 AM by Gene »

May 03, 2014, 05:03:08 AM
Reply #2

bradvoy

  • ***
  • Information
  • Full Member
  • Posts: 50
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.

May 03, 2014, 10:01:22 AM
Reply #3

Gene

  • *****
  • Information
  • Administrator
  • Posts: 1472
  • Tangible is the future!
    • Yet Another Programmer
You find an example for When.WebServiceCallReceived at the bottom of this page:

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

Let me know if you need further help.

Cheers,
g.

May 05, 2014, 04:17:30 PM
Reply #4

bradvoy

  • ***
  • Information
  • Full Member
  • Posts: 50
I successfully implemented a WebServiceCallReceived handler by following the example on that page.  Thanks for the guidance.