more G-Labs products

Author Topic: What Statistics Are Available for a Module?  (Read 712 times)

January 13, 2016, 04:14:27 PM
Read 712 times

kevinvinv

  • ****
  • Information
  • Sr. Member
  • Posts: 196
Hello,

Still ramping up on HG.  :)

I guess I havent found out what data is all available at the module level for lets say, an X10 switch or sensor.

For example,  can one obtain the last time the sensor sent a command or the time of the command previous to that?   

You probably can see where I am going,  I want to ignore motion sensor commands if they happen within 10 minutes of each other.

I've seen some code that does that sort of thing but it got me thinking about whether or not the module.statistics keep this.

Am I making any sense?

Thanks!!

January 13, 2016, 04:19:53 PM
Reply #1

bkenobi

  • *****
  • Information
  • Global Moderator
  • Posts: 1525
That data is available in the history array.  I use it in the ASL code so you can see it for an example.  In my code, I have a switch that can be used to have multiple results.  Single tap ON, double tap ON, single tap OFF, double tap OFF.  These all result in slightly different actions from HG and all rely on knowing how long of a gap between the current and last actuation of the switch was as well as whether they were both the same command or not.

January 13, 2016, 04:39:07 PM
Reply #2

kevinvinv

  • ****
  • Information
  • Sr. Member
  • Posts: 196
Many thanks as always.

Do you know where I would look for details on this history array by chance?

Second quick question for you...   for your X10 motion sensors do you have them configured as a "switch module" or are you configuring them as "sensor" modules somehow?

January 13, 2016, 04:45:15 PM
Reply #3

bkenobi

  • *****
  • Information
  • Global Moderator
  • Posts: 1525
My ActiveEye (MS16A) modules are set up as sensors in HG.  For testing, I have changed them to switches so I could manually test the code and that also works.  But, since they are a sensor, I leave them as such.

The documentation for the history array is in the statistics section:
http://genielabs.github.io/HomeGenie/api/ape/a00017.html

I find that the documentation is a bare minimum and does not help the new user/developer understand usage much.  I wish there were examples (one line of code would be enough) for each method so we could see how to use it correctly.  If you search the forum, I worked with Gene to get the history array working in ASL.  You might find some useful context in that discussion.