modbus_tcp wurde auf asyncio umgebaut - wäre also insofern kein Thema. Womöglich würden structs mit den Items schon ausreichen. Werde ich mal testen in den nächsten Wochen..
X
-
Ich habe jetzt endlich mal installiert und wollte testen. Ging natürlich erst mal nix:
Code:2026-06-08 20:41:24 ERROR plugins.huawei_sun2000 inverter_read: Error reading register 'PHASE_C_DC_COMPONENT_DCI' from 192.168.1.9:502, slave_id 16: ModbusIOException('[Input/Output] Request cancelled outside library.') 2026-06-08 20:41:28 ERROR pymodbus.logging ERROR: request ask for transaction_id=510 but got id=507, Skipping. >>>>> send: 0x1 0xf5 0x0 0x0 0x0 0x6 0x10 0x3 0x88 0xd3 0x0 0x1 >>>>> recv: 0x1 0xf5 0x0 0x0 0x0 0x5 0x10 0x3 0x2 0x0 0x0 extra data: >>>>> send: 0x1 0xf6 0x0 0x0 0x0 0x6 0x10 0x3 0x88 0xd1 0x0 0x1 >>>>> recv: 0x1 0xf6 0x0 0x0 0x0 0x5 0x10 0x3 0x2 0x0 0x0 extra data: >>>>> send: 0x1 0xf7 0x0 0x0 0x0 0x6 0x10 0x3 0x88 0xd4 0x0 0x1 >>>>> recv: 0x1 0xf7 0x0 0x0 0x0 0x5 0x10 0x3 0x2 0x0 0x0 extra data: >>>>> send: 0x1 0xf8 0x0 0x0 0x0 0x6 0x10 0x3 0x88 0xd5 0x0 0x1 >>>>> recv: 0x1 0xf8 0x0 0x0 0x0 0x5 0x10 0x3 0x2 0x0 0x0 extra data: >>>>> send: 0x1 0xf9 0x0 0x0 0x0 0x6 0x10 0x3 0x88 0xde 0x0 0x1 >>>>> recv: 0x1 0xf9 0x0 0x0 0x0 0x5 0x10 0x3 0x2 0xff 0xfe extra data: >>>>> send: 0x1 0xfa 0x0 0x0 0x0 0x6 0x10 0x3 0x88 0xdf 0x0 0x1 >>>>> recv: 0x1 0xfa 0x0 0x0 0x0 0x5 0x10 0x3 0x2 0xff 0xfe extra data: >>>>> send: 0x1 0xfb 0x0 0x0 0x0 0x6 0x10 0x3 0x88 0xe0 0x0 0x1 >>>>> send: 0x1 0xfc 0x0 0x0 0x0 0x6 0x10 0x3 0x88 0xe1 0x0 0x1 >>>>> recv: 0x1 0xfc 0x0 0x0 0x0 0x3 0x10 0x83 0x6 extra data: >>>>> send: 0x1 0xfd 0x0 0x0 0x0 0x6 0x10 0x3 0x88 0xe1 0x0 0x1 >>>>> recv: 0x1 0xfd 0x0 0x0 0x0 0x3 0x10 0x83 0x6 extra data: >>>>> send: 0x1 0xfe 0x0 0x0 0x0 0x6 0x10 0x3 0x88 0xe1 0x0 0x1 >>>>> recv: 0x1 0xfe 0x0 0x0 0x0 0x3 0x10 0x83 0x6 extra data: >>>>> recv: 0x1 0xfb 0x0 0x0 0x0 0x5 0x10 0x3 0x2 0xff 0xff extra data: 2026-06-08 20:41:28 WARNING plugins.huawei_sun2000 Time out (4s) while reading register 'LEAKAGE_CURRENT_RCD' from 192.168.1.9:502, slave_id 16. Stop reading registers. 2026-06-08 20:46:33 ERROR plugins.huawei_sun2000 Exception raised in PluginTask: Modbus Error: [Input/Output] Request cancelled outside library. > Traceback (most recent call last): > File "/usr/local/smarthome/venvs/py_shng/lib/python3.11/site-packages/pymodbus/transaction/transaction.py", line 175, in execute > response: ModbusPDU = await asyncio.wait_for( > ^^^^^^^^^^^^^^^^^^^^^^^ > File "/usr/lib/python3.11/asyncio/tasks.py", line 466, in wait_for > await waiter > asyncio.exceptions.CancelledError The above exception was the direct cause of the following exception: > Traceback (most recent call last): > File "/usr/local/smarthome/lib/model/smartplugin.py", line 1181, in _asyncio_main > await self.task > File "/usr/local/smarthome/plugins/huawei_sun2000/__init__.py", line 141, in plugin_coro > self._client = await self.connect() > ^^^^^^^^^^^^^^^^^^^^ > File "/usr/local/smarthome/plugins/huawei_sun2000/__init__.py", line 182, in connect > await asyncio.wait_for(client.get(rn.MODEL_NAME, self._slave), timeout=4) > File "/usr/lib/python3.11/asyncio/tasks.py", line 490, in wait_for > return fut.result() > ^^^^^^^^^^^^ > File "/usr/local/smarthome/venvs/py_shng/lib/python3.11/site-packages/huawei_solar/huawei_solar.py", line 261, in get > return (await self.get_multiple([name], slave_id))[0] > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ > File "/usr/local/smarthome/venvs/py_shng/lib/python3.11/site-packages/huawei_solar/huawei_solar.py", line 305, in get_multiple > response = await self._read_registers( > ^^^^^^^^^^^^^^^^^^^^^^^^^^^ > File "/usr/local/smarthome/venvs/py_shng/lib/python3.11/site-packages/huawei_solar/huawei_solar.py", line 442, in _read_registers > return await _do_read() > ^^^^^^^^^^^^^^^^ > File "/usr/local/smarthome/venvs/py_shng/lib/python3.11/site-packages/backoff/_async.py", line 151, in retry > ret = await target(*args, **kwargs) > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ > File "/usr/local/smarthome/venvs/py_shng/lib/python3.11/site-packages/backoff/_async.py", line 151, in retry > ret = await target(*args, **kwargs) > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ > File "/usr/local/smarthome/venvs/py_shng/lib/python3.11/site-packages/huawei_solar/huawei_solar.py", line 389, in _do_read > response = await self._client.read_holding_registers( > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ > File "/usr/local/smarthome/venvs/py_shng/lib/python3.11/site-packages/pymodbus/transaction/transaction.py", line 192, in execute > raise ModbusIOException("Request cancelled outside library.") from exc > pymodbus.exceptions.ModbusIOException: Modbus Error: [Input/Output] Request cancelled outside library.
Kommentar
-
Sie haben die Library ziemlich umgebaut. Keine modbus_tcp mehr, sondern eine andere Bibliothek. Ganz andere Struktur. Ganz ehrlich - wir müssen wie hier diskutiert https://github.com/smarthomeNG/plugins/pull/1019 ein sauberes Modbus-Plugin implementieren und dann Structs für die ganzen eigenen Geräte. Inzwischen kann man auch Unter-Structs aus Plugins einbinden, also zb modbus_tcp.huawei.inverter - insofern spricht da nichts mehr dagegen.
Ich habe aktuell das "nicht asyncio"-Plugin mit Huawei structs am Start und es läuft soweit mal alles gut. Nur die Verbindung dauert oft ewig..
Kann gerne mal einen PR dazu machen. Wäre super, du könntest das dann testen.
Kommentar


Kommentar