more G-Labs products

Author Topic: Need More Documentation / Examples  (Read 974 times)

August 30, 2016, 08:32:47 AM
Read 974 times

reza

  • *
  • Information
  • Newbie
  • Posts: 10
First off, love this app.  I've managed to add support for a 433Mhz transmitter to control my RC Switches on a Raspberry Pi (see attached file).   Bu I've got a ton of questions though that I've Not been able to find answers to so far. (learning curve a bit steep)

I have some sensors and relays attached to some custom boards controlled via Electric Imp.  I got the control working, but I want to add support to poll the devices as they are controlled through other mechanisms as well. 

If I get MQTT working, how can I get HG to get status info from MQTT for lights (on/off)?

If I want to poll directly, I've implemented

http://10.10.10.210/api/HomeAutomation.RelaySwitch/2/Basic.Get

But I'm not sure what format to return code to get the light switch on the GUI to be updated.  I've been looking at the Level Poll example, and it just issues the call

 module.Command("Basic.Get").Execute();

but how does that translate to a status change on the light? 

Also, I'm confused by how objects are structured.  Level Poll itterates on modules that have feature called 'HomeGenie.ZWaveLevelPoll' but not 'HomeAutomation.Zwave' -- I'm so confused about the naming structure, how things end up getting the ZWaveLevelPoll tag assigned, etc. 

More questions:

I still don't understand how the 'Zone Sensors' program under 'Devices And Things' is supposed to be used.  How do I assign them together and what's the benefit?

Also, I have the Rainforset Automation power monitor device - any support for using that with HG?


I've got a bunch more questions but this is a good start :)

thnx in advance.


August 31, 2016, 08:25:35 AM
Reply #1

reza

  • *
  • Information
  • Newbie
  • Posts: 10
I was able to make some progress - seemed I needed to restart HG to make some of the code work.  This is the program code :

Code: [Select]
while (Program.IsEnabled){
  // basic get will returns current device level
  Modules.WithFeature("HomeGenie.IMPPoll").Each((module) => {
    module.Command("Basic.Get").Execute();
    return false; // do not break, continue iterating...
  });
  // pause between each poll
  var delay = Program.Option("IMPPollInterval").DecimalValue;
  if (delay < 5) delay = 5;
  Pause(delay);
}

and the startup code

Code: [Select]
Program.AddOption("IMPPollInterval", "90", "IMP Poll Interval (seconds)", "text");
Program.AddFeature("HomeAutomation.RelaySwitch", "Light,Switch", "HomeGenie.IMPPoll", "Poll module level", "checkbox");
Program.Run();

The output of the Basic.Get is this

Quote
{ 'ResponseValue' : '1' }

Not sure what I'm supposed to reply with to get the status of the switch updated.

I was able to turn on the Poll module level flag on the associated modules, but I'm not sure if it's working even...

On another note, I bought the paid version of the android app which seems to support SSL but not sure if that's built into the app or if I have to use a reverse proxy.

Thanks,Reza

September 02, 2016, 02:31:53 AM
Reply #2

reza

  • *
  • Information
  • Newbie
  • Posts: 10
I was able to get it to work.