more G-Labs products

Author Topic: Advanced Smart Lights  (Read 20538 times)

December 30, 2014, 07:26:31 PM
Reply #30

dani

  • *****
  • Information
  • Global Moderator
  • Posts: 535
I think physical device is somewhere in the struct module.Instance
I will find. I don't think is different between Zwave or X10. Only the phisical object is used by the interface at the end point, but the struct is the same I think, only the driver change. It's one of the advantage of C#.

January 04, 2015, 08:29:17 AM
Reply #31

bkenobi

  • *****
  • Information
  • Global Moderator
  • Posts: 1525
r453 has introduced a new set of history data that makes the LastEvent scripts unnecessary. As such, once you update to r453+ you can delete LastEvent and update the attached scripts.  Enjoy!

In case anyone wants to see what the new history data can do, I've included a script (History_log) that will output this data.  This module is not needed, but it might be informative.

January 07, 2015, 11:18:56 AM
Reply #32

dani

  • *****
  • Information
  • Global Moderator
  • Posts: 535
Thank's bkenobi.
I think you can introduced the notion of my contribution (Calendar and Hour tables) in your project.
Look at this message http://www.homegenie.it/forum/index.php?topic=591.msg3539#msg3539

Cheers
Dani

January 25, 2015, 06:44:12 AM
Reply #33

bkenobi

  • *****
  • Information
  • Global Moderator
  • Posts: 1525
During speed test of HG, I've found that writing log data to a network drive can cost up to 1 second when turning on a light.  I have added a parameter to determine whether logging is desired.  By default, it will be set to false so no logging will be performed.  If you want to enable logging, just change the parameter to "TRUE" and restart the code.

As always, let me know if there are any problems found.  Enjoy!

January 27, 2015, 10:41:47 PM
Reply #34

nolio

  • *****
  • Information
  • Global Moderator
  • Posts: 544
Hi Kenobi,

