Hi - Very new to HA so I’m hoping there is a simple answer to this!!
I setup a heating automation that should run between 4.30 & 9pm on Weekdays only once a temperature sensor is <19 degrees C.
Today (Friday), at 4.30pm the temperature sensor was reading 18.2 Dec C. The automation didn’t run and I have no idea why. Trace and YAML of the automation is below - Any help or feedback on what I have done wrong would be great, Thanks!!
if it’s been below 19 degrees all day since yesterday, then it won’t fire. or really if it hits 19 anytime before 16:00 it wont’ fire. (because you told it not to)
what do you want to do in that case? do you want it to not fire? or do you want it to fire at 16:00 anyways?
i suspect you would want something like this maybe?
note that i’ve changed the devices to use the friendly entity name… which you should always do when you can.
alias: "Heating: Weekday Evening On"
description: >-
Heating comes on between 4 & 9pm, Mon-Fri , providing temperature of Kitchen
is below 19 Degrees.
trigger:
- platform: time
at: "16:00:00"
- platform: numeric_state
entity_id:
- sensor.your_temp_sensor
below: 19
condition:
- condition: time
weekday:
- mon
- tue
- wed
- thu
- fri
after: "16:00:00"
before: "21:00:00"
- condition: numeric_state
entity_id: sensor.your_temp_sensor
below: 19
action:
If it’s been below 19 degrees all day since yesterday, then it won’t fire. or really if it hits 19 anytime before 16:00 it wont’ fire. (because you told it not to)- No, it was above 19 degrees yesterday evening when I manually turned on the heating. It dropped below 19 today when nobody was in the house so I presumed it would fire then at 16:00 as the temp was reading 18.2 which is below 19.
what do you want to do in that case? do you want it to not fire? or do you want it to fire at 16:00 anyways?- I want it to fire every weekday if the temperature at 16:00 is <19 Deg. However, if at 16:00, the temp is >19 Deg then I don’t want it to fire. If the temperature drops to <19 deg anywhere between 16:00 and 21:00 then I want it to fire again (I have another automation to turn the heating off when the temperature is >21.5 Deg between the same time range but it’s not working either - I’d like to fix this one first though!!)
Thanks for your assistance.
PS. Apologies as well, my heading is probably a little misleading - The automation isn’t runing at the wrong time, it’s not running at all. It seemed to check the automation at 3.16pm instead of 4.00pm so not sure why this is?
you should think about condition as “restriction” saying “do not fire unless”
which means that if it hits 18 at 15:59, then the restrction says “do not fire”
that’s all it says. it does not say “fire again later” it does not say "fire at 16:00. it just says “do not fire”
the trigger says “try to fire when it changes to be 19”. it doesn’t say fire whenever it is 19. only at that time when it drops below 19.
so if you think about that, at 15:59, it tried to fire. the restriction says “no”. then it’s done. nothing else triggers it to fire again.
if you look at my code, i set a trigger event to also fire at 16:00… that handles the case if the temp fell to 18 before 16:00. it create an new trigger at 16:00… but i then added the restriction that it has to still be below 19. in case it went below 19 before 16:00 then rose again…
Any reason why you’re not using the Generic Thermostat integration to control heating? It creates a climate entity that can also controlled via service calls and/or the UI via the Thermostat card.
You can then use an automation with simple Time Triggers to turn on/off the climate entity at whatever times you need or, better yet, using the Schedule integration.
Hi Armedad - That seems to work now - heating came on at a set time and when the temperature was below a certain value. Thanks.
One more question - Is there anything I can add to the YAML to make the automation check the temperature again say every 10 or 15 minutes and either leave the heating on if temp is < 21.5 Deg, turn it off if temp is >21.5 degrees and turn it back on again if temp has dropped below 19 Deg?
This should all occur between 16:00 and 21:00 on a Weekday only. Thanks for your help
That’s why it’s preferable to use Generic Thermostat. Set the target temperature you want and it automatically maintains it by turning the heater on/off as needed.
cool… if you decide you do want to keep your automation. i would create a separate “turn off” automation that triggers when the temp rises above 21.5. the existing automation you have will take care of if it falls back below 19 again.