From c920893bf63acf1bf1d0be6e11dfb4273e911d4a Mon Sep 17 00:00:00 2001 From: andig Date: Sun, 24 Sep 2023 16:25:50 +0200 Subject: [PATCH] Revert "Modbus: don't render rtu: false for Modbus TCP (#9915)" (#10046) --- charger/phoenix-em-eth.go | 11 ++++++----- util/templates/modbus.tpl | 1 + 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/charger/phoenix-em-eth.go b/charger/phoenix-em-eth.go index 82ae1d6473..e312446e5a 100644 --- a/charger/phoenix-em-eth.go +++ b/charger/phoenix-em-eth.go @@ -37,14 +37,15 @@ func init() { // NewPhoenixEMEthFromConfig creates a Phoenix charger from generic config func NewPhoenixEMEthFromConfig(other map[string]interface{}) (api.Charger, error) { cc := struct { - URI string - ID uint8 - Meter struct { + modbus.TcpSettings `mapstructure:",squash"` + Meter struct { Power, Energy, Currents bool } }{ - URI: "192.168.0.8:502", // default - ID: 180, // default + TcpSettings: modbus.TcpSettings{ + URI: "192.168.0.8:502", // default + ID: 180, // default + }, } if err := util.DecodeOther(other, &cc); err != nil { diff --git a/util/templates/modbus.tpl b/util/templates/modbus.tpl index fc4cd35974..aea8225573 100644 --- a/util/templates/modbus.tpl +++ b/util/templates/modbus.tpl @@ -12,6 +12,7 @@ rtu: true {{- else if or (eq .modbus "tcpip") .tcpip }} # Modbus TCP uri: {{ .host }}:{{ .port }} +rtu: false {{- else }} # configuration error - should not happen modbusConnectionTypeNotDefined: {{ .modbus }}