Motion triggered lights with manual override

Posted on
Sun Feb 18, 2018 6:24 am
haavarda offline
User avatar
Posts: 702
Joined: Aug 18, 2012
Location: Norway

Motion triggered lights with manual override

For some weeks now I have been trying to add a manual override to my bedroom lights. I just cant wrap my head around the logic and keep biting my own tail.
My theory is that I should be able to detect if a light was turned on manually. Because then the motion sensor would then just have turned on.
My motion setup is basically as follows:

* Triggers on motion and turnes on lights, sets a variable and set the timer duration
* When motion sensor reports of a timer is started
* If motion again is detected and the variable above is true, timer is paused.
* If timer expires the lights is turned of and variable is set to false

My goal now is to detect that any light is turned on or off manually and then set timer to a new value and block motion until timer expires.
* I have tried to use the Persistence Timer from Timed Devices plugin to ignore fast manual changes. (fast on / off)
* I have tried to use a group trigger to detect when any light is turned on / off
* I have a Activity Timer from the Timed Devices plugin that turnes on if motion is detected. I use this to detect if the lights was turned on automatically (Motion triggered light sensor)

My goal is to have automatically controlled lights most of the time, and then if lights is forced on or off it should stay that way until the timer expires with a longer time than when triggered automatically.

Can anyone point me in the right direction?

Håvard

Posted on
Sun Feb 18, 2018 8:59 am
Colorado4Wheeler offline
User avatar
Posts: 2794
Joined: Jul 20, 2009
Location: Colorado

Re: Motion triggered lights with manual override

There are a couple of timer plugins out there that you could trigger, one is Timers and Pesters and Timed Devices is another (which I see you tried). I also wrote a plugin called Powermiser that was kind of for this purpose, or at least most of this purpose, so that I could put a group of lights in a group that is monitored and when a light kicks on then it will start a timer to turn any or all of them off.

I also have a plugin that does IF-THEN-ELSE that may be helpful fo this called Super Conditions - this might be good for that "if turned on by motion else if turned on by hand", I use this for my Kitchen lights so they don't time out when we are cooking dinner.

You could try any combo of those plugins or you could right a more complex system of actions that set variables and triggers that are raised as the result of a variable change, etc.

My house is very much like what you want, motion turns lights on for 3 minutes but a press of the switch turns it on for 10 with each subsequent press adding other 5.

My Modest Contributions to Indigo:

HomeKit Bridge | Device Extensions | Security Manager | LCD Creator | Room-O-Matic | Smart Dimmer | Scene Toggle | Powermiser | Homebridge Buddy

Check Them Out Here

Posted on
Mon Feb 19, 2018 2:05 am
haavarda offline
User avatar
Posts: 702
Joined: Aug 18, 2012
Location: Norway

Re: Motion triggered lights with manual override

Colorado4Wheeler wrote:
There are a couple of timer plugins out there that you could trigger, one is Timers and Pesters and Timed Devices is another (which I see you tried). I also wrote a plugin called Powermiser that was kind of for this purpose, or at least most of this purpose, so that I could put a group of lights in a group that is monitored and when a light kicks on then it will start a timer to turn any or all of them off.

I also have a plugin that does IF-THEN-ELSE that may be helpful fo this called Super Conditions - this might be good for that "if turned on by motion else if turned on by hand", I use this for my Kitchen lights so they don't time out when we are cooking dinner.


Thank you for your input.
Timers and Pesters is one of my most used plugins. I have about 20 different timers that I use for different things in my setup. As far as I can see your Powermiser plugin does not work with Z-wave? I only have Z-wave devices in my house. I will play a bit more with it to try find a good solution. One of the biggest challenges is to keep an overview of the logic. If this happens then that happens if this has not occurred etc...

Håvard

Posted on
Mon Feb 19, 2018 2:34 am
mundmc offline
User avatar
Posts: 1060
Joined: Sep 14, 2012

Re: Motion triggered lights with manual override

Wish I could be more helpful here.

I can only offer the workaround I personally use: having the notion activators turn the lights to a specific brightness (e.g. 99) so that they can be ID’d as a light that wash turned on by a motion detector


Sent from my iPhone using Tapatalk

Posted on
Tue Feb 20, 2018 4:30 am
stuartcolman offline
Posts: 81
Joined: Nov 01, 2015
Location: Essex, United Kingdom

