Hi, why do some custom sensors show only one value while others show min, med and max?
If there are long term statistics (LTS) for a sensor (i.e. it has a state_class of measurement) the graph will display 5 minute aggregate statistics (max, min, average) instead of the state (single value). This was done in order to speed up displaying of graphs that have many data points. In practice (for me on fast hardware and network and sensible sensor update periods) it has done little except make the graphs have lower resolution and I am considering removing the state_class from my sensors.
But in the screenshot shown above my sensor, Wemos D1 Home Power, doesn’t have a state_class:
power:
name: Home Power
unit_of_measurement: W
accuracy_decimals: 1
#filters:
# - multiply: 0.001
icon: mdi:flash-circle
id: home_power
While, the sensor of the first screenshot has this code:
slave: 1
address: 0x04AF
input_type: holding
data_type: uint16
unit_of_measurement: W
device_class: power
scale: 10
precision: 0
scan_interval: 2
lazy_error_count: 3
unique_id: "consumo istantaneo"
Sorry but I do not understand
Check the attributes of the sensors in Developer Tools → States (right hand column).
Ok, thank you. In Developer Tools, States I see that one sensor has state_class and the other does not.
How can I add or remove State_Class from any sensor? Sorry but I’m newbie.
Try this (in configuration.yaml):
homeassistant:
customize:
sensor.home_power:
state_class: none
what if I want to add state_class instead?
This not work, error in yaml
Instead of “none” put “measurement”
Are you going to share the error?
bad indentation of a mapping entry (7:18)
4 | homeassistant:
5 | customize:
6 | sensor.home_power
7 | state_class: none
----------------------^
Error loading /config/configuration.yaml: mapping values are not allowed here
in “/config/configuration.yaml”, line 7, column 18
Edit: excuse me, I forgot to add :
Ok, it seems this code in configuration.yaml doesn’t work. I keep seeing the graph with aggregate statistics