From 143a2e172ebb16bd320455352b196b3f2650ceca Mon Sep 17 00:00:00 2001 From: LKuemmel Date: Wed, 7 May 2025 09:18:47 +0200 Subject: [PATCH] undo qcells register changes --- .../modules/devices/qcells/qcells/counter.py | 23 +++++++++++++++---- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/packages/modules/devices/qcells/qcells/counter.py b/packages/modules/devices/qcells/qcells/counter.py index e05c996491..6e5d04eabc 100644 --- a/packages/modules/devices/qcells/qcells/counter.py +++ b/packages/modules/devices/qcells/qcells/counter.py @@ -41,19 +41,32 @@ def update(self) -> None: try: voltages = [self.client.read_input_registers( 0x006A, ModbusDataType.UINT_16, unit=self.__modbus_id - ) / 10, self.client.read_input_registers( - 0x006C, ModbusDataType.UINT_16, unit=self.__modbus_id ) / 10, self.client.read_input_registers( 0x006E, ModbusDataType.UINT_16, unit=self.__modbus_id + ) / 10, self.client.read_input_registers( + 0x0072, ModbusDataType.UINT_16, unit=self.__modbus_id ) / 10] + if voltages[0] < 1: + voltages[0] = 230 + if voltages[1] < 1: + voltages[1] = 230 + if voltages[2] < 1: + voltages[2] = 230 except Exception: - voltages = None + voltages = [230, 230, 230] + exported, imported = [value * 10 + for value in self.client.read_input_registers( + 0x0048, [ModbusDataType.UINT_32] * 2, + wordorder=Endian.Little, unit=self.__modbus_id + )] counter_state = CounterState( + imported=imported, + exported=exported, power=power, - frequency=frequency, powers=powers, - voltages=voltages + frequency=frequency, + voltages=voltages, ) self.store.set(counter_state)