From 112c7e66f20c20a292b299c2d9344e7c9959eba8 Mon Sep 17 00:00:00 2001 From: Stefan Allius <122395479+s-allius@users.noreply.github.com> Date: Wed, 10 Jul 2024 20:43:03 +0200 Subject: [PATCH] S allius/issue117 (#122) * add shutdown flag * add more register definitions * add start commando for client side connections * add first support for port 8899 * fix shutdown * add client_mode configuration * read client_mode config to setup inverter connections * add client_mode connections over port 8899 * add preview build * add documentation for client_mode * catch os error and log thme with DEBUG level * update changelog --- CHANGELOG.md | 2 ++ app/config/default_config.toml | 6 +++++- app/src/modbus_tcp.py | 5 ++++- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3c82430..b242089 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [unreleased] +- cleanup shutdown +- add preview build - MODBUS: the last digit of the inverter version is a hexadecimal number [#119](https://github.com/s-allius/tsun-gen3-proxy/issues/119) - GEN3PLUS: add client_mode connection on port 8899 [#117](https://github.com/s-allius/tsun-gen3-proxy/issues/117) diff --git a/app/config/default_config.toml b/app/config/default_config.toml index 22ba82d..6178f14 100644 --- a/app/config/default_config.toml +++ b/app/config/default_config.toml @@ -44,7 +44,11 @@ inverters.allow_all = true # allow inverters, even if we have no inverter mapp monitor_sn = 2000000000 # The "Monitoring SN:" can be found on a sticker enclosed with the inverter #node_id = '' # Optional, MQTT replacement for inverters serial number #suggested_area = '' # Optional, suggested installation place for home-assistant -#client_mode = {host = '192.168.0.1', port = 8899} + +# if your inverter supports SSL connections you must use the client_mode. Pls, uncomment +# the next line and configure the fixed IP of your inverter +#client_mode = {host = '192.168.0.1', port = 8899} + #pv1 = {type = 'RSM40-8-410M', manufacturer = 'Risen'} # Optional, PV module descr #pv2 = {type = 'RSM40-8-410M', manufacturer = 'Risen'} # Optional, PV module descr #pv3 = {type = 'RSM40-8-410M', manufacturer = 'Risen'} # Optional, PV module descr diff --git a/app/src/modbus_tcp.py b/app/src/modbus_tcp.py index 5382cc6..4aae57a 100644 --- a/app/src/modbus_tcp.py +++ b/app/src/modbus_tcp.py @@ -60,7 +60,10 @@ class ModbusTcp(): return except (ConnectionRefusedError, TimeoutError) as error: - logging.info(f'{error}') + logging.debug(f'Inv-conn:{error}') + + except OSError as error: + logging.info(f'os-error: {error}') except Exception: logging.error(