My alarm system doesn't work when i activate your History_log-20150103.hgx.
I replace at the end :
Code: [Select]
return false;By :
Code: [Select]
return true;And my alarm system work fine again. I am sure to understand why  ??? But it seems that when your script "catch" the event and never go out of the When.ModuleParameterChanged((module, parameter) =>  (because return is set to "false") ... Possible ??

Bye

January 27, 2015, 11:12:27 PM
Reply #35

bkenobi

  • *****
  • Information
  • Global Moderator
  • Posts: 1525
Code: [Select]
return false;
This code will keep the loop running until all changes have been dealt with.  It should kick out of the loop at that point and go back to sleep.  I believe HG runs things in parallel, so I wouldn't have thought this would be an issue.

Out of curiosity, what are you using the History log for?  I primarily was using it to look at the values HG was reporting to verify other code was working.  I don't use it for normal operation.  I do use Activity log all the time which uses the same code structure.

January 28, 2015, 12:20:01 AM
Reply #36

nolio

  • *****
  • Information
  • Global Moderator
  • Posts: 544
Code: [Select]
return false;
This code will keep the loop running until all changes have been dealt with.  It should kick out of the loop at that point and go back to sleep.  I believe HG runs things in parallel, so I wouldn't have thought this would be an issue.
Can you reproduce on your side ?
Out of curiosity, what are you using the History log for?  I primarily was using it to look at the values HG was reporting to verify other code was working.  I don't use it for normal operation.  I do use Activity log all the time which uses the same code structure.
I use activity log to
  • Check the status chance of a device which not work fine around 0°
  • Like to have a history view of change of my devices
But i simplify the code to just log the new status (not the last status).

January 28, 2015, 12:31:28 AM
Reply #37

bkenobi

  • *****
  • Information
  • Global Moderator
  • Posts: 1525
I'm not sure I understand the request.  using false in a loop will keep it running until it reaches the end of modules that have changed.  That is defined by Gene in his documentation.  If you set true as the condition, it will only process the first module that is changing (which may be only one anyway).

The new status should be the same data the the Activity log outputs currently.  The main difference would be that the time stamp that is reported is a fractional second later than the module change due to processing time.  If you wanted, you could report either the module change time instead of the current time stamp time or output the change time after the module that is changing.  It's very simple code so you can change it pretty easily.

February 24, 2015, 07:43:31 PM
Reply #38

JoeMNZ

  • *
  • Information
  • Newbie
  • Posts: 1
Hey bkenobi,

I'm struggling to get Advanced Smart Lights to work correctly...

Currently we have 48 Virtual Modules for outputs from HomeGenie (off to a bank of 48 relays) and aprox. 48 Virtual Modules for inputs to HomeGenie.

I have applied Advanced Smart Lights to around 15 or so outputs, IE: Light Fittings.
I have assigned them all their own inputs, with most rooms having a PIR, and a button for said light.

After getting virtually the whole house pre-configured, I have gone to test..  If I press the button associated with the "Lounge Main Lights", it in turn switches on aprox. 6 - 8 other outputs which are associated with different inputs. I initially thought that it may have been due to the input names being fairly similar, IE: Lounge Main Lights, Kitchen Main Lights, etc.. but after changing some input names around to numbers instead, I still had the same issue of multiple other outputs being switched on.

Just to add to that, when triggering a PIR for any of the zones, they get switched on properly...

I was hoping you could give me some of your thoughts on this..

Thanks in advance!

Joe

February 25, 2015, 12:33:21 AM
Reply #39

bkenobi

  • *****
  • Information
  • Global Moderator
  • Posts: 1525
Your best bet is to turn on the debug log and look at what's going on.  It might also help to redirect the mono output to a file such that you can see more details about what HG is doing as well.  I can try to look at things if you need some help, but be aware that I only use X10, so I may have to defer to users with more experience with other automation hardware.

It's also possible that different automation hardware requires some slight tweaks in the Advanced Smart Lights code.  I don't think that should be required since everything is referred to by module name or the module's parameter which should be independent of the type of hardware.

September 21, 2015, 08:59:27 PM
Reply #40

nolio

  • *****
  • Information
  • Global Moderator
  • Posts: 544
Hi bkenobi,

With the latest HG (r496) :
Code: [Select]
parameter.Statistics.History[x].Valueseems to doesn't work anymore, did it work for you with in the newest version ?
I have got a message "Argument is out of range. Parameter name: index" when i put x > than 0 ...

Bye
« Last Edit: September 21, 2015, 09:01:37 PM by nolio »

September 21, 2015, 11:00:39 PM
Reply #41

bkenobi

  • *****
  • Information
  • Global Moderator
  • Posts: 1525
I have it running on 496, but I did notice that my chime went off 4 times within 1 minute when my wife left this morning meanin that something may need fixing.  I'll look at the code.

September 22, 2015, 12:14:43 AM
Reply #42

bkenobi

  • *****
  • Information
  • Global Moderator
  • Posts: 1525
I am remote at the moment but did not get any errors when I compiled the code.  I looked at the logic and if the History[X] events are not valid, then that would explain why the chime tripped every time motion was sensed.
« Last Edit: September 22, 2015, 06:23:29 AM by bkenobi »

September 22, 2015, 06:31:14 AM
Reply #43

bkenobi

  • *****
  • Information
  • Global Moderator
  • Posts: 1525
I compiled the Advanced Smart Lights code from my home network and still got no errors.  However, I can confirm that the code does NOT function as it did prior to updating to 495/496 last weekend.  Now whenever motion is sensed it triggers the chime.  The way it SHOULD work is that a check of the last time motion was sensed should result in triggering the chime at most once every xx minutes based on the specified timeout duration.  It appears that the history[X] parameter does not function the way it used to.  Perhaps something else changed, but that appears most likely.  I'll direct Gene to this post to see if he can help.

September 22, 2015, 08:35:36 AM
Reply #44

Gene

  • *****
  • Information
  • Administrator
  • Posts: 1472
  • Tangible is the future!
    • Yet Another Programmer
Hi bkenobi,

the value history in previous version was ignoring the "HistoryLimit" property. This property is used to keep the history within a certain number of elements that is by default 10. If you need more data you can change the HistoryLimit value.
Could this be the issue?
The main change on the ValueStatistic class is the following:

https://github.com/genielabs/HomeGenie/blob/master/HomeGenie/Data/ValueStatistics.cs#L130

g.