1) Give a description of the problem
The bathroom light dimmers should be set to a bright default level during the day and dim level at night (100% and 1%, respectively). However, it would be rude to dim the light if it happens to be in use. Youngsters make our schedule inconsistent enough for this to not be a matter of simply choosing a better cutoff time.
I am using GE dimmer switches which just reuse the previous level. Setting the level turns the lights on so I have to immediately turn them back off.
2) What is the expected behavior?
If the light is off, adjust default level immediately, otherwise wait until the light has been off for a short period of time (because there can be a brief flash of light when the level is set), then adjust the default level.
3) What is happening/not happening?
It seems like the Followed By
operator should work for this but I couldn’t find any combination of triggers or conditions that paused until the light turned off. Seemed like I should be able to do something like if switch is off or (switch is on followed within 20 minutes by switch stays off for 30 seconds)
but anything using followed by
evaluated immediately. I would like something that works inside the async for each
so that I can easily add more lights to this.
For now I use a while
loop that calls Wait
until the light has been off for 30 seconds. This works fine but feels like a hack.
4) Post a Green Snapshot of the piston
It works, but I think there should be a better way to do this:
5) Attach any logs (From ST IDE and by turning logging level to Full)
Tried so many things I’m not sure which logs would be applicable. In cases where followed by
did not work, the entire condition just evaluated to false immediately.