In addition to my last posting, I have created the following template to create a sensor that changes the temperature sensor depending on the time of the day, then have the generic_thermostat set it as the targeted sensor. The developer tools template is returning the named sensor, and I believe it should return a temperature of that sensor. Any ideas on how to fix this?
#How to return integer in template?
1 messages · Page 1 of 1 (latest)
template:
- sensor:
- name: upstairs temperature sensor
state: >
{% if ((states.sensor.time.state > '19:30') and (states.sensor.time.state < '00:00')) or ((states.sensor.time.state > '00:00') and (states.sensor.time.state < '06:30')) %}
sensor.master_air_temperature
{% else %}
sensor.kitchen_air_temperature
{% endif %}
@wanton escarp To format your text as code, enter three backticks on the first line, press Shift+Enter for a new line, paste your code, press Enter again for another new line, and lastly three more backticks.
```yaml
example: here
```
Don't forget you can edit your post rather than repeatedly posting the same thing.
You'll want the #templates-archived channel for help with templates though