From b058bc10bed4e3c147516a66b404cf8915905d7d Mon Sep 17 00:00:00 2001 From: Christian Ehrlicher Date: Wed, 14 Dec 2022 19:32:09 +0100 Subject: [PATCH 1/2] RPI: Fix reading negative temperature - must be treated as signed short, not unsigned short --- tools/rpi/hoymiles/decoders/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/rpi/hoymiles/decoders/__init__.py b/tools/rpi/hoymiles/decoders/__init__.py index af7a3bd0..586a5b51 100644 --- a/tools/rpi/hoymiles/decoders/__init__.py +++ b/tools/rpi/hoymiles/decoders/__init__.py @@ -440,7 +440,7 @@ class Hm300Decode0B(StatusResponse): @property def temperature(self): """ Inverter temperature in °C """ - return self.unpack('>H', 26)[0]/10 + return self.unpack('>h', 26)[0]/10 class Hm300Decode0C(Hm300Decode0B): """ 1121-series mirco-inverters status data """ From 06af61742a670f832bad9b4599aebaab713446d5 Mon Sep 17 00:00:00 2001 From: Christian Ehrlicher Date: Sun, 18 Dec 2022 11:57:35 +0100 Subject: [PATCH 2/2] RPI: Fix reading negative temperature - now also for Hoymiles600/1200 inverters --- tools/rpi/hoymiles/decoders/__init__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/rpi/hoymiles/decoders/__init__.py b/tools/rpi/hoymiles/decoders/__init__.py index 586a5b51..0935110e 100644 --- a/tools/rpi/hoymiles/decoders/__init__.py +++ b/tools/rpi/hoymiles/decoders/__init__.py @@ -527,7 +527,7 @@ class Hm600Decode0B(StatusResponse): @property def temperature(self): """ Inverter temperature in °C """ - return self.unpack('>H', 38)[0]/10 + return self.unpack('>h', 38)[0]/10 @property def event_count(self): """ Event counter """ @@ -660,7 +660,7 @@ class Hm1200Decode0B(StatusResponse): @property def temperature(self): """ Inverter temperature in °C """ - return self.unpack('>H', 58)[0]/10 + return self.unpack('>h', 58)[0]/10 @property def event_count(self): """ Event counter """