I have a “utility_meter” setup from my configuration.yaml.
I want to be able to look back a few months at historical values.
The utility_meter has a monthly cycle… so although it’s constatly increasing, it’s mainly the value just before it cycles I’m looking for.
The sensor look like this in my configuration.yaml:
utility_meter:
house_solar_saving_montly:
source: sensor.house_solar_saving_last_hour
cycle: monthly
delta_values: true
offset: '00:00:20'
unique_id: "house_solar_saving_monthly"
name: House Solar Saving Monthly
#unit_of_measurement: SEK
Trying to look at last month, I have nothing in my history.
But, I also read that there is something called LTS (Long Term Statistics) and that I should be able to see this data for my sensor as it has a native “state_class: total_increasing”.
The data should become visible when adding it to a statistics card.
But when I do so… I still only see the sensor data that gets purged.
You’d have to wait for it to populate that data. The system does not create things in the past. When you add an entity to the system, your LTS and Regular history start the moment you add the entity.
You’ll need a unit of measurement for it to be numerical.
You may need device_class: monetary for it to work.
For your statement 2, do I solve this by removing the # in front of my “unit of measure” in the configuration.yaml file?
Seems I was playing around with this at the time I created this sensor, but I’ve not sure why I left it out by adding the #
1) I created the sensor ~a year ago, so this should not be the issue
2) I tried adding a unit if measurement to my utility_meter as we (although it already has a unit_of_measurement based on the source sensor it’s tracking (sensor.house_solar_saving_last_hour):
utility_meter:
house_solar_saving_montly:
source: sensor.house_solar_saving_last_hour
cycle: monthly
delta_values: true
offset: '00:00:20'
unique_id: "house_solar_saving_monthly"
name: House Solar Saving Monthly
unit_of_measurement: "SEK"
I have exactly the same problem. My utility meter sensors are not show in the long term statistic. Adding unit_of_measurement or device_class are leading to errors in the config as shown above.
I also cannot add an utility meter sensor to a “Statistics graph Card”.
Does anyone have a solution how to bring utility meter sensors to the long term statistic? @Piffis maybe?
To add to this. A good place to start is in Developer Tools and States. This will show you how the sensor/entity is defined in HA. If it does not have state_class it will not save to LTS.