Connection to Inverter via Modbus RTU failed
I am using the following code to connect to an inverter via modbus rtu. ` import asyncio from huawei_solar import AsyncHuaweiSolar, register_names as rn
async def hua(): slave_id = 0 #client = await AsyncHuaweiSolar.create("192.168.200.1", 6607, slave_id) client = await AsyncHuaweiSolar.create_rtu("/dev/ttyUSB0", 9600, 1)
# Reading a single register
#result = await client.get(rn.NB_PV_STRINGS, slave_id)
#print("Number of PV strings: ", result.value)
result = await client.get(rn.INTERNAL_TEMPERATURE, slave_id)
print("Temperature: ", result.value)
result = asyncio.run(hua()) print(result) ` When using version 2.2.6 everything works fine but beginning with 2.2.7b3 i get an error
File "/usr/local/lib/python3.9/dist-packages/huawei_solar/huawei_solar.py", line 133, in _communication_lock if not self._client.connected_event.is_set(): AttributeError: 'AsyncHuaweiSolarModbusSerialClient' object has no attribute 'connected_event' Traceback (most recent call last): File "/usr/local/lib/python3.9/dist-packages/huawei_solar/huawei_solar.py", line 200, in create_rtu await huawei_solar._initialize() File "/usr/local/lib/python3.9/dist-packages/huawei_solar/huawei_solar.py", line 104, in _initialize self.time_zone = (await self.get(rn.TIME_ZONE)).value File "/usr/local/lib/python3.9/dist-packages/huawei_solar/huawei_solar.py", line 223, in get return (await self.get_multiple([name], slave))[0] File "/usr/local/lib/python3.9/dist-packages/huawei_solar/huawei_solar.py", line 258, in get_multiple response = await self._read_registers(registers[0].register, total_length, slave) File "/usr/local/lib/python3.9/dist-packages/huawei_solar/huawei_solar.py", line 350, in _read_registers async with self._communication_lock(): File "/usr/lib/python3.9/contextlib.py", line 175, in __aenter__ return await self.gen.__anext__() File "/usr/local/lib/python3.9/dist-packages/huawei_solar/huawei_solar.py", line 133, in _communication_lock if not self._client.connected_event.is_set(): AttributeError: 'AsyncHuaweiSolarModbusSerialClient' object has no attribute 'connected_event'