From ecd13af47c9ba1c2ed612f9017016fa42d158e8a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-S=C3=A9bastien=20Leroy?= Date: Wed, 7 Jun 2023 22:51:40 +0200 Subject: [PATCH] fix last day power sensor class Fix the sensor class to remove HASS warning about inconsistent default unit. 2023-06-07 22:36:38.597 WARNING (MainThread) [homeassistant.components.sensor] Entity sensor.linky_puissance_maximale_triphasee_atteinte_jour_n_1 () is using native unit of measurement 'W' which is not a valid unit for the device class ('current') it is using; expected one of ['A', 'mA']; Please update your configuration if your entity is manually configured, otherwise report it to the custom integration author. --- custom_components/linkytic/sensor.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/custom_components/linkytic/sensor.py b/custom_components/linkytic/sensor.py index 800ec49..1c0a677 100644 --- a/custom_components/linkytic/sensor.py +++ b/custom_components/linkytic/sensor.py @@ -322,7 +322,7 @@ async def async_setup_entry( config_title=config_entry.title, config_uniq_id=config_entry.entry_id, serial_reader=serial_reader, - device_class=SensorDeviceClass.CURRENT, + device_class=SensorDeviceClass.POWER, native_unit_of_measurement=UnitOfPower.WATT, # documentation says unit is Watt but description talks about VoltAmp :/ ) )