From f67b7b18cd63a0ed061edc8a786078c3a3355335 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9goire=20Seux?= Date: Fri, 3 Mar 2023 09:38:46 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20Suggest=20precision=20for=20ener?= =?UTF-8?q?gy=20sensors?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This will fix #86 and #87 Option defined in [this post](https://developers.home-assistant.io/blog/2023/01/25/sensor_rounding/) has been reverted and replaced by a presentation option (instead of rounding the state). This will implement correctly #52 Change-Id: I122a0e855098e37d38f14cb02f07c3b24a201afc --- custom_components/aquarea/sensor.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/custom_components/aquarea/sensor.py b/custom_components/aquarea/sensor.py index 3254c0f..1f2e172 100644 --- a/custom_components/aquarea/sensor.py +++ b/custom_components/aquarea/sensor.py @@ -265,7 +265,7 @@ def message_received(message): state_class=SensorStateClass.MEASUREMENT, unit_of_measurement="kWh", native_unit_of_measurement="Wh", - native_precision=0, + suggested_display_precision=0, device=DeviceType.HEISHAMON, ) watt_hour_sensor = HeishaMonSensor( @@ -278,7 +278,7 @@ def message_received(message): device_class=SensorDeviceClass.ENERGY, unit_of_measurement="kWh", native_unit_of_measurement="Wh", - native_precision=0, + suggested_display_precision=0, state_class=SensorStateClass.TOTAL_INCREASING, device=DeviceType.HEISHAMON, )