I’ve been running Home Assistant in Docker on a Raspberry Pi for sometime now. The Raspberry Pi was initially setup for running Pi-Hole, and I didn’t want to wipe that out when I decided to start playing around with Home Assistant. This had the downside of making it more difficult to install add-ons to HA; so I had started planning out a change to my setup. Unfortunately, we had a recent storm that killed power to my house and after power was restored my Raspberry Pi failed to boot. I’ve not had any luck bringing it back online, though admittedly I have been spending more time figuring out alternate arrangements for running various services at home. I also decided that I should spend more time documenting the various configurations and tweaks I’m making to my setup. That way when I next have a problem knocking out my setup; I’ll lose less time restoring it.
Along with getting things set back up, I’m also working on improving how various information gets displayed. In the upstairs of our house, I have a sensor that reports the temperature to Home Assistant. That temperature data is nicely integrated as a sensor; so HA will track it over time. While playing around with various settings, I decided it would be cool if I could get that information for the downstairs of our house. Since our thermostat is downstairs, this seemed like it would be an easy win. It took more than just a little googling to work everything out; as our thermostat does not send over the temperature data in the same way. Instead, it sends the current temperature over as an attribute. Attributes aren’t tracked over time and are more difficult to work with. But with classic McKibben stubbornness, I kept at it and finally figured out a working solution.
-
- I went into Developer Tools > States.
- Searched for the entity created by the thermostat’s HA integration. In my case, this was called
climate.thermostat
. - Looking over the attributes on
climate.thermostat
, I sawcurrent_temperature
attribute. - A bunch of googling later, I found I could extract that attribute using this code:
value_template: "{{ state_attr('climate.thermostat', 'current_temperature') }}"
. I was able to confirm that this worked in Developer Tools > Template, but at this point I hadn’t found any instructions on where to add this code in a non-testing fashion. - A ridiculous amount of googling later, I found out the trick is to add a sensor1There can be only one! Which is to say HA only allows for one sensor section; if you have multiple sensors to add, then they all go under the same sensor section. The complete code I’m using to add this sensor to my HA setup is:
sensor: # Temperature from Living Room Thermostat - platform: template sensors: living_room_temp: friendly_name: "Living Room Temperature" unit_of_measurement: '°F' value_template: "{{ state_attr('climate.thermostat', 'current_temperature') }}"
- Once I had the temperature being properly captured from the thermostat; it was pretty simple to get the sort of display I wanted to see. I made use of the mini-graph-card available via HACS to make my Home Assistant Temperature Display card.
type: horizontal-stack cards: - type: custom:mini-graph-card entities: - sensor.hue_motion_sensor_temperature name: Upstairs hours_to_show: 48 points_per_hour: 0.25 color_thresholds: color_thresholds: - value: 70 color: '#3381FF' - value: 80 color: '#ffb133' - value: 90 color: '#FF4B33' - type: custom:mini-graph-card entities: - sensor.living_room_temp name: Living Room hours_to_show: 48 points_per_hour: 0.25 color_thresholds: - value: 70 color: '#3381FF' - value: 80 color: '#ffb133' - value: 90 color: '#FF4B33'
Now with both the senor and the card added, I finally have my ideal display for the temperature on both floors of our house. The graph displays the last 48 hours with different temps displaying in different colors (cooler ones shifting towards blue, warmer ones shifting towards red).
Heh, I should have known you are a Home Assistant person also. I have spent more than a few hours hacking my own setup with all the sensors and cameras and smart appliances there. It has been very fulfilling, if more than a little frustrating at times.
I understand a applaud you here!
To my mind, the greatest part of Home Assistant is being able to control all my… toys via one app rather than the 9 different apps each with their own ridiculous UI (that’s mostly focused on trying to sell me more of their stuff)