Hi all,
This one has me a bit stumped.
I upgraded my home assistant to 2022.8.6 from 0.116.4.
The following automation was working fine on the old version:
- id: mobile1heateron
alias: mobile1 heater on when below min input
trigger:
- platform: template
value_template: “{{ states(‘sensor.mobile_temperature1’)|float < ( states(‘input_number.mobile_temp1_min’)|float - 0.4 ) }}”- platform: template
value_template: “{{ states(‘sensor.mobile_temperature1’)|float < states(‘input_number.mobile_temp1_min’)|float }}”
condition:
action:- data:
entity_id: switch.mobileheatersw1
service: switch.turn_on
After creating a fresh os install, installing new version of HA 2022.8.6 and restoring my backup across, it was found that i needed to update “float” to “float(0)” to allow for this to be rendered properly. This was the only change so far.
- id: mobile1heateron
alias: mobile1 heater on when below min input
trigger:
- platform: template
value_template: “{{ states(‘sensor.mobile_temperature1’)|float(0) < ( states(‘input_number.mobile_temp1_min’)|float(0) - 0.4 ) }}”- platform: template
value_template: “{{ states(‘sensor.mobile_temperature1’)|float(0) < states(‘input_number.mobile_temp1_min’)|float(0) }}”
condition:
action:- data:
entity_id: switch.mobileheatersw1
service: switch.turn_on
I have since found that the automation does not fire when turning the automation “on” & the triggers are already “true”.
The triggers shown are intialized in the logs, the triggers themselves would be starting off as “True” where the actual room temp is below input.
I’ve found that if the trigger goes from ‘True’ to ‘False’ & back to ‘True’ again, it will fire for the first time.
This was not an issue on the old version, and worked straight from the start - If the trigger=true it would run immediately.
I’ve also noticed odd behaviour in the “dev tool” > “template” for math operations. If I enter in:
“{{ states(‘sensor.mobile_temperature1’)|float(0) < ( states(‘input_number.mobile_temp1_min’)|float(0) - 0.4 ) }}”
“{{ states(‘sensor.mobile_temperature1’)|float(0) < states(‘input_number.mobile_temp1_min’)|float(0) }}”
“{{ states(‘sensor.mobile_temperature1’)|float(0) > states(‘input_number.mobile_temp1_min’)|float(0) }}”
“{{ states(‘sensor.mobile_temperature1’)|float(0) }}”“{{ ( states(‘input_number.mobile_temp1_min’)|float(0) ) }}”
“{{ ( states(‘input_number.mobile_temp1_min’)|float(0) - 0.4 ) }}”
I will get the following output:
“True”
“True”
“False”
“15.0”“19.3”
“18.900000000000002”
The expected value for the last line wouldve been ‘18.9’. I dont think this would be related since my triggers are based on greater/less than, but I felt should be pointed out anyways as a potential bug?