Hello and be gentle, this is my first post and it’s taken weeks of learning and late nights (lots of arguments with her in doors) to get here
I have read the Automations page in the docs and I am still stuck. This automation is not firing at all, there is no Trace in ‘Traces’ in the GUI for the automation and I cannot see anything in homeassistant.log relating to this , be it info, warning or error. When I “run actions”, nothing happens.
The automation is intended to switch on / off a climate device that has HVAC modes ‘off’ and ‘heat’ and a single sensor entity for an offset. The HVAC modes and entity are valid as they are used elsewhere and in the dashboards.
As i say, no action is ever executed and traces show nothing triggered.
System date and time is correct !
Here is the code:
alias: Heating - Night
description: >-
Control Heat Pump, maintain GF max 19c at night allowing floor value of 18.5. Works around the Madoka 2c
hysteresis, sun hitting it etc by using switchbot thermostats.
triggers:
- alias: First-run
at: "22:05:00"
id: First-run
enabled: true
trigger: time
- alias: Above-temp
entity_id:
- sensor.meter_plus_da53_lounge
for:
hours: 0
minutes: 5
seconds: 0
above: 19.0
id: Above-temp
enabled: true
trigger: numeric_state
- alias: Below-temp
entity_id:
- sensor.meter_plus_da53_lounge
for:
hours: 0
minutes: 5
seconds: 0
id: Below-temp
below: 18.5
enabled: true
trigger: numeric_state
conditions: []
actions:
- alias: Heating ON
continue_on_error: true
if:
- condition: trigger
id:
- Below-temp
then:
- alias: Turn on heating with repeat
repeat:
sequence:
- alias: Turn on Heating
action: climate.set_hvac_mode
continue_on_error: true
target:
entity_id: climate.heating_leaving_water_offset
data:
hvac_mode: heat
- delay:
hours: 0
minutes: 10
seconds: 0
milliseconds: 0
until:
- condition: state
entity_id: climate.heating_leaving_water_offset
state: heat
for:
hours: 0
minutes: 0
seconds: 0
- alias: Heating OFF
continue_on_error: true
if:
- condition: trigger
id:
- Above-temp
- First-run
then:
- alias: Turn off heating with repeat
repeat:
sequence:
- alias: Turn off Heating
action: climate.set_hvac_mode
continue_on_error: true
data:
hvac_mode: "off"
target:
entity_id: climate.heating_leaving_water_offset
- delay:
hours: 0
minutes: 10
seconds: 0
milliseconds: 0
until:
- condition: state
entity_id: climate.heating_leaving_water_offset
state: "off"
for:
hours: 0
minutes: 0
seconds: 0
mode: single
What is supposed to happen is that:
- At 22:05 each night, the automation turns off the heating.
- If sensor meter_plus_da53_lounge reports a value > 19.0 for more than 5 mins then the heating is turned off (this sensor is working and used in the dashboard). This sensor is updated every 10 minutes via the Onecta integration.
- If the same sensor reports a value > 18.5 for more than 5 mins then the heating is turned on.
I turn the automation on/off in the dashboard each night around 9pm/6am - I will eventually automate this but one thing at a time.
To me this is complex and my head hurts so if you are clever and can spot the problem, please explain. I could probably help myself a lot more by working through this step by step using features in HA to debug this but I need help please
EDIT:
Having read more, I think I may know root-cause.
Could it be that the sensor values need to transition over the ‘above’ and ‘below’ values in order for the triggers to activate.
For example. the Above-temp
trigger requires that the sensor value is read at a value lower than 19 then transitions to a value higher than 19. If so then consider the case where the sensor value is currently 21C say - at the end of the day - then that value would need to drop below 19 then above 19 for the Above-temp` to trigger, which it will not because the temp is going to slowly decrease from 21 down to about 17 without ever fluctuating to a higher value. So
Above-temp`` is never triggered.
Similarly, the Below-temp
trigger requires that the sensor is read at a value higher than 18.5 then transitions to a lower than 18.5 value. I think this would/should work as the sensor is going to descend down from 21 to 17 and at the 18.5 threshold, turn on the heating?
Could this be the reason? If so how might I improve this automation such that - at any given sensor value at any time this automation becomes enabled - the heating is turned off whenever the sensor reads any value above 19 for 5mins, and, turns on whenever it reads any value lower than 18.5 for 5mins.
The 5mins makes sure that any oscillation around 19 and 18.5 is ignored and we require a static value for 5 mins.