It's useful to know whether a timed command is currently active.
Example:
rule "Motion Detected" do
received_command Motion_Sensor, command: ON
run do
# Do not activate timer if the light was already turned on manually
next if FrontPorchLight.on? && !FrontPorchLight.timed_command?
# The timer extends when more motion is detected
FrontPorchLight.ensure.on for: 30.minutes
end
end
Caveat: only works in the same file, but the whole timed command map lives in the file scope anyway.
It's useful to know whether a timed command is currently active.
Example:
Caveat: only works in the same file, but the whole timed command map lives in the file scope anyway.