JaccoR / hass-entso-e

Integration for Home Assistant to fetch day ahead energy prices from European countries via ENTSO-e Transparency Platform
159 stars 25 forks source link

Warning about state_class for a number of monetary and timestamp sensors #159

Open BrainDra1n opened 3 weeks ago

BrainDra1n commented 3 weeks ago

When starting the integration a number of warnings is generated in the home-assistant.log:

2024-06-11 09:02:54.431 WARNING (MainThread) [homeassistant.components.sensor] Entity sensor.ep_current_electricity_market_price (<class 'custom_components.entsoe.sensor.EntsoeSensor'>) 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 create a bug report at https://github.com/JaccoR/hass-entso-e/issues
2024-06-11 09:02:54.433 WARNING (MainThread) [homeassistant.components.sensor] Entity sensor.ep_next_hour_electricity_market_price (<class 'custom_components.entsoe.sensor.EntsoeSensor'>) 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 create a bug report at https://github.com/JaccoR/hass-entso-e/issues
2024-06-11 09:02:54.435 WARNING (MainThread) [homeassistant.components.sensor] Entity sensor.ep_lowest_energy_price_today (<class 'custom_components.entsoe.sensor.EntsoeSensor'>) 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 create a bug report at https://github.com/JaccoR/hass-entso-e/issues
2024-06-11 09:02:54.437 WARNING (MainThread) [homeassistant.components.sensor] Entity sensor.ep_highest_energy_price_today (<class 'custom_components.entsoe.sensor.EntsoeSensor'>) 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 create a bug report at https://github.com/JaccoR/hass-entso-e/issues
2024-06-11 09:02:54.447 WARNING (MainThread) [homeassistant.components.sensor] Entity sensor.ep_average_electricity_price_today (<class 'custom_components.entsoe.sensor.EntsoeSensor'>) 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 create a bug report at https://github.com/JaccoR/hass-entso-e/issues
2024-06-11 09:02:54.452 WARNING (MainThread) [homeassistant.components.sensor] Entity sensor.ep_current_percentage_of_highest_electricity_price_today (<class 'custom_components.entsoe.sensor.EntsoeSensor'>) 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 create a bug report at https://github.com/JaccoR/hass-entso-e/issues
2024-06-11 09:02:54.456 WARNING (MainThread) [homeassistant.components.sensor] Entity sensor.ep_time_of_highest_price_today (<class 'custom_components.entsoe.sensor.EntsoeSensor'>) is using state class 'measurement' which is impossible considering device class ('timestamp') it is using; expected None; Please update your configuration if your entity is manually configured, otherwise create a bug report at https://github.com/JaccoR/hass-entso-e/issues
2024-06-11 09:02:54.460 WARNING (MainThread) [homeassistant.components.sensor] Entity sensor.ep_time_of_lowest_price_today (<class 'custom_components.entsoe.sensor.EntsoeSensor'>) is using state class 'measurement' which is impossible considering device class ('timestamp') it is using; expected None; Please update your configuration if your entity is manually configured, otherwise create a bug report at https://github.com/JaccoR/hass-entso-e/issues

The reason behind this is that HA does not accept a sensor with device_class monetary or timestamp to have a state_class measurement. Whether this is logical or not has been discussed and a decision made, see: Add state_class - measurement to device_class - monetary #1024.

My advice is to change the state_class of the following sensors to 'total':