olivergregorius / sun2000_modbus

Library for reading Huawei Sun2000 inverter metrics via Modbus TCP
MIT License
23 stars 9 forks source link

Set connected flag to false on read error #10

Closed olivergregorius closed 2 years ago

olivergregorius commented 2 years ago

During initialization and connection to an inverter the connected flag is set to True and this value is kept for the whole application runtime. In case of a meanwhile connection failure a command for register-read fails with a ModbusIOException which is caught and rethrown in the method read_raw_value. In this case the connected flag should be set to False to indicate that a reconnect might be required.