Sorry, but I really don’t understand how History works in Home Assistant.
I read that the default history retention in Home Assistant is 10 days.
If I want to keep data from sensors (power consumption, temperature, etc.) for a longer period, do I need to add state_class: measurement to the sensor?
Does that mean that for sensors that are automatically created by integrations, I would need to make a (template) copy of each sensor in configuration.yaml, reference the original sensor, and then add state_class: measurement there?
That doesn’t seem right to me.
When I look at the History ( history?entity_id=sensor.termometer_02_temperature ) panel now, I can see data going back to mid-December, which is when I started using the sensor. Can I use that existing data to create graphs?
Until now, I have been reading my P1 smart meter and solar panel data myself and storing it in a separate database. This allows me to create a table showing this year’s monthly consumption compared to last year’s monthly consumption, with the current month at the top.
I would now like to integrate this into Home Assistant.
Is it possible to view and use historical data from multiple previous years in graphs within Home Assistant?
I understand that I need to collect more than a year of data in Home Assistant before I can make year-to-year comparisons. I probably won’t import the old historical data (at least I don’t think I will).
I added the following card. It initially started empty, but after a month it now shows one month of data. How does that work exactly?
type: custom:mini-graph-card
entities:
- entity: sensor.termometer_02_temperature
name: Temperature
- entity: sensor.termometer_02_humidity
name: Humidity
show_graph: false
show_state: true
line_width: 3
smoothing: true
hour24: true
hours_to_show: 744
points_per_hour: 0.5
show:
legend: false
name: false
icon: false
state: true
extrema: true
labels: false
fill: true
color_thresholds:
- value: 0
color: "#6a00ff"
- value: 5
color: "#003cff"
- value: 10
color: "#00aaff"
- value: 15
color: "#00ffd5"
- value: 20
color: "#00ff55"
- value: 25
color: "#b6ff00"
- value: 30
color: "#ffcc00"
- value: 33
color: "#ff9900"
- value: 36
color: "#ff5500"
- value: 38
color: "#ff0000"
- value: 40
color: "#8b0000"
card_mod:
style: |
ha-card::before {
content: "Outside (m) ";
position: absolute;
top: 10px;
left: 50%;
transform: translateX(-50%);
font-size: 20px;
color: var(--primary-text-color);
}