From b0ba8053644bb253474a18746b7e5dc2f6cb6b12 Mon Sep 17 00:00:00 2001 From: Tor Inge Redalen Date: Sun, 26 Nov 2023 13:49:44 +0100 Subject: [PATCH] Temporary quick fix for signed int --- custom_components/heru/sensor.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/custom_components/heru/sensor.py b/custom_components/heru/sensor.py index f94e603..3ca84d8 100644 --- a/custom_components/heru/sensor.py +++ b/custom_components/heru/sensor.py @@ -53,6 +53,10 @@ def _get_value(self): """Get the value from the coordinator""" if self.idx["register_type"] == INPUT_REGISTERS: value = self.coordinator.input_registers[self.idx["address"]] + # Temporary quick fix for signed int... + if self.idx["device_class"] == SensorDeviceClass.TEMPERATURE and value > 3200: + value = value - 65535 + if self._attr_device_class == SensorDeviceClass.ENUM: return self._attr_options[value] return value * self.idx["scale"]