Also für mich sieht das nicht viel anders aus.
Auch wird kein neuer Wert in die pv2watt eingetragen. Habe da mal eine 100 eingetragen, die bleibt da erst mal stehen....
Auch habe ich schon mal mit den Registern +1 -1 versucht.
Hier noch mal der neue Log
Code: Alles auswählen
pi@raspberrypi:~ $ PYTHONPATH=/var/www/html/openWB/packages python3 /var/www/html/openWB/modules/wr2_smamodbus/sma.py
/usr/lib/python3/dist-packages/requests/__init__.py:91: RequestsDependencyWarning: urllib3 (1.26.8) or chardet (3.0.4) doesn't match a supported version!
RequestsDependencyWarning)
2022-01-18 00:47:30: PID: 13968: pymodbus.client.sync: Connection to Modbus server established. Socket ('192.168.188.80', 36463)
2022-01-18 00:47:30: PID: 13968: pymodbus.transaction: Current transaction state - IDLE
2022-01-18 00:47:30: PID: 13968: pymodbus.transaction: Running transaction 1
2022-01-18 00:47:30: PID: 13968: pymodbus.transaction: SEND: 0x0 0x1 0x0 0x0 0x0 0x6 0x3 0x4 0x75 0x5b 0x0 0x1
2022-01-18 00:47:30: PID: 13968: pymodbus.client.sync: New Transaction state 'SENDING'
2022-01-18 00:47:30: PID: 13968: pymodbus.transaction: Changing transaction state from 'SENDING' to 'WAITING FOR REPLY'
2022-01-18 00:47:31: PID: 13968: pymodbus.transaction: Changing transaction state from 'WAITING FOR REPLY' to 'PROCESSING REPLY'
2022-01-18 00:47:31: PID: 13968: pymodbus.transaction: RECV: 0x0 0x1 0x0 0x0 0x0 0x3 0x3 0x84 0x1
2022-01-18 00:47:31: PID: 13968: pymodbus.framer.socket_framer: Processing: 0x0 0x1 0x0 0x0 0x0 0x3 0x3 0x84 0x1
2022-01-18 00:47:31: PID: 13968: pymodbus.factory: Factory Response[132]
2022-01-18 00:47:31: PID: 13968: pymodbus.transaction: Adding transaction 1
2022-01-18 00:47:31: PID: 13968: pymodbus.transaction: Getting transaction 1
2022-01-18 00:47:31: PID: 13968: pymodbus.transaction: Changing transaction state from 'PROCESSING REPLY' to 'TRANSACTION_COMPLETE'
Traceback (most recent call last):
File "/var/www/html/openWB/packages/modules/common/modbus.py", line 81, in __read_registers
raise FaultState.error(__name__+" "+str(response))
modules.common.fault_state.FaultState: ('modules.common.modbus Exception Response(132, 4, IllegalFunction)', <FaultStateLevel.ERROR: 2>)
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/var/www/html/openWB/modules/wr2_smamodbus/sma.py", line 22, in <module>
test()
File "/var/www/html/openWB/modules/wr2_smamodbus/sma.py", line 16, in test
power = client.read_input_registers(30043, ModbusDataType.INT_16, unit=3)
File "/var/www/html/openWB/packages/modules/common/modbus.py", line 134, in read_input_registers
return self.__read_registers(self.delegate.read_input_registers, address, types, byteorder, wordorder, **kwargs)
File "/var/www/html/openWB/packages/modules/common/modbus.py", line 97, in __read_registers
str(e)) from e
modules.common.fault_state.FaultState: ("modules.common.modbus <class 'modules.common.fault_state.FaultState'> ('modules.common.modbus Exception Response(132, 4, IllegalFunction)', <FaultStateLevel.ERROR: 2>)", <FaultStateLevel.ERROR: 2>)
Hier noch die aktuelle sma.py
Code: Alles auswählen
#!/usr/bin/env python3
#import logging
#import sys
#from typing import Iterable
import requests
from helpermodules.log import setup_logging_stdout
#setup_logging_stdout()
from modules.common.component_state import InverterState
from modules.common.modbus import ModbusClient, ModbusDataType
from modules.common.store import get_inverter_value_store
def test():
with ModbusClient("192.168.188.254") as client:
power = client.read_input_registers(30043, ModbusDataType.INT_16, unit=3)
print(power)
get_inverter_value_store(2).set(InverterState(power=-power))
if __name__ == '__main__':
setup_logging_stdout()
test()