rnovacek / homeassistant_cz_energy_spot_prices

Home Assistant integration that provides current Czech electricity spot prices based on OTE.
Apache License 2.0
75 stars 17 forks source link

Integration do not support Statistic graph #12

Open dalib666 opened 1 year ago

dalib666 commented 1 year ago

If I want to put entity "sensor.current_spot_electricity_price" into graph on dashboard by use "Statistic Graph" panel, it is not possible to find itself enitity in the list. I searched, that it is done by itself integration, please see here https://www.home-assistant.io/more-info/statistics/. Do you plan to solve this in some way ?

rnovacek commented 1 year ago

It seems that using state_class measurement with monetary device_class is currently unsupported in HA: https://github.com/home-assistant/core/pull/87274

I tried setting _attr_state_class = SensorStateClass.MEASUREMENT on the SpotRateElectricitySensor and HA complains about it:

2023-04-02 21:21:37.772 WARNING (MainThread) [homeassistant.components.sensor] Entity sensor.current_spot_electricity_price (<class 'custom_components.cz_energy_spot_prices.sensor.SpotRateElectricitySensor'>) is using state class 'measurement' which is impossible considering device class ('monetary') it is using; expected None or one of 'total'; Please update your configuration if your entity is manually configured, otherwise report it to the custom integration author.

It wants to have total which is incorrect for this as that sensor is price per unit in the given hour, not a total.

Any ideas?