How to write a template to combine sensor tempurature and humidity sensor to be on or off?
For example, if temp < 30 and humi > 80, set on.
if other than this value is off
How to write a template to create a new sensor value?
- platform: template
sensors:
newsensor:
friendly_name: "newsensor"
value_template: >
{{ ((states.sensor.temp | float(0) > 30) and (states.sensor.hum | float(0) > 80 )) }}
1 Like
It is a binary_sensor, you have to put it with your other binary sensors
Yes, write to binary sensor
Please copy and paste your configuration, not a graphic of it (especially a partial graphic which does not show anything useful).
- platform: template
sensors:
newsensor:
friendly_name: "newsensor"
value_template: >
{{ (states.sensor.temp_keuken_temperature | float(0) > 30 and states.sensor.sensor.temp_keuken_humidity | float(0) > 80) }}
Use this format to prevent errors:
value_template: >
{{ ( states('sensor.temp_keuken_temperature') | float(0) > 30 ) and ( states('sensor.sensor.temp_keuken_humidity') | float(0) > 80 ) }}
https://www.home-assistant.io/docs/configuration/templating/#states