I have Aquarium light controlled by Sonoff (Tasmota) device. The light itself has 3 modes - 100% / 50% / night. To switch between different modes you need to toggle light off/on within 5 seconds and if light is off over 5 seconds it resets. I have done simple scheduled automation to switch on / off it. But problem becomes if someone interacts with light manually (not through schedule) at some point.
I am trying to improve automation by detecting in which mode light currently is, but i can’t figure out a way to do so… I am betting on a way of detecting pattern of switch state, as it is already recorded in HA… maybe someone has done something similar?
As your light controller does not report its state the only thing you can do is set it to a known state (off for 5 sec) then adjust from there.
Yes, this is something i have in mind, but i was thinking if something more sophisticated is possible. Somehow checking when last time light was off for 5+ seconds and then count changes in switch state since that moment?
From what you have said you cant count manual switch presses though. So you would still lose track of the state.
not manual switch presses, i ment manual switches through HA app and not automation schedule. ![]()
post your automation/scripts
See: How to use context