ESPHome Temperature LongTerm Statistics

Hello together,

if I would like to use HA new longterm statistics with sensors from esphome, e. g. room temperature and so on do I have to add state_class and so in my esphome yaml files for each sensor which I define there?

You shouldn’t have to do anything to be able to use it with long term stats.

Have a look at the sensor attributes in Developer Tools / States. Does it have these attributes?

state_class: measurement
unit_of_measurement: °C # or F
friendly_name: Something
icon: mdi:thermometer
device_class: temperature

yes

state_class: measurement
unit_of_measurement: °C
friendly_name: 1OG_MobiUM2 Temp
device_class: temperature

Then there is nothing for you to do. It will just work. Try the statistics graph.

THX works for some of my esp sensors:

in some cases I only get

unit_of_measurement: °C
friendly_name: 1OG Balkon Temp
device_class: temperature

without state_class and I cannot add them in the statistic

some other of the sensors connected to the same device show:

unit_of_measurement: µg/m³
friendly_name: 1OG Balkon Partikel <10.0µm µg/m³
icon: mdi:chemical-weapon

and work fine with the statistic.

What can I do?

Best regards,
Stefan

When was the last time you updated those ESP boards?

1 Like

THX,

I updated all devices to last Version.
Now everything is fine.

Best regards,
Stefan