Re: Motion triggered lights with manual override

Hi, I have this exact scenario in my kitchen. Motion turns the lights on (if light is below a set lux level or the variable dark is true). The timer then waits for the motion sensor to go off and starts a 3 minute timer. If motion is sensed again it stops the timer and goes through the cycle again waiting for the sensor to turn off.

The override is done via the light switch. A scene number is sent via the fibaro module, when this is received it sets a variable, stops the 3 minute timer and waits. When no motion is shown, it now executes a 30 minute timer. If motion with the override variable set then it resets the 30 minute timer and so on.

I tried using some of the plugins, but some very small bits of the logic just didn’t work.

The key is the override variable and conditional logic to look at this and choose which timer to set.

With the fibaro it can send a scene on switch on and a different one on switch off if my memory serves me correctly.

I also have an RGB led strip, which when on normal timer is blue, when it’s on extended timer it goes green.

Hope this helps.

Posted on
Tue Feb 20, 2018 6:59 am
Japple55 offline
Posts: 224
Joined: Sep 26, 2015
Location: NE Tennessee

Re: Motion triggered lights with manual override

I understand using the 99% vs 100% brightness to determine how the light was switched on (manual vs motion) but I have to set the dimmer device to poll "as often as possible" in order to detect a manual activation. That seems to generate a lot of polling traffic. Is that how you are detecting a manual activation? Or using a luminance sensor to generate a poll action? What am I missing?

TIA,
Jim

Posted on
Wed Feb 21, 2018 4:53 am
stuartcolman offline
Posts: 81
Joined: Nov 01, 2015
Location: Essex, United Kingdom

Re: Motion triggered lights with manual override

Are you using the Fibaro Dimmer module? If so there is a setting for sending scene commands. I use that and then set a trigger action on that.

Posted on
Thu Feb 22, 2018 5:29 am
Japple55 offline
Posts: 224
Joined: Sep 26, 2015
Location: NE Tennessee

Re: Motion triggered lights with manual override

Thanks, but unfortunately, no, I'm using GE dimmers. I have 4 switches in that particular box so it's pretty tight - not sure I could get a Fibaro in there. I realized my thought of using a luminance sensor to trigger the polling won't work either. That motion sensor would likely be triggered before the manual switch, so the lights would already be on and would not register a change if the manual switch is activated after the motion.

Back to the drawing board...

Posted on
Sat Feb 24, 2018 5:47 pm
mundmc offline
User avatar
Posts: 1060
Joined: Sep 14, 2012

Re: Motion triggered lights with manual override

I will try to be clearer on my usage:

I use motion sensors that send an “on” and “off” command. The “off” command is sent when a predefined amount of time passes (i use 30sec).

Rather than poll anything, Indigo listens for the “on” and “off” commands, and it executes a separate trigger for each command.

The trigger runs python logic as follows:

Ex.: “on” received
1) check a global variable (isDaylight, etc), do nothing if it’s daytime
2) if it’s night time, check each bulb to see if it’s already on. If on, do nothing. If off, set the lights to a specified brightness (i use odd numbers, 99, 97, 21 for late at night, etc).

Ex.: “off” received
1) check if lights are at a setpoint as described above (99, 97, 21, etc.)
2) If so, turn them off

Let me know if you need my code. I’m using Z-Wave Multisensors and Hue bulbs


Sent from my iPhone using Tapatalk

Posted on
Sun Feb 25, 2018 7:51 am
Japple55 offline
Posts: 224
Joined: Sep 26, 2015
Location: NE Tennessee

Re: Motion triggered lights with manual override

Thanks, but my issue isn't with the motion, it's detecting a manual activation from the wall switch...Indigo doesn't detect that...so I have to poll the dimmer brightness to see if it is 99% (motion-activated) or 100% (switch-activated). Without forcing a polling of the brightness, I can't know which way it was turned on.

Posted on
Sun Feb 25, 2018 9:06 am
Colorado4Wheeler offline
User avatar
Posts: 2794
Joined: Jul 20, 2009
Location: Colorado

Re: Motion triggered lights with manual override

Japple55 wrote:
Thanks, but my issue isn't with the motion, it's detecting a manual activation from the wall switch...Indigo doesn't detect that

Sure it does. When Indigo turns on a light from Indigo it sends Insteon/Zwave/etc out, when you turn it on manually the switch sends the commands.

If you are doing this via a plugin it looks like this:

Code: Select all
   def zwaveCommandReceived(self, cmd):
      try:
         command = self.zwaveCommandAction (cmd)
         self.logger.threaddebug ("Plugin detected ZWave '{0}' action from device node {1}".format(command[1], command[0]))
               
      except Exception as e:
         self.logger.error (ext.getException(e))   
   
   # Indigo sent a ZWave command (Indigo)
   def zwaveCommandSent(self, cmd):
      try:
         command = self.zwaveCommandAction (cmd)
         self.logger.threaddebug ("Plugin detected ZWave '{0}' action sent from Indigo to device node {1}".format(command[1], command[0]))
         
      except Exception as e:
         self.logger.error (ext.getException(e))   


If you are doing it from the UI:
Screen Shot 2018-02-25 at 8.04.56 AM.png
Screen Shot 2018-02-25 at 8.04.56 AM.png (63.98 KiB) Viewed 4201 times

Screen Shot 2018-02-25 at 8.04.48 AM.png
Screen Shot 2018-02-25 at 8.04.48 AM.png (61.26 KiB) Viewed 4201 times


I have a number of things in my setup that are different for "pushed by hand" versus "tripped by another device like motion sensors".

Or am I not understanding fully what you are asking for?

My Modest Contributions to Indigo:

HomeKit Bridge | Device Extensions | Security Manager | LCD Creator | Room-O-Matic | Smart Dimmer | Scene Toggle | Powermiser | Homebridge Buddy

Check Them Out Here

Posted on
Mon Feb 26, 2018 7:48 am
haavarda offline
User avatar
Posts: 702
Joined: Aug 18, 2012
Location: Norway

Re: Motion triggered lights with manual override

Well. I have been able to find something that works for me. Takes some triggers but it works.
The basis for the logic is that a group trigger stores the triggering device to a variable. One group trigger for on, and one for off, with each own variable.
With the group trigger I also start a one minute timer. When the timer expires I compare the two different variables. If they are equal I assume I want to ignore this change. If they are different I assume this is a manual override...
This is just the basis for the manual override. Underneath is a more complex motion trigger setup.

Håvard

Posted on
Mon Feb 26, 2018 9:25 am
Japple55 offline
Posts: 224
Joined: Sep 26, 2015
Location: NE Tennessee

Re: Motion triggered lights with manual override

Thanks C4W!!! For some reason, I was not seeing any log entries when I would manually push the wall switch. After your post, I've been trying various things and I am able to detect a zwave command sent from the switch. It only seems to work with ON and OFF. Brightness Changed and Brightness Started and Status Reply do not work. Also, when I request a Full Status Request when the switch sends an ON, the status request loops continuously. I would have thought it would do it once, unless the wall switch is continuously transmitting ON. I think I'm also getting some intermittent reception which is causing problems with troubleshooting. Also, apparently Indigo does not have a device definition for my GE Dimmer (though I think it is fairly old) so that MAY have something to do with it, I don't know. Otherwise, it functions normally.

I just need to keep working at this, but thanks for pointing me in the direction of Zwave Command Received. I still have a lot to learn about Indigo!

Jim

Posted on
Wed Feb 28, 2018 8:58 pm
mundmc offline
User avatar
Posts: 1060
Joined: Sep 14, 2012

Re: Motion triggered lights with manual override

Darn it I almost was the helpful one for once! Sorry i wasn’t clear about that one as well. Colorado- good job, big fan of your work!


Sent from my iPhone using Tapatalk

Posted on
Wed Feb 28, 2018 9:06 pm
Colorado4Wheeler offline
User avatar
Posts: 2794
Joined: Jul 20, 2009
Location: Colorado

Re: Motion triggered lights with manual override

mundmc wrote:
Darn it I almost was the helpful one for once! Sorry i wasn’t clear about that one as well. Colorado- good job, big fan of your work!


Sent from my iPhone using Tapatalk


Hahaha, thanks.

My Modest Contributions to Indigo:

HomeKit Bridge | Device Extensions | Security Manager | LCD Creator | Room-O-Matic | Smart Dimmer | Scene Toggle | Powermiser | Homebridge Buddy

Check Them Out Here

Who is online

Users browsing this forum: No registered users and 1 guest