more G-Labs products

Author Topic: Smart Light issue - Light won't time out  (Read 645 times)

June 17, 2016, 04:34:32 AM
Read 645 times

texasaggie97

  • *
  • Information
  • Newbie
  • Posts: 11
I am new to HomeGenie and home automation in general so I am just getting started.

I've done the simple things like get switches added to ZWave and on a schedule.

My latest task was to turn on a light when a motion sensor triggers.

This works. What doesn't work is having it turn off based on time.

I have figured out why this is happening but I do not know enough about HomeGenie to know what the proper fix would be.

Because I want the interface to reflect the actual state of the switch, I have HomeGenie query all the switches/dimmers for their state once a minute.

The way the Smart Light timeout code works is it looks at the time of the last event OF THE SWITCH to see of the time has expired. Because the switch is queried every 60 seconds, any timeout longer than that never triggers because the last event is always 60 seconds or less.

It seems like the timeout code should query for the last event of the motion detector and not the switch to see if the time has elapsed.

A little knowledge is a dangerous thing because the only way I can think to fix this using my limited knowledge seems pretty complicated.

I have worked around this by turning off the light when the motion detector times out after the last motion.

June 17, 2016, 05:04:10 PM
Reply #1

bkenobi

  • *****
  • Information
  • Global Moderator
  • Posts: 1525
You can either modify the code on your own or use a version that looks at the light switch too. 

Modifying the code is primarily dependent on having an understanding of an approach to get what you want to happen.  The code is obviously an issue, but understanding what needs to happen is critical.  If you think the change is minor, I'd recommend copying the Smart Lights code and changing it as you need (that way you have the original file to fall back to).

The problem I think you have is that switches are not really supported by the original Smart Lights code.  I wanted more capability and wrote the Advanced Smart Lights code.  It can use a switch to override the motion sensor or start a timeout on its own.  Give it a look and see if it does what you want.  Be aware though, I wrote it for X10 and do not have any way to test it for other systems.  It should work, but there may need to be some tweaks.