New to this and I’m struggling with getting this automation to work properly. I basically want a smart plug to power up for a given number of minutes anytime the temperature is below a given threshold between the hours of 0600 and 1800.
The problem with this is once the value of sensor.foobar is below 99, the switch.plug_1 is on for 15 seconds but then it never comes back on again. My expectations are clearly off. I tried using a state sensor in the trigger but that led to it always being true.
Order, and choosing between trigger and condition can be really confusing. Yes, I will read the docs again.
What can I do to keep turning the switch on between 0600 and 1800 when the temp is under 99?
So this works but it’s entirely dependent upon the temp sensor changing. While I know that’s likely to happen, not all sensors are going to work this way. This seems bulky, error prone and definitely not more widely applicable. I’m hoping for good suggestions as to how to improve!
What you are experiencing is a common challenge. The solution is simple; add a Time Trigger and a Numeric State Condition.
If the temperature decreases below 99 before 06:00:00, the switch will not be turned on because it’s too early. However, now that the Numeric State Trigger has triggered, it won’t trigger again until the temperature first rises above 99 and then decreases below it. If this doesn’t happen between 06:00 and 18:00, the automation will not be triggered on that day.
To mitigate this, we add a Time Trigger for 06:00:01 and a Numeric State Condition that checks if the temperature is below 99.