HomeGenie Forum

Automation Program Plugins and Wizard Scripting => Help => Topic started by: uipipipe on December 09, 2015, 04:15:15 PM

Title: ARDUINO WEB CALLS - GET BACK STATUS
Post by: uipipipe on December 09, 2015, 04:15:15 PM
Hi Everybody,

Like a lot of us, I can control an Arduino from HG using web calls to turn a pin (switch) on, off, just a brief push or a simple toggle, using Ardunino as web server with a ethernet shield.
But I absolutely need to get back the status of those Arduinos's pins, because Arduino is doing is job and in certain conditions it changes de pins status.
I am able to get it status by web (something like http://ipaddress/pin2/status (http://ipaddress/pin2/status)), and the Arduino as web server send back a HIGH or a LOW.

I need help to use this status to turn a HG switch or light signal ON or OFF as soon as some status changes or at least at periodical time lapse.

Can you please help me with this ?
I think with this method we could use an Arduino (cheaper) instead a RPi to send back status to main HG box.

Thanks in advance.
Title: Re: ARDUINO WEB CALLS - GET BACK STATUS
Post by: bkenobi on December 09, 2015, 05:16:18 PM
You'd simply need to parse the feedback and set the status of the associated module.  What part are you having issues with?  If you can program the Arduino for what you need, send the command from HG, and see the feedback on the HG box, it seems like you are capable of programming the last little bit.  Perhaps I'm misunderstanding the request.
Title: Re: ARDUINO WEB CALLS - GET BACK STATUS
Post by: kevin1 on December 09, 2015, 05:51:46 PM
Look at the arduino "web server" example (https://www.arduino.cc/en/Tutorial/WebServer (https://www.arduino.cc/en/Tutorial/WebServer)).  It generates/sends a web page by default with embedded data from the a2d/gpio.  I changed it to send JSON formatted data since HG (or is it C#) parses it effortlessly. 

I am still polling my arduinos for status.  Eventually need to have the arduinos call an HG web api, but I have had trouble making that work.
Title: Re: ARDUINO WEB CALLS - GET BACK STATUS
Post by: uipipipe on December 10, 2015, 05:12:56 PM
@kevin1,

Thank you so much. In fact i just needed that little push. It's done already. Control Arduino input and output digital and analogic pins (feed and feedback).
YoulessEnergy.hgx is a simple and great example

@bkenobi,
Thanks for wake me up from my laziness.  :D :D , I mean it man! Tx. Was realy easy. You were right.
Title: Re: ARDUINO WEB CALLS - GET BACK STATUS
Post by: bkenobi on December 11, 2015, 12:00:41 AM
We all need a little push sometimes.   8)
Title: Re: ARDUINO WEB CALLS - GET BACK STATUS
Post by: kevin1 on December 11, 2015, 01:31:28 PM
Welcome  :)

Some parts of HG are awesome!  I have really enjoyed getting the arduino to HG communications and setting them up in my garage and basement.  Other things in HG have been more difficult, we just need a little bigger community to help everyone out.