I currently have an automation that’s triggered when a smart plug’s power moves above 0. I’m using the following template trigger to make this happen.
{{states('sensor.plug1_power') | float(0) > 0}}
What I’m now trying to do is add an additional clause to the automation so that is triggers when the smart plug’s power moves above 0, but only if the power value of the plug has been 0 for the previous 10 minutes.
Does anybody have any thoughts on how I might achieve this?
Hi there. I would think you could set up a helper binary sensor that will flag when the power is 0 for 10 minutes. Then have an automation that triggers when the power goes from something to 0, for 10 minutes (set in the trigger option). The action would be to set the helper flag to true.
A second automation would trigger when the power goes from 0 to something, AND when the helper flag is true. Remember to set the helper flag to false after this event is triggered.
There might be easier ways with helper templates, but I think this would do the trick.
automation:
trigger:
- platform: template
value_template: "{% if is_state('device_tracker.paulus', 'home') %}true{% endif %}"
# If given, will trigger when template remains true for X time.
for: "00:01:00"