Disable off timer for piston controlling lights when physical switch used


#1
  1. Give a description of the problem
    I have a piston which lights the garage at night when we either open the garage door, or open the door to the house, heading to the garage. This is working well, but last night I came to do some work on my car in the garage, and even though I turned the light on with the physical switch after the pistons timer first turned it off, the light kept turning off after 5 mins which baffled me. I’d like to learn how I can override automated behaviour with a exception in my pistons for when a physical switch is activated, as that would help with this piston, and some other automation I plan to add shortly once my motion sensors are tied in.

  2. What is the expected behavior?
    Timer does not run and execute turn off action if device being automated has been physically switched on

  3. What is happening/not happening?
    Light still turns off after timer expires.

  4. Post a Green Snapshot of the piston

  5. Attach any logs (From ST IDE and by turning logging level to Full)


#2

Make a variable (boolean type) called automation or something. Set it to true in the step before you turn the light on.

Put your off action in another IF condition that says "if automation is true’.

Or to make it even easier and not fuss with the wait, I’d do this:

IF
contact opens and time is blah blah blah

THEN
set variable automation = true
Turn on

IF
light has been on for 5 minutes
AND automation is true
turn off
Set automation = false


#3

Thanks michicago, I’ll give this a whirl!


#4

Hi michicago, I refactored my code a bit and came up with whats shown below. Your comment on the testing for “the light being on for more than x mins” rather than using a wait baffled me a little, but I dug around and found reference to testing against the age property of the switch. Is this what you were suggesting?


#5

Why do you have the off function nested under the on function? Of course the switch won’t have been on for any length of time…it just turned on. You have to pull that out to a separate function.

But I would also use the new function of If Automating and Dimmer 3 was on for X minutes then… Much easier than trying to use the age function with an expression.


#6

Hi Ryan,
Thanks for your message. I have moved the off code into a separate if block as shown below. How would you test for “if Dimmer 3 was on for X mins” without using the age function. This is similar to the comment michicago and I couldnt see a way to get how long a device has been on, other than using age…


#7

You can do it with the “stays” trigger:


#8

awesome thanks guys, I could not find this! I have updated again removing the wait:


#9

Beat me to it. Works much better than age.