From 787da07457d18d050c4e3aab0fc75b136e6213fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Knuti=5Fin=5FP=C3=A4se?= <122045840+PaeserBastelstube@users.noreply.github.com> Date: Fri, 13 Jan 2023 13:05:59 +0100 Subject: [PATCH 1/5] RPi: submit attributes to decoder To import some attributes to data-dict-variable, this attributes must be submit to decoder classes --- tools/rpi/hoymiles/__main__.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tools/rpi/hoymiles/__main__.py b/tools/rpi/hoymiles/__main__.py index 32385d11a..5eb213886 100644 --- a/tools/rpi/hoymiles/__main__.py +++ b/tools/rpi/hoymiles/__main__.py @@ -118,6 +118,8 @@ def poll_inverter(inverter, dtu_ser, do_init, retries): :type retries: int """ inverter_ser = inverter.get('serial') + inverter_name = inverter.get('name') + inverter_strings = inverter.get('strings') # Queue at least status data request inv_str = str(inverter_ser) @@ -161,7 +163,10 @@ def poll_inverter(inverter, dtu_ser, do_init, retries): logging.debug(f'{c_datetime} Payload: ' + hoymiles.hexify_payload(response)) decoder = hoymiles.ResponseDecoder(response, request=com.request, - inverter_ser=inverter_ser + inverter_ser=inverter_ser, + inverter_name=inverter_name, + dtu_ser=dtu_ser, + strings=inverter_strings ) result = decoder.decode() if isinstance(result, hoymiles.decoders.StatusResponse): From 5db34cd5f204de60cbb684d8a58dd6229fff2995 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Knuti=5Fin=5FP=C3=A4se?= <122045840+PaeserBastelstube@users.noreply.github.com> Date: Fri, 13 Jan 2023 13:12:43 +0100 Subject: [PATCH 2/5] RPi: support to transmit some attributes To import some attribute to data-dict-variable, we need to transport this attributes to ResponseDecoder-Class --- tools/rpi/hoymiles/__init__.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tools/rpi/hoymiles/__init__.py b/tools/rpi/hoymiles/__init__.py index c02a0c714..169ad7320 100644 --- a/tools/rpi/hoymiles/__init__.py +++ b/tools/rpi/hoymiles/__init__.py @@ -144,6 +144,9 @@ class ResponseDecoder(ResponseDecoderFactory): def __init__(self, response, **params): """Initialize ResponseDecoder""" ResponseDecoderFactory.__init__(self, response, **params) + self.inv_name=params.get('inverter_name', None) + self.dtu_ser=params.get('dtu_ser', None) + self.strings=params.get('strings', None) def decode(self): """ @@ -164,7 +167,10 @@ def decode(self): return device(self.response, time_rx=self.time_rx, - inverter_ser=self.inverter_ser + inverter_ser=self.inverter_ser, + inverter_name=self.inv_name, + dtu_ser=self.dtu_ser, + strings=self.strings ) class InverterPacketFragment: From 2eef3b5bb4dd9557b69d3d531668878aef1c231f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Knuti=5Fin=5FP=C3=A4se?= <122045840+PaeserBastelstube@users.noreply.github.com> Date: Fri, 13 Jan 2023 13:14:55 +0100 Subject: [PATCH 3/5] Create ahoy.yml privat ahoy-yml --- tools/rpi/ahoy.yml | 84 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 84 insertions(+) create mode 100644 tools/rpi/ahoy.yml diff --git a/tools/rpi/ahoy.yml b/tools/rpi/ahoy.yml new file mode 100644 index 000000000..036ed1930 --- /dev/null +++ b/tools/rpi/ahoy.yml @@ -0,0 +1,84 @@ +--- + +ahoy: + interval: 5 + + logging: + filename: 'RPI-AHOY-DTU.log' + # DEBUG, INFO, WARNING, ERROR, FATAL + level: 'DEBUG' + + sunset: + disabled: false + latitude: 52.485333 + longitude: 10.315783 + altitude: 55 + + # List of available NRF24 transceivers + nrf: + - ce_pin: 22 + cs_pin: 0 + txpower: 'low' # default txpower (min,low,high,max) + + mqtt: + disabled: false + host: 192.168.254.36 + port: 1883 + user: 'Raspberry' + password: 'rpi' + useTLS: False + insecureTLS: False #set True for e.g. self signed certificates. + + # Influx2 output + influxdb: + disabled: true + url: 'http://influxserver.local:8086' + org: 'myorg' + token: '' + bucket: 'telegraf/autogen' + measurement: 'hoymiles' + + volkszaehler: + disabled: true + inverters: + - serial: 114172220003 + url: 'http://localhost/middleware/' + channels: + - type: 'temperature' + uid: 'ad578a40-1d97-11ed-8e8b-fda01a416575' + - type: 'frequency' + uid: '' + - type: 'ac_power0' + uid: '7ca5ac50-1e41-11ed-927f-610c4cb2c69e' + - type: 'ac_voltage0' + uid: '9a38e2e0-1d94-11ed-b539-25f8607ac030' + - type: 'ac_current0' + uid: 'a9a4daf0-1e41-11ed-b68c-eb73eef3d21d' + - type: 'dc_power0' + uid: '38eb3ca0-1e53-11ed-b830-792e70a592fa' + - type: 'dc_voltage0' + uid: '' + - type: 'dc_current0' + uid: '' + - type: 'dc_power1' + uid: '51c0e9d0-1e53-11ed-b574-8bc81547eb8f' + - type: 'dc_voltage1' + uid: '' + - type: 'dc_current1' + uid: '' + + dtu: + serial: 99978563001 + + inverters: + - name: 'Appelweg_PV' # 2ch inverter 1141-Series + serial: 114181807700 # ser-nr starts with 1141... + txpower: 'low' # txpower per inverter (min,low,high,max) + mqtt: + send_raw_enabled: false # allow inject debug data via mqtt + topic: 'Appelweg_PV/114181807700' # defaults to 'hoymiles/{serial}' + strings: # list all available strings + - s_name: 'String 1 left' # String 1 name + s_maxpower: 405 # String 1 max power in Wp + - s_name: 'String 2 right' # String 2 name + s_maxpower: 405 # String 2 max power in Wp From 899dbaa346d008176c16afdbaac824095a206794 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Knuti=5Fin=5FP=C3=A4se?= <122045840+PaeserBastelstube@users.noreply.github.com> Date: Fri, 13 Jan 2023 13:15:28 +0100 Subject: [PATCH 4/5] Create ahoy.service --- tools/rpi/ahoy.service | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 tools/rpi/ahoy.service diff --git a/tools/rpi/ahoy.service b/tools/rpi/ahoy.service new file mode 100644 index 000000000..68b0a1219 --- /dev/null +++ b/tools/rpi/ahoy.service @@ -0,0 +1,34 @@ +###################################################################### +# systemd.service configuration for ahoy (lumapu) +# users can modify the lines: +# - Description +# - ExecStart (for example: name of config file) +# - WorkingDirectory +# To change other configs, please consult systemd documentation +# +# to activate this service, create a link like: +# $ mkdir -p $HOME/.config/systemd/user && ln -sf $(pwd)/ahoy/tools/rpi/ahoy.service -t $HOME/.config/systemd/user +# $ systemctl --user status ahoy +# $ systemctl --user enable ahoy +# $ systemctl --user start ahoy +# +# 2023.01 +###################################################################### + +[Unit] + +Description=ahoy (lumapu) as Service +After=network.target local-fs.target time-sync.target + +[Service] +ExecStart=/usr/bin/env python3 -um hoymiles --log-transactions --verbose --config ahoy.yml +RestartSec=10 +Restart=on-failure +Type=simple + +# WorkingDirectory must be an absolute path - not relative path +WorkingDirectory=/home/pi/ahoy/tools/rpi +EnvironmentFile=/etc/environment + +[Install] +WantedBy=default.target From eb0f3b319a5f7fe3bce158baf35d5f497e316339 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Knuti=5Fin=5FP=C3=A4se?= <122045840+PaeserBastelstube@users.noreply.github.com> Date: Fri, 13 Jan 2023 18:22:41 +0100 Subject: [PATCH 5/5] Delete ahoy.yml --- tools/rpi/ahoy.yml | 84 ---------------------------------------------- 1 file changed, 84 deletions(-) delete mode 100644 tools/rpi/ahoy.yml diff --git a/tools/rpi/ahoy.yml b/tools/rpi/ahoy.yml deleted file mode 100644 index 036ed1930..000000000 --- a/tools/rpi/ahoy.yml +++ /dev/null @@ -1,84 +0,0 @@ ---- - -ahoy: - interval: 5 - - logging: - filename: 'RPI-AHOY-DTU.log' - # DEBUG, INFO, WARNING, ERROR, FATAL - level: 'DEBUG' - - sunset: - disabled: false - latitude: 52.485333 - longitude: 10.315783 - altitude: 55 - - # List of available NRF24 transceivers - nrf: - - ce_pin: 22 - cs_pin: 0 - txpower: 'low' # default txpower (min,low,high,max) - - mqtt: - disabled: false - host: 192.168.254.36 - port: 1883 - user: 'Raspberry' - password: 'rpi' - useTLS: False - insecureTLS: False #set True for e.g. self signed certificates. - - # Influx2 output - influxdb: - disabled: true - url: 'http://influxserver.local:8086' - org: 'myorg' - token: '' - bucket: 'telegraf/autogen' - measurement: 'hoymiles' - - volkszaehler: - disabled: true - inverters: - - serial: 114172220003 - url: 'http://localhost/middleware/' - channels: - - type: 'temperature' - uid: 'ad578a40-1d97-11ed-8e8b-fda01a416575' - - type: 'frequency' - uid: '' - - type: 'ac_power0' - uid: '7ca5ac50-1e41-11ed-927f-610c4cb2c69e' - - type: 'ac_voltage0' - uid: '9a38e2e0-1d94-11ed-b539-25f8607ac030' - - type: 'ac_current0' - uid: 'a9a4daf0-1e41-11ed-b68c-eb73eef3d21d' - - type: 'dc_power0' - uid: '38eb3ca0-1e53-11ed-b830-792e70a592fa' - - type: 'dc_voltage0' - uid: '' - - type: 'dc_current0' - uid: '' - - type: 'dc_power1' - uid: '51c0e9d0-1e53-11ed-b574-8bc81547eb8f' - - type: 'dc_voltage1' - uid: '' - - type: 'dc_current1' - uid: '' - - dtu: - serial: 99978563001 - - inverters: - - name: 'Appelweg_PV' # 2ch inverter 1141-Series - serial: 114181807700 # ser-nr starts with 1141... - txpower: 'low' # txpower per inverter (min,low,high,max) - mqtt: - send_raw_enabled: false # allow inject debug data via mqtt - topic: 'Appelweg_PV/114181807700' # defaults to 'hoymiles/{serial}' - strings: # list all available strings - - s_name: 'String 1 left' # String 1 name - s_maxpower: 405 # String 1 max power in Wp - - s_name: 'String 2 right' # String 2 name - s_maxpower: 405 # String 2 max power in Wp