Hello all,
I have an issue with an integration where I need to compare two temperatures (one read from a DS18B20 sensor and the other one set by the user via input_number. When sensor temperature is below the value from input_number, needs to start the thermostat_controller.
The code is presented below, my issue is that it never turns on the thermostat_controller. Please help with some advice.
Thank you in advance.
alias: Thermostat on
description: >-
Automation that turns on the heating if the outside temperature drops below
15C
trigger:
- platform: state
entity_id:
- sensor.outside_temperature
- input_number.temperature
condition:
- condition: template
value_template: >-
{{states('input_number.temperature')|float >
states('sensor.outside_temperature')|float}}
action:
- device_id: fbda5f63af4123b8a48a3bad1f080494
domain: climate
entity_id: climate.thermostat_climate_controller
type: set_hvac_mode
hvac_mode: heat
- delay:
hours: 0
minutes: 0
seconds: 1
milliseconds: 0
- type: turn_on
device_id: fbda5f63af4123b8a48a3bad1f080494
entity_id: switch.heating_relay
domain: switch
mode: single
Have you tried putting your template code into the Developer tools > Templates to see what each part of your expression returns? Put it into the Templates tool like this to see what each part returns.
The trace shows that the automation executed its State Trigger (the value of outside temperature changed) but determined that the new value wasn’t less than the value of the input_number. What were the values of the outside temperature and the Input number? That information is also recorded in the trace.
BTW you should provide the float filter with a default value.