Home Assistant - Rising/Falling Temperature Indicator
Another post in my series of ‘if I don’t document it, I will forget how to do this again in 2 years time!
I recently wanted a visual indicator as to whether the temperature in our home was rising and falling. This is possible with Home Assistant but the configuration is a bit cumbersome (like most of Home Assistant, honestly…)
To start with, take note of the names of the temperature sensors you want to create Rising/Falling entities for. In my case, I will be creating three for bedroom, living room, and study.
Take your three temperature sensors, and create a trend entity for each within your configuration.yaml file:
binary_sensor: - platform: trend sensors: trend_living_temp: entity_id: sensor.temperature_living_room_temperature trend_bedroom_temp: entity_id: sensor.temperature_bedroom trend_study_temp: entity_id: sensor.temperature_office_temperature
This will create an ‘on/off’ trend sensor which shows ‘on’ if the temperature is raising and off if the temperature is falling. You can set a minimum change on the trend sensor so minor fluctations are ignored, but the default configuration works for me.
Now we will use this to create a template sensor for each new trend sensor. This will let us customise the text so it says Rising or Falling and also allow us to set a custom entity icon. Once again, this goes in your configuration.yaml file.
template: - sensor: - name: "xStudyTrend" state: > Falling icon: > mdi:thermometer-chevron-down - name: "xLivingRoomTrend" state: > Falling icon: > mdi:thermometer-chevron-down - name: "xBedroomTrend" state: > Falling icon: > mdi:thermometer-chevron-down
If the trend sensor is ‘on’, then the template will return ‘Rising’ and set the icon to ‘mdi:thermometer-chevron-up’. In all other cases, it will return ‘Falling’ and set the icon to ‘mdi:thermometer-chevron-down’.
Make sure all your conditional statements refer to the correct sensor! You might pull your hair out for half an hour if you don’t…. :)