From ebb9d00f984d15e4e46c026c55a9e25e039a1863 Mon Sep 17 00:00:00 2001 From: Victor Ortiz Heredia Date: Mon, 11 Sep 2023 21:58:37 +0200 Subject: [PATCH] Update pymodbus version to fix hass version 2023.9.1 --- custom_components/ingeteam_modbus/__init__.py | 14 +++++++------- custom_components/ingeteam_modbus/manifest.json | 2 +- hacs.json | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/custom_components/ingeteam_modbus/__init__.py b/custom_components/ingeteam_modbus/__init__.py index 25d914e..5df8980 100644 --- a/custom_components/ingeteam_modbus/__init__.py +++ b/custom_components/ingeteam_modbus/__init__.py @@ -6,7 +6,7 @@ from typing import Optional import voluptuous as vol -from pymodbus.client.sync import ModbusTcpClient +from pymodbus.client import ModbusTcpClient from pymodbus.constants import Endian from pymodbus.payload import BinaryPayloadDecoder @@ -216,7 +216,7 @@ def read_modbus_data(self): ) def read_modbus_data_status(self, registers): - decoder = BinaryPayloadDecoder.fromRegisters(registers, byteorder=Endian.Big) + decoder = BinaryPayloadDecoder.fromRegisters(registers, byteorder=Endian.BIG) stop_code = decoder.decode_16bit_uint() alarm_code = decoder.decode_32bit_uint() @@ -243,7 +243,7 @@ def read_modbus_data_status(self, registers): def read_modbus_data_inverter(self, registers): - decoder = BinaryPayloadDecoder.fromRegisters(registers, byteorder=Endian.Big) + decoder = BinaryPayloadDecoder.fromRegisters(registers, byteorder=Endian.BIG) active_power = decoder.decode_16bit_int() reactive_power = decoder.decode_16bit_int() @@ -309,7 +309,7 @@ def read_modbus_data_inverter(self, registers): return True def read_modbus_data_meter(self, registers): - decoder = BinaryPayloadDecoder.fromRegisters(registers, byteorder=Endian.Big) + decoder = BinaryPayloadDecoder.fromRegisters(registers, byteorder=Endian.BIG) em_voltage = decoder.decode_16bit_uint() em_freq = decoder.decode_16bit_uint() @@ -330,8 +330,8 @@ def read_modbus_data_meter(self, registers): return True def read_modbus_data_pv_field(self, registers, external_pv_data): - decoder = BinaryPayloadDecoder.fromRegisters(registers, byteorder=Endian.Big) - external_pv_decoder = BinaryPayloadDecoder.fromRegisters(external_pv_data, byteorder=Endian.Big) + decoder = BinaryPayloadDecoder.fromRegisters(registers, byteorder=Endian.BIG) + external_pv_decoder = BinaryPayloadDecoder.fromRegisters(external_pv_data, byteorder=Endian.BIG) pv1_voltage = decoder.decode_16bit_uint() pv1_current = decoder.decode_16bit_uint() @@ -360,7 +360,7 @@ def read_modbus_data_pv_field(self, registers, external_pv_data): def read_modbus_data_battery(self, registers): decoder = BinaryPayloadDecoder.fromRegisters( - registers, byteorder=Endian.Big, wordorder=Endian.Little + registers, byteorder=Endian.BIG, wordorder=Endian.LITTLE ) battery_voltage = decoder.decode_16bit_uint() diff --git a/custom_components/ingeteam_modbus/manifest.json b/custom_components/ingeteam_modbus/manifest.json index a573f93..1108c28 100644 --- a/custom_components/ingeteam_modbus/manifest.json +++ b/custom_components/ingeteam_modbus/manifest.json @@ -2,7 +2,7 @@ "domain": "ingeteam_modbus", "name": "Ingeteam Modbus", "documentation": "https://github.com/vortizhe/home-assistant-ingeteam-modbus", - "requirements": ["pymodbus==2.5.3"], + "requirements": ["pymodbus==3.5.1"], "codeowners": ["@vortizhe"], "config_flow": true, "version": "0.1.3" diff --git a/hacs.json b/hacs.json index f924067..0a7dcaf 100644 --- a/hacs.json +++ b/hacs.json @@ -2,6 +2,6 @@ "name": "Ingeteam Modbus", "content_in_root": false, "domains": ["sensor"], - "homeassistant": "2022.7.0", + "homeassistant": "2023.9.1", "iot_class": "local_poll" }