I created “simple” automation to start/stop my Sonoff TH10 “power supply” based on temperature values receiving from temp sensor…
It all works as I expect, but… only for a single day, next day when I expect it start again at 8:00 if condition met (which is always met) nothing happen and I have to stop/start the automation itself, then it is immediately triggered properly…
I believe I miss something in my automation - can someone please help? Automation is done through automation UI not in the automation.yaml directly as I dont have enough knowledge yet …
You use a numeric state as a trigger. This will only trigger when the threshold has been crossed.
In your example the automation will trigger the first time when the value goes from above 22 to below 22, it will then only trigger again when the value goes above 22 and then below 22 again.
If the value stays below 22 it will not trigger.
Going out on a limb here but this trigger gets a lot of ‘grief’ over misunderstanding about how it works.
It does not fire just being below 22 degrees.
It fires on the transition from 22 degrees (or above) to below 22 degrees.
You would be better to check the time pattern trigger (say every 10 minutes)
Check conditions : -
Mon to Fri
Between 08:00 and 17:00
And if < 22 then turn on
The second automation makes no sense
If it’s just below 23 degrees (say 22.9) at 16:59 the heating won’t turn off and a minute later it can’t turn off because of your time limits.
Remove the second time limits and just to be sure turn the heating off at 17:00 anyway
thanks a lot, I got your point and this is exactly why I will never learn “programming” as…my head does not gets this logic
can you suggest how to improve it so it will will continuously check the threshold and if its within 8 - 17 every day it will trigger if the value is below and not only on the transition/cross?
thank you very much as well…
second condition is to turn off once its above 23, then leave the room temperature to drop below 22 and trigger again the first automation - and it works in this way but… when it stays below 22 after 17h then another day it wont start again because of what @Burningstone just explained to me probably
in fact what is my goal is to keep room temperature between 22 - 23 degrees during a day and after 17h another automation (not listed here) takes over and do the same but with values between 19-21 degrees
Note : if the temperature is EVER above 23 (when checked every 10 minutes) this will turn the switch ‘off’ (ie this will happen at weekends and outside your times for heat too, but turning a switch off that is already off is okay.
Note: the /10 minutes checks the value of the current minute (of the current hour) and if the minute ‘x’ when divided by 10 has no remainder (ie 0, 10, 20, 30, 40, 50) it will trigger.
Note that if at if at 17:00 the temperature is at 22.9 degrees, the heating will stay on. if it remains at 22.9 degrees for the next 12 months then the heating will stay on. be careful what you ask for as these things can have some peculiar side effects.
What I’d probably do in this situation is use the generic thermostat and I’d change the set point via a sensor so that it is at 22° between the times you want and at all other times would sit at say 6° (for frost protection) But this is a bit beyond the scope of this question.
@Burningstone@Mutt thanks a lot guys, finally I realized that I misunderstood trigger, now its clear to me and I will follow your advice with trigger timer and temp value under condition and not in trigger …
I will also try to implement “template” way of code, which I like a lot