From 06d27f0a2033c5fcdb7929929fb80025808efce2 Mon Sep 17 00:00:00 2001 From: andig Date: Fri, 23 Jun 2023 20:37:37 +0200 Subject: [PATCH 01/29] Modbus: support ModbusTCP via serial adapter --- util/templates/defaults.yaml | 16 ++++++++-------- util/templates/documentation_modbus.tpl | 11 ++++++----- 2 files changed, 14 insertions(+), 13 deletions(-) diff --git a/util/templates/defaults.yaml b/util/templates/defaults.yaml index f31c73df17..27aae784b8 100644 --- a/util/templates/defaults.yaml +++ b/util/templates/defaults.yaml @@ -398,12 +398,12 @@ presets: modbus: interfaces: - rs485: ["rs485serial", "rs485tcpip"] - tcpip: ["tcpip"] + rs485: ["serial", "rtu", "tcp"] + ethernet: ["tcp"] types: - rs485serial: + serial: description: - generic: Serial (USB-RS485 Adapter) + generic: Serial (ModbusRTU via USB-RS485 Adapter) params: - reference: true referencename: modbusid @@ -417,9 +417,9 @@ modbus: - reference: true referencename: modbuscomset name: comset - rs485tcpip: + rtu: description: - generic: Serial (Ethernet-RS485 Adapter) + generic: Serial (ModbusRTU via Ethernet-RS485 Adapter) params: - reference: true referencename: modbusid @@ -429,9 +429,9 @@ modbus: - reference: true name: port default: 502 - tcpip: + tcp: description: - generic: TCP/IP + generic: ModbusTCP params: - reference: true referencename: modbusid diff --git a/util/templates/documentation_modbus.tpl b/util/templates/documentation_modbus.tpl index cc6640860c..01927e4df5 100644 --- a/util/templates/documentation_modbus.tpl +++ b/util/templates/documentation_modbus.tpl @@ -1,24 +1,25 @@ -{{- if .rs485serial }} +{{- if .serial }} # RS485 via adapter (Modbus RTU) -modbus: rs485serial +modbus: serial id: {{ .id }} device: {{ .device }} # USB-RS485 Adapter Adresse baudrate: {{ .baudrate }} # Prüfe die Geräteeinstellungen, typische Werte sind 9600, 19200, 38400, 57600, 115200 comset: "{{ .comset }}" # Kommunikationsparameter für den Adapter {{- end }} -{{- if .rs485tcpip }} +{{- if .rtu }} # RS485 via TCP/IP (Modbus RTU) -modbus: rs485tcpip +modbus: rtu id: {{ .id }} host: {{ .host }} # Hostname port: {{ .port }} # Port +rtu: true {{- end }} {{- if .tcpip }} # Modbus TCP -modbus: tcpip +modbus: tcp id: {{ .id }} host: {{ .host }} # Hostname port: {{ .port }} # Port From a3eee2db3d491211e0ed1370b12b28c0259c2d42 Mon Sep 17 00:00:00 2001 From: andig Date: Fri, 23 Jun 2023 20:39:49 +0200 Subject: [PATCH 02/29] wip --- util/templates/documentation_modbus.tpl | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/util/templates/documentation_modbus.tpl b/util/templates/documentation_modbus.tpl index 01927e4df5..9eaab431e5 100644 --- a/util/templates/documentation_modbus.tpl +++ b/util/templates/documentation_modbus.tpl @@ -3,9 +3,9 @@ # RS485 via adapter (Modbus RTU) modbus: serial id: {{ .id }} -device: {{ .device }} # USB-RS485 Adapter Adresse -baudrate: {{ .baudrate }} # Prüfe die Geräteeinstellungen, typische Werte sind 9600, 19200, 38400, 57600, 115200 -comset: "{{ .comset }}" # Kommunikationsparameter für den Adapter +device: {{ .device }} # USB-RS485 Geräteadresse, typische Werte sind /dev/ttyUSB0, /dev/ttyAMA0, /dev/ttyS0 +baudrate: {{ .baudrate }} # Baudrate, typische Werte sind 9600, 19200, 38400, 57600, 115200 +comset: {{ .comset }} # Parität, Datenbits, Stoppbits, typische Werte sind 8N1, 8E1, 8O1 {{- end }} {{- if .rtu }} From b84cd506444c4bbae94c7f3dc4413d678ba4fbd2 Mon Sep 17 00:00:00 2001 From: andig Date: Fri, 23 Jun 2023 20:41:32 +0200 Subject: [PATCH 03/29] wip --- util/templates/documentation_modbus.tpl | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/util/templates/documentation_modbus.tpl b/util/templates/documentation_modbus.tpl index 9eaab431e5..1cf5af5421 100644 --- a/util/templates/documentation_modbus.tpl +++ b/util/templates/documentation_modbus.tpl @@ -1,6 +1,6 @@ {{- if .serial }} -# RS485 via adapter (Modbus RTU) +# RS485 via USB adapter (Modbus RTU) modbus: serial id: {{ .id }} device: {{ .device }} # USB-RS485 Geräteadresse, typische Werte sind /dev/ttyUSB0, /dev/ttyAMA0, /dev/ttyS0 @@ -9,12 +9,11 @@ comset: {{ .comset }} # Parität, Datenbits, Stoppbits, typische Werte sind 8N1, {{- end }} {{- if .rtu }} -# RS485 via TCP/IP (Modbus RTU) +# RS485 via Ethernet adapter (Modbus RTU) modbus: rtu id: {{ .id }} host: {{ .host }} # Hostname port: {{ .port }} # Port -rtu: true {{- end }} {{- if .tcpip }} From 00b5a9bb689dc6c62a74b0b5225d0c114d96fd0c Mon Sep 17 00:00:00 2001 From: andig Date: Fri, 23 Jun 2023 20:45:19 +0200 Subject: [PATCH 04/29] wip --- util/templates/modbus.tpl | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/util/templates/modbus.tpl b/util/templates/modbus.tpl index aea8225573..9e75c15f8e 100644 --- a/util/templates/modbus.tpl +++ b/util/templates/modbus.tpl @@ -1,15 +1,15 @@ {{- define "modbus" }} id: {{ .id }} -{{- if or (eq .modbus "rs485serial") .rs485serial }} +{{- if or (eq .modbus "rs485serial") (eq .modbus "serial") }} # RS485 via adapter (Modbus RTU) device: {{ .device }} baudrate: {{ .baudrate }} comset: "{{ .comset }}" -{{- else if or (eq .modbus "rs485tcpip") .rs485tcpip }} +{{- else if or (eq .modbus "rs485tcpip") (eq .modbus "rtu") }} # RS485 via TCP/IP (Modbus RTU) uri: {{ .host }}:{{ .port }} rtu: true -{{- else if or (eq .modbus "tcpip") .tcpip }} +{{- else if or (eq .modbus "tcpip") (eq .modbus "tcp") }} # Modbus TCP uri: {{ .host }}:{{ .port }} rtu: false From ccb972e576c41205cacb5348731fac49a7fe8a95 Mon Sep 17 00:00:00 2001 From: andig Date: Fri, 23 Jun 2023 20:50:02 +0200 Subject: [PATCH 05/29] wip --- util/templates/defaults.yaml | 18 +++++++++++++++--- util/templates/documentation_modbus.tpl | 8 ++++++++ 2 files changed, 23 insertions(+), 3 deletions(-) diff --git a/util/templates/defaults.yaml b/util/templates/defaults.yaml index 27aae784b8..f08105e0e0 100644 --- a/util/templates/defaults.yaml +++ b/util/templates/defaults.yaml @@ -399,11 +399,11 @@ presets: modbus: interfaces: rs485: ["serial", "rtu", "tcp"] - ethernet: ["tcp"] + ethernet: ["tcpip"] types: serial: description: - generic: Serial (ModbusRTU via USB-RS485 Adapter) + generic: Serial (ModbusRTU via USB-RS485 adapter) params: - reference: true referencename: modbusid @@ -419,7 +419,7 @@ modbus: name: comset rtu: description: - generic: Serial (ModbusRTU via Ethernet-RS485 Adapter) + generic: Serial (ModbusRTU via Ethernet-RS485 adapter) params: - reference: true referencename: modbusid @@ -430,6 +430,18 @@ modbus: name: port default: 502 tcp: + description: + generic: Serial (ModbusTCP via protocol converter) + params: + - reference: true + referencename: modbusid + name: id + - reference: true + name: host + - reference: true + name: port + default: 502 + tcpip: description: generic: ModbusTCP params: diff --git a/util/templates/documentation_modbus.tpl b/util/templates/documentation_modbus.tpl index 1cf5af5421..db588fbf16 100644 --- a/util/templates/documentation_modbus.tpl +++ b/util/templates/documentation_modbus.tpl @@ -15,6 +15,14 @@ id: {{ .id }} host: {{ .host }} # Hostname port: {{ .port }} # Port {{- end }} +{{- if .tcp }} + +# RS485 via protocol converter (Modbus TCP) +modbus: tcp +id: {{ .id }} +host: {{ .host }} # Hostname +port: {{ .port }} # Port +{{- end -}} {{- if .tcpip }} # Modbus TCP From 5f8e10f2afb06b391a0542c3d0fa6fd6001f877c Mon Sep 17 00:00:00 2001 From: andig Date: Fri, 23 Jun 2023 20:51:28 +0200 Subject: [PATCH 06/29] wip --- util/templates/documentation_modbus.tpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/util/templates/documentation_modbus.tpl b/util/templates/documentation_modbus.tpl index db588fbf16..2bcc157b54 100644 --- a/util/templates/documentation_modbus.tpl +++ b/util/templates/documentation_modbus.tpl @@ -3,7 +3,7 @@ # RS485 via USB adapter (Modbus RTU) modbus: serial id: {{ .id }} -device: {{ .device }} # USB-RS485 Geräteadresse, typische Werte sind /dev/ttyUSB0, /dev/ttyAMA0, /dev/ttyS0 +device: {{ .device }} # USB Geräteadresse, typische Werte sind /dev/ttyUSB0, /dev/ttyAMA0, /dev/ttyS0 baudrate: {{ .baudrate }} # Baudrate, typische Werte sind 9600, 19200, 38400, 57600, 115200 comset: {{ .comset }} # Parität, Datenbits, Stoppbits, typische Werte sind 8N1, 8E1, 8O1 {{- end }} From 846afe79b9e1ae2da45ea4c6031e78d80e6f0229 Mon Sep 17 00:00:00 2001 From: andig Date: Fri, 23 Jun 2023 21:02:47 +0200 Subject: [PATCH 07/29] wip --- util/templates/modbus.tpl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/util/templates/modbus.tpl b/util/templates/modbus.tpl index 9e75c15f8e..67d4f925b5 100644 --- a/util/templates/modbus.tpl +++ b/util/templates/modbus.tpl @@ -1,12 +1,12 @@ {{- define "modbus" }} id: {{ .id }} {{- if or (eq .modbus "rs485serial") (eq .modbus "serial") }} -# RS485 via adapter (Modbus RTU) +# RS485 via USB adapter (Modbus RTU) device: {{ .device }} baudrate: {{ .baudrate }} comset: "{{ .comset }}" {{- else if or (eq .modbus "rs485tcpip") (eq .modbus "rtu") }} -# RS485 via TCP/IP (Modbus RTU) +# RS485 via Ethernet adapter (Modbus RTU) uri: {{ .host }}:{{ .port }} rtu: true {{- else if or (eq .modbus "tcpip") (eq .modbus "tcp") }} From 931160cb17e37067c062b29c9c3f5e6354826342 Mon Sep 17 00:00:00 2001 From: premultiply <4681172+premultiply@users.noreply.github.com> Date: Sat, 24 Jun 2023 11:19:59 +0000 Subject: [PATCH 08/29] wip --- util/templates/modbus.tpl | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/util/templates/modbus.tpl b/util/templates/modbus.tpl index 67d4f925b5..77ff3499d6 100644 --- a/util/templates/modbus.tpl +++ b/util/templates/modbus.tpl @@ -1,12 +1,12 @@ {{- define "modbus" }} id: {{ .id }} -{{- if or (eq .modbus "rs485serial") (eq .modbus "serial") }} -# RS485 via USB adapter (Modbus RTU) +{{- if or (eq .modbus "rs485serial") (eq .modbus "rtu") }} +# RS485 via direct serial port (Modbus RTU) device: {{ .device }} baudrate: {{ .baudrate }} comset: "{{ .comset }}" -{{- else if or (eq .modbus "rs485tcpip") (eq .modbus "rtu") }} -# RS485 via Ethernet adapter (Modbus RTU) +{{- else if or (eq .modbus "rs485tcpip") (eq .modbus "rtu-over-tcp") }} +# RS485 via protocol transparent IP adapter (Modbus RTU over TCP/IP) uri: {{ .host }}:{{ .port }} rtu: true {{- else if or (eq .modbus "tcpip") (eq .modbus "tcp") }} From d01c2d29e8f83fcc2cb245643e1ceada4d021458 Mon Sep 17 00:00:00 2001 From: premultiply <4681172+premultiply@users.noreply.github.com> Date: Sat, 24 Jun 2023 13:51:12 +0000 Subject: [PATCH 09/29] wip --- util/templates/defaults.yaml | 34 ++++++++++++++++++------- util/templates/documentation_modbus.tpl | 22 +++++----------- util/templates/modbus.tpl | 10 ++++---- 3 files changed, 37 insertions(+), 29 deletions(-) diff --git a/util/templates/defaults.yaml b/util/templates/defaults.yaml index f08105e0e0..b6f58803af 100644 --- a/util/templates/defaults.yaml +++ b/util/templates/defaults.yaml @@ -398,12 +398,12 @@ presets: modbus: interfaces: - rs485: ["serial", "rtu", "tcp"] - ethernet: ["tcpip"] + rs485: ["rtuserial", "rtutcp", "tcp"] + ethernet: ["tcp"] types: - serial: + rtuserial: description: - generic: Serial (ModbusRTU via USB-RS485 adapter) + generic: Serial port (Modbus RTU) params: - reference: true referencename: modbusid @@ -417,9 +417,9 @@ modbus: - reference: true referencename: modbuscomset name: comset - rtu: + rtutcp: description: - generic: Serial (ModbusRTU via Ethernet-RS485 adapter) + generic: Serial device server (Modbus RTU) params: - reference: true referencename: modbusid @@ -431,7 +431,7 @@ modbus: default: 502 tcp: description: - generic: Serial (ModbusTCP via protocol converter) + generic: Modbus TCP params: - reference: true referencename: modbusid @@ -441,9 +441,25 @@ modbus: - reference: true name: port default: 502 - tcpip: + asciiserial: description: - generic: ModbusTCP + generic: Serial port (Modbus ASCII) + params: + - reference: true + referencename: modbusid + name: id + - reference: true + referencename: modbusdevice + name: device + - reference: true + referencename: modbusbaudrate + name: baudrate + - reference: true + referencename: modbuscomset + name: comset + asciitcp: + description: + generic: Serial device server (Modbus ASCII) params: - reference: true referencename: modbusid diff --git a/util/templates/documentation_modbus.tpl b/util/templates/documentation_modbus.tpl index 2bcc157b54..4f5c70bc17 100644 --- a/util/templates/documentation_modbus.tpl +++ b/util/templates/documentation_modbus.tpl @@ -1,30 +1,22 @@ -{{- if .serial }} +{{- if .rtuserial }} -# RS485 via USB adapter (Modbus RTU) -modbus: serial +# Attached on local serial port (Modbus RTU) +modbus: rtu id: {{ .id }} -device: {{ .device }} # USB Geräteadresse, typische Werte sind /dev/ttyUSB0, /dev/ttyAMA0, /dev/ttyS0 +device: {{ .device }} # Geräteadresse, typische Werte sind /dev/ttyUSB0, /dev/ttyAMA0, /dev/ttyS0 oder COM3 baudrate: {{ .baudrate }} # Baudrate, typische Werte sind 9600, 19200, 38400, 57600, 115200 comset: {{ .comset }} # Parität, Datenbits, Stoppbits, typische Werte sind 8N1, 8E1, 8O1 {{- end }} -{{- if .rtu }} +{{- if .rtutcp }} -# RS485 via Ethernet adapter (Modbus RTU) -modbus: rtu +# Attached to transparent serial device server (Modbus RTU over TCP/IP) +modbus: rtu-over-tcp id: {{ .id }} host: {{ .host }} # Hostname port: {{ .port }} # Port {{- end }} {{- if .tcp }} -# RS485 via protocol converter (Modbus TCP) -modbus: tcp -id: {{ .id }} -host: {{ .host }} # Hostname -port: {{ .port }} # Port -{{- end -}} -{{- if .tcpip }} - # Modbus TCP modbus: tcp id: {{ .id }} diff --git a/util/templates/modbus.tpl b/util/templates/modbus.tpl index 77ff3499d6..36ebb85aa2 100644 --- a/util/templates/modbus.tpl +++ b/util/templates/modbus.tpl @@ -1,16 +1,16 @@ {{- define "modbus" }} id: {{ .id }} -{{- if or (eq .modbus "rs485serial") (eq .modbus "rtu") }} -# RS485 via direct serial port (Modbus RTU) +{{- if or (eq .modbus "rs485serial") (eq .modbus "rtuserial") }} +# Attached on local serial port (Modbus RTU) device: {{ .device }} baudrate: {{ .baudrate }} comset: "{{ .comset }}" -{{- else if or (eq .modbus "rs485tcpip") (eq .modbus "rtu-over-tcp") }} -# RS485 via protocol transparent IP adapter (Modbus RTU over TCP/IP) +{{- else if or (eq .modbus "rs485tcpip") (eq .modbus "rtutcp") }} +# Attached to transparent serial device gateway server (Modbus RTU over TCP/IP) uri: {{ .host }}:{{ .port }} rtu: true {{- else if or (eq .modbus "tcpip") (eq .modbus "tcp") }} -# Modbus TCP +# Modbus TCP (native interface or translated serial device) uri: {{ .host }}:{{ .port }} rtu: false {{- else }} From e1394fa5ec32f21d4849700b26894f1eaea6ca66 Mon Sep 17 00:00:00 2001 From: premultiply <4681172+premultiply@users.noreply.github.com> Date: Sun, 25 Jun 2023 10:15:26 +0000 Subject: [PATCH 10/29] wip --- util/templates/render_testing.go | 6 +++--- util/templates/types.go | 17 ++++++++++------- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/util/templates/render_testing.go b/util/templates/render_testing.go index af96b7ee1c..f5883ce09e 100644 --- a/util/templates/render_testing.go +++ b/util/templates/render_testing.go @@ -46,10 +46,10 @@ func TestClass(t *testing.T, class Class, instantiate func(t *testing.T, values if values[ParamModbus] != nil { modbusChoices := tmpl.ModbusChoices() // we only test one modbus setup - if slices.Contains(modbusChoices, ModbusChoiceTCPIP) { - values[ModbusKeyTCPIP] = true + if slices.Contains(modbusChoices, ModbusChoiceTCP) { + values[ModbusKeyTCP] = true } else { - values[ModbusKeyRS485TCPIP] = true + values[ModbusKeyRTUTCP] = true } tmpl.ModbusValues(TemplateRenderModeUnitTest, values) } diff --git a/util/templates/types.go b/util/templates/types.go index 8b793b279f..80807dc4bb 100644 --- a/util/templates/types.go +++ b/util/templates/types.go @@ -20,11 +20,14 @@ const ( HemsTypeSMA = "sma" - ModbusChoiceRS485 = "rs485" - ModbusChoiceTCPIP = "tcpip" - ModbusKeyRS485Serial = "rs485serial" - ModbusKeyRS485TCPIP = "rs485tcpip" - ModbusKeyTCPIP = "tcpip" + ModbusChoiceRTU = "rtu" + ModbusChoiceTCP = "tcp" + ModbusChoiceASCII = "ascii" + ModbusKeyRTUSerial = "rtuserial" + ModbusKeyRTUTCP = "rtutcp" + ModbusKeyTCP = "tcp" + ModbusKeyASCIISerial = "asciiserial" + ModbusKeyASCIITCP = "asciitcp" ModbusParamNameId = "id" ModbusParamNameDevice = "device" @@ -41,7 +44,7 @@ const ( ) var ( - ValidModbusChoices = []string{ModbusChoiceRS485, ModbusChoiceTCPIP} + ValidModbusChoices = []string{ModbusChoiceRTU, ModbusChoiceTCP, ModbusChoiceASCII} ValidUsageChoices = []string{UsageChoiceGrid, UsageChoicePV, UsageChoiceBattery, UsageChoiceCharge} ) @@ -75,7 +78,7 @@ var predefinedTemplateProperties = []string{ "type", "template", "name", ModbusParamNameId, ModbusParamNameDevice, ModbusParamNameBaudrate, ModbusParamNameComset, ModbusParamNameURI, ModbusParamNameHost, ModbusParamNamePort, ModbusParamNameRTU, - ModbusKeyTCPIP, ModbusKeyRS485Serial, ModbusKeyRS485TCPIP, + ModbusKeyTCP, ModbusKeyRTUSerial, ModbusKeyRTUTCP, ModbusKeyASCIISerial, ModbusKeyASCIITCP, } // TextLanguage contains language-specific texts From 0a3a0cb544ebbd7d8c379f6a5695a55de375ffad Mon Sep 17 00:00:00 2001 From: premultiply <4681172+premultiply@users.noreply.github.com> Date: Sun, 25 Jun 2023 11:22:47 +0000 Subject: [PATCH 11/29] wip --- templates/definition/charger/abb.yaml | 2 +- templates/definition/charger/abl.yaml | 2 +- templates/definition/charger/alfen.yaml | 2 +- templates/definition/charger/alphatec.yaml | 2 +- templates/definition/charger/amtron.yaml | 2 +- templates/definition/charger/dadapower.yaml | 2 +- templates/definition/charger/em2go.yaml | 2 +- templates/definition/charger/evse-din.yaml | 2 +- templates/definition/charger/heidelberg.yaml | 2 +- templates/definition/charger/hesotec.yaml | 2 +- .../definition/charger/icharge-cion.yaml | 2 +- templates/definition/charger/innogy-ebox.yaml | 2 +- templates/definition/charger/keba-modbus.yaml | 2 +- templates/definition/charger/kse.yaml | 2 +- templates/definition/charger/obo.yaml | 2 +- .../definition/charger/phoenix-ev-ser.yaml | 2 +- .../definition/charger/pracht-alpha.yaml | 2 +- templates/definition/charger/versicharge.yaml | 2 +- templates/definition/charger/vestel.yaml | 2 +- templates/definition/common-schema.json | 5 +- templates/definition/meter/abb-ab.yaml | 2 +- .../definition/meter/alpha-ess-smile.yaml | 2 +- templates/definition/meter/be-mpm3pm.yaml | 2 +- templates/definition/meter/cfos.yaml | 2 +- templates/definition/meter/cg-em24.yaml | 2 +- templates/definition/meter/cg-emt3xx.yaml | 2 +- templates/definition/meter/deye-hybrid.yaml | 2 +- templates/definition/meter/dzg.yaml | 2 +- .../definition/meter/eastron-sdm120.yaml | 2 +- .../definition/meter/eastron-sdm220_230.yaml | 2 +- templates/definition/meter/eastron-sdm72.yaml | 2 +- .../definition/meter/eastron-sdm72v2_630.yaml | 2 +- templates/definition/meter/fox-ess-h1.yaml | 3 +- templates/definition/meter/fox-ess-h3.yaml | 3 +- templates/definition/meter/fox-ess-rs485.yaml | 59 +++++++++++++++++++ templates/definition/meter/goodwe-hybrid.yaml | 2 +- .../definition/meter/growatt-hybrid-tlxh.yaml | 2 +- .../definition/meter/growatt-hybrid.yaml | 2 +- .../huawei-sun2000-dongle-powersensor.yaml | 2 +- .../meter/huawei-sun2000-dongle.yaml | 2 +- .../meter/huawei-sun2000-rs485.yaml | 2 +- templates/definition/meter/inepro.yaml | 2 +- templates/definition/meter/janitza.yaml | 2 +- .../meter/kostal-ksem-inverter.yaml | 2 +- templates/definition/meter/kostal-ksem.yaml | 2 +- .../definition/meter/kostal-plenticore.yaml | 2 +- .../definition/meter/mypv-wifi-meter.yaml | 2 +- templates/definition/meter/orno.yaml | 2 +- templates/definition/meter/powerdog.yaml | 2 +- templates/definition/meter/sax.yaml | 2 +- templates/definition/meter/sbc-axx3.yaml | 2 +- .../definition/meter/schneider-iem3000.yaml | 2 +- templates/definition/meter/senergy.yaml | 2 +- .../definition/meter/siemens-7kt1665.yaml | 2 +- .../definition/meter/siemens-pac2200.yaml | 2 +- templates/definition/meter/sma-hybrid.yaml | 2 +- templates/definition/meter/sma-webbox.yaml | 2 +- templates/definition/meter/sofarsolar-g3.yaml | 2 +- templates/definition/meter/sofarsolar.yaml | 2 +- .../definition/meter/solaredge-hybrid.yaml | 2 +- .../definition/meter/solaredge-inverter.yaml | 2 +- .../definition/meter/solarmax-maxstorage.yaml | 2 +- templates/definition/meter/solax.yaml | 2 +- .../definition/meter/sungrow-hybrid.yaml | 2 +- .../definition/meter/sungrow-inverter.yaml | 2 +- .../definition/meter/sunspec-hybrid.yaml | 2 +- .../definition/meter/sunspec-inverter.yaml | 2 +- util/templates/defaults.yaml | 9 +-- util/templates/documentation_modbus.tpl | 23 +++++++- util/templates/modbus.tpl | 14 +++-- 70 files changed, 160 insertions(+), 82 deletions(-) create mode 100644 templates/definition/meter/fox-ess-rs485.yaml diff --git a/templates/definition/charger/abb.yaml b/templates/definition/charger/abb.yaml index 0ddc3fbb1b..79e61d73a9 100644 --- a/templates/definition/charger/abb.yaml +++ b/templates/definition/charger/abb.yaml @@ -11,7 +11,7 @@ requirements: evcc: ["sponsorship"] params: - name: modbus - choice: ["rs485", "tcpip"] + choice: ["rtu", "tcp"] render: | type: abb {{- include "modbus" . }} diff --git a/templates/definition/charger/abl.yaml b/templates/definition/charger/abl.yaml index 9879772c32..fc1d1afb63 100644 --- a/templates/definition/charger/abl.yaml +++ b/templates/definition/charger/abl.yaml @@ -11,7 +11,7 @@ requirements: evcc: ["sponsorship"] params: - name: modbus - choice: ["rs485"] + choice: ["ascii", "tcp"] baudrate: 38400 comset: 8E1 - name: timeout diff --git a/templates/definition/charger/alfen.yaml b/templates/definition/charger/alfen.yaml index b88531ace1..cbb0923a5d 100644 --- a/templates/definition/charger/alfen.yaml +++ b/templates/definition/charger/alfen.yaml @@ -11,7 +11,7 @@ requirements: evcc: ["sponsorship"] params: - name: modbus - choice: ["tcpip"] + choice: ["tcp"] render: | type: alfen {{- include "modbus" . }} diff --git a/templates/definition/charger/alphatec.yaml b/templates/definition/charger/alphatec.yaml index a4e190cdb7..e5eddac4c3 100644 --- a/templates/definition/charger/alphatec.yaml +++ b/templates/definition/charger/alphatec.yaml @@ -7,7 +7,7 @@ requirements: evcc: ["sponsorship"] params: - name: modbus - choice: ["rs485"] + choice: ["rtu"] baudrate: 9600 comset: 8N1 - name: timeout diff --git a/templates/definition/charger/amtron.yaml b/templates/definition/charger/amtron.yaml index 67dbc147b3..cb72678220 100644 --- a/templates/definition/charger/amtron.yaml +++ b/templates/definition/charger/amtron.yaml @@ -7,7 +7,7 @@ requirements: evcc: ["sponsorship"] params: - name: modbus - choice: ["tcpip"] + choice: ["tcp"] id: 255 render: | type: amtron diff --git a/templates/definition/charger/dadapower.yaml b/templates/definition/charger/dadapower.yaml index 24e7b4ea3b..b55fb3e01c 100644 --- a/templates/definition/charger/dadapower.yaml +++ b/templates/definition/charger/dadapower.yaml @@ -6,7 +6,7 @@ products: capabilities: ["1p3p", "mA", "rfid"] params: - name: modbus - choice: ["tcpip"] + choice: ["tcp"] id: 1 render: | type: dadapower diff --git a/templates/definition/charger/em2go.yaml b/templates/definition/charger/em2go.yaml index 37c413e3fa..c6dbb95879 100644 --- a/templates/definition/charger/em2go.yaml +++ b/templates/definition/charger/em2go.yaml @@ -10,7 +10,7 @@ requirements: en: "Recent firmware with Modbus support required (Pro Power: 1.01 and OCPP/ONC: 3.15)" params: - name: modbus - choice: ["tcpip"] + choice: ["tcp"] id: 255 render: | type: em2go diff --git a/templates/definition/charger/evse-din.yaml b/templates/definition/charger/evse-din.yaml index 7a65156496..65eaadac4f 100644 --- a/templates/definition/charger/evse-din.yaml +++ b/templates/definition/charger/evse-din.yaml @@ -9,7 +9,7 @@ products: generic: EVSE DIN params: - name: modbus - choice: ["rs485"] + choice: ["rtu"] baudrate: 9600 comset: 8N1 render: | diff --git a/templates/definition/charger/heidelberg.yaml b/templates/definition/charger/heidelberg.yaml index fffc19a42b..3ccf443f70 100644 --- a/templates/definition/charger/heidelberg.yaml +++ b/templates/definition/charger/heidelberg.yaml @@ -20,7 +20,7 @@ requirements: evcc: ["sponsorship"] params: - name: modbus - choice: ["rs485"] + choice: ["rtu"] baudrate: 19200 comset: 8E1 render: | diff --git a/templates/definition/charger/hesotec.yaml b/templates/definition/charger/hesotec.yaml index 1c73cf687e..5491f439dd 100644 --- a/templates/definition/charger/hesotec.yaml +++ b/templates/definition/charger/hesotec.yaml @@ -7,7 +7,7 @@ requirements: evcc: ["sponsorship"] params: - name: modbus - choice: ["tcpip"] + choice: ["tcp"] render: | type: hesotec {{- include "modbus" . }} diff --git a/templates/definition/charger/icharge-cion.yaml b/templates/definition/charger/icharge-cion.yaml index 89c3d190a4..62183345c6 100644 --- a/templates/definition/charger/icharge-cion.yaml +++ b/templates/definition/charger/icharge-cion.yaml @@ -5,7 +5,7 @@ products: generic: i-CHARGE CION params: - name: modbus - choice: ["tcpip"] + choice: ["tcp"] render: | type: custom status: diff --git a/templates/definition/charger/innogy-ebox.yaml b/templates/definition/charger/innogy-ebox.yaml index f75af06abe..a55dd19ab7 100644 --- a/templates/definition/charger/innogy-ebox.yaml +++ b/templates/definition/charger/innogy-ebox.yaml @@ -14,7 +14,7 @@ requirements: evcc: ["sponsorship"] params: - name: modbus - choice: ["tcpip"] + choice: ["tcp"] render: | type: innogy {{- include "modbus" . }} diff --git a/templates/definition/charger/keba-modbus.yaml b/templates/definition/charger/keba-modbus.yaml index 36fb527b30..7de6a9a644 100644 --- a/templates/definition/charger/keba-modbus.yaml +++ b/templates/definition/charger/keba-modbus.yaml @@ -17,7 +17,7 @@ requirements: en: Requires firmware version 3.10.42 (C-series) bzw. 1.11 (X-series). For phase switching the Keba phase switch (KeContact S10) is also required. params: - name: modbus - choice: ["tcpip"] + choice: ["tcp"] id: 255 render: | type: keba-modbus diff --git a/templates/definition/charger/kse.yaml b/templates/definition/charger/kse.yaml index 38d676c5dc..0a6db359cd 100644 --- a/templates/definition/charger/kse.yaml +++ b/templates/definition/charger/kse.yaml @@ -8,7 +8,7 @@ requirements: evcc: ["sponsorship"] params: - name: modbus - choice: ["rs485"] + choice: ["rtu"] baudrate: 9600 comset: 8E1 id: 100 diff --git a/templates/definition/charger/obo.yaml b/templates/definition/charger/obo.yaml index 0f8863ce30..89c142433d 100644 --- a/templates/definition/charger/obo.yaml +++ b/templates/definition/charger/obo.yaml @@ -5,7 +5,7 @@ products: generic: Ion params: - name: modbus - choice: ["rs485", "tcpip"] + choice: ["rtu"] baudrate: 19200 comset: 8E1 id: 101 diff --git a/templates/definition/charger/phoenix-ev-ser.yaml b/templates/definition/charger/phoenix-ev-ser.yaml index 388d9920a4..1d33bff6b2 100644 --- a/templates/definition/charger/phoenix-ev-ser.yaml +++ b/templates/definition/charger/phoenix-ev-ser.yaml @@ -5,7 +5,7 @@ products: generic: EV-SER (Modbus RTU) params: - name: modbus - choice: ["rs485"] + choice: ["rtu"] render: | type: phoenix-ev-ser {{- include "modbus" . }} diff --git a/templates/definition/charger/pracht-alpha.yaml b/templates/definition/charger/pracht-alpha.yaml index 5f4078ccb8..e4364b548a 100644 --- a/templates/definition/charger/pracht-alpha.yaml +++ b/templates/definition/charger/pracht-alpha.yaml @@ -7,7 +7,7 @@ requirements: evcc: ["sponsorship"] params: - name: modbus - choice: ["rs485", "tcpip"] + choice: ["rtu", "tcp"] baudrate: 9600 comset: 8N1 id: 1 diff --git a/templates/definition/charger/versicharge.yaml b/templates/definition/charger/versicharge.yaml index 2100ae8614..911bcb4159 100644 --- a/templates/definition/charger/versicharge.yaml +++ b/templates/definition/charger/versicharge.yaml @@ -10,7 +10,7 @@ requirements: en: Requires firmware >= 2.121.5 params: - name: modbus - choice: ["tcpip"] + choice: ["tcp"] id: 2 render: | type: versicharge diff --git a/templates/definition/charger/vestel.yaml b/templates/definition/charger/vestel.yaml index 8b4fcdef10..d1c2b1a4f0 100644 --- a/templates/definition/charger/vestel.yaml +++ b/templates/definition/charger/vestel.yaml @@ -14,7 +14,7 @@ requirements: evcc: ["sponsorship"] params: - name: modbus - choice: ["tcpip"] + choice: ["tcp"] id: 255 render: | type: vestel diff --git a/templates/definition/common-schema.json b/templates/definition/common-schema.json index d2de2fe315..45a000b55a 100644 --- a/templates/definition/common-schema.json +++ b/templates/definition/common-schema.json @@ -124,8 +124,9 @@ "items": { "type": "string", "enum": [ - "tcpip", - "rs485" + "tcp", + "rtu", + "ascii" ] } }, diff --git a/templates/definition/meter/abb-ab.yaml b/templates/definition/meter/abb-ab.yaml index e6602dcdbe..cbeee76a80 100644 --- a/templates/definition/meter/abb-ab.yaml +++ b/templates/definition/meter/abb-ab.yaml @@ -7,7 +7,7 @@ params: - name: usage choice: ["grid", "charge"] - name: modbus - choice: ["rs485"] + choice: ["rtu"] render: | type: modbus model: abb diff --git a/templates/definition/meter/alpha-ess-smile.yaml b/templates/definition/meter/alpha-ess-smile.yaml index 4a81d6ded7..afa083034f 100644 --- a/templates/definition/meter/alpha-ess-smile.yaml +++ b/templates/definition/meter/alpha-ess-smile.yaml @@ -8,7 +8,7 @@ params: choice: ["grid", "pv", "battery"] allinone: true - name: modbus - choice: ["rs485", "tcpip"] + choice: ["rtu", "tcp"] baudrate: 9600 id: 85 - name: capacity diff --git a/templates/definition/meter/be-mpm3pm.yaml b/templates/definition/meter/be-mpm3pm.yaml index 6706b42d50..a71e6aa752 100644 --- a/templates/definition/meter/be-mpm3pm.yaml +++ b/templates/definition/meter/be-mpm3pm.yaml @@ -7,7 +7,7 @@ params: - name: usage choice: ["grid", "charge"] - name: modbus - choice: ["rs485"] + choice: ["rtu"] render: | type: modbus {{- include "modbus" . }} diff --git a/templates/definition/meter/cfos.yaml b/templates/definition/meter/cfos.yaml index 00262c5be0..775f3f4bfb 100644 --- a/templates/definition/meter/cfos.yaml +++ b/templates/definition/meter/cfos.yaml @@ -9,7 +9,7 @@ params: - name: usage choice: ["charge"] - name: modbus - choice: ["tcpip"] + choice: ["tcp"] port: 4702 id: 2 render: | diff --git a/templates/definition/meter/cg-em24.yaml b/templates/definition/meter/cg-em24.yaml index 642d41b9a4..87ae96d7b3 100644 --- a/templates/definition/meter/cg-em24.yaml +++ b/templates/definition/meter/cg-em24.yaml @@ -7,7 +7,7 @@ params: - name: usage choice: ["grid", "charge"] - name: modbus - choice: ["rs485", "tcpip"] + choice: ["rtu", "tcp"] render: | type: modbus {{- include "modbus" . }} diff --git a/templates/definition/meter/cg-emt3xx.yaml b/templates/definition/meter/cg-emt3xx.yaml index 2a77be6a93..0f0dc93515 100644 --- a/templates/definition/meter/cg-emt3xx.yaml +++ b/templates/definition/meter/cg-emt3xx.yaml @@ -7,7 +7,7 @@ params: - name: usage choice: ["grid", "charge"] - name: modbus - choice: ["rs485", "tcpip"] + choice: ["rtu", "tcp"] render: | type: modbus {{- include "modbus" . }} diff --git a/templates/definition/meter/deye-hybrid.yaml b/templates/definition/meter/deye-hybrid.yaml index d5fdffd1cf..43cf80ec1e 100644 --- a/templates/definition/meter/deye-hybrid.yaml +++ b/templates/definition/meter/deye-hybrid.yaml @@ -11,7 +11,7 @@ params: choice: ["grid", "pv", "battery"] allinone: true - name: modbus - choice: ["rs485", "tcpip"] + choice: ["rtu", "tcp"] baudrate: 9600 id: 1 - name: capacity diff --git a/templates/definition/meter/dzg.yaml b/templates/definition/meter/dzg.yaml index a80e27e96b..0fdc837026 100644 --- a/templates/definition/meter/dzg.yaml +++ b/templates/definition/meter/dzg.yaml @@ -7,7 +7,7 @@ params: - name: usage choice: ["charge"] - name: modbus - choice: ["rs485"] + choice: ["rtu"] render: | type: modbus model: dzg diff --git a/templates/definition/meter/eastron-sdm120.yaml b/templates/definition/meter/eastron-sdm120.yaml index 9050b02d23..c5bdd9a9db 100644 --- a/templates/definition/meter/eastron-sdm120.yaml +++ b/templates/definition/meter/eastron-sdm120.yaml @@ -7,7 +7,7 @@ params: - name: usage choice: ["grid", "charge"] - name: modbus - choice: ["rs485"] + choice: ["rtu"] render: | type: modbus {{- include "modbus" . }} diff --git a/templates/definition/meter/eastron-sdm220_230.yaml b/templates/definition/meter/eastron-sdm220_230.yaml index d3d79cfce4..3bf7d39625 100644 --- a/templates/definition/meter/eastron-sdm220_230.yaml +++ b/templates/definition/meter/eastron-sdm220_230.yaml @@ -7,7 +7,7 @@ params: - name: usage choice: ["grid", "charge"] - name: modbus - choice: ["rs485"] + choice: ["rtu"] render: | type: modbus {{- include "modbus" . }} diff --git a/templates/definition/meter/eastron-sdm72.yaml b/templates/definition/meter/eastron-sdm72.yaml index e46c1bb10e..1a7289c5e4 100644 --- a/templates/definition/meter/eastron-sdm72.yaml +++ b/templates/definition/meter/eastron-sdm72.yaml @@ -7,7 +7,7 @@ params: - name: usage choice: ["grid", "charge"] - name: modbus - choice: ["rs485"] + choice: ["rtu"] render: | type: modbus {{- include "modbus" . }} diff --git a/templates/definition/meter/eastron-sdm72v2_630.yaml b/templates/definition/meter/eastron-sdm72v2_630.yaml index 9a1b80b1b9..817e25f427 100644 --- a/templates/definition/meter/eastron-sdm72v2_630.yaml +++ b/templates/definition/meter/eastron-sdm72v2_630.yaml @@ -10,7 +10,7 @@ params: - name: usage choice: ["grid", "charge"] - name: modbus - choice: ["rs485"] + choice: ["rtu"] render: | type: modbus {{- include "modbus" . }} diff --git a/templates/definition/meter/fox-ess-h1.yaml b/templates/definition/meter/fox-ess-h1.yaml index a8bd78c4db..80d47b673d 100644 --- a/templates/definition/meter/fox-ess-h1.yaml +++ b/templates/definition/meter/fox-ess-h1.yaml @@ -8,8 +8,7 @@ params: - name: usage choice: ["pv", "battery"] - name: modbus - choice: ["rs485", "tcpip"] - id: 247 + choice: ["tcp"] render: | type: custom {{- if eq .usage "pv" }} diff --git a/templates/definition/meter/fox-ess-h3.yaml b/templates/definition/meter/fox-ess-h3.yaml index 48a7313e96..7d34c511b0 100644 --- a/templates/definition/meter/fox-ess-h3.yaml +++ b/templates/definition/meter/fox-ess-h3.yaml @@ -7,8 +7,7 @@ params: - name: usage choice: ["grid", "pv", "battery"] - name: modbus - choice: ["rs485", "tcpip"] - id: 247 + choice: ["tcp"] render: | type: custom {{- if eq .usage "grid" }} diff --git a/templates/definition/meter/fox-ess-rs485.yaml b/templates/definition/meter/fox-ess-rs485.yaml new file mode 100644 index 0000000000..eb9019727d --- /dev/null +++ b/templates/definition/meter/fox-ess-rs485.yaml @@ -0,0 +1,59 @@ +template: fox-ess-rs485 +products: + - brand: FoxESS + description: + generic: FoxESS via RS485 Modbus +params: + - name: usage + choice: ["grid", "pv", "battery"] + - name: modbus + choice: ["rtu"] +render: | + type: custom + {{- if eq .usage "grid" }} + power: + source: modbus + {{- include "modbus" . | indent 2 }} + # register details + register: + address: 11021 # Grid power + type: holding + decode: int16 + {{- end }} + {{- if eq .usage "pv" }} + power: + source: calc + add: + - source: modbus + {{- include "modbus" . | indent 4 }} + # register details + register: + address: 11002 # PV1 + type: holding + decode: int16 + - source: modbus + {{- include "modbus" . | indent 4 }} + # register details + register: + address: 11005 # PV2 + type: holding + decode: int16 + {{- end }} + {{- if eq .usage "battery" }} + power: + source: modbus + {{- include "modbus" . | indent 2 }} + # register details + register: + address: 11008 # Battery Charge/Discharge + type: holding + decode: int16 + soc: + source: modbus + {{- include "modbus" . | indent 2 }} + # register details + register: + address: 11036 # Soc + type: holding + decode: int16 + {{- end }} diff --git a/templates/definition/meter/goodwe-hybrid.yaml b/templates/definition/meter/goodwe-hybrid.yaml index 8804b3f6b1..1c8108383a 100644 --- a/templates/definition/meter/goodwe-hybrid.yaml +++ b/templates/definition/meter/goodwe-hybrid.yaml @@ -7,7 +7,7 @@ params: - name: usage choice: ["grid", "pv", "battery"] - name: modbus - choice: ["rs485", "tcpip"] + choice: ["rtu", "tcp"] baudrate: 9600 id: 247 - name: capacity diff --git a/templates/definition/meter/growatt-hybrid-tlxh.yaml b/templates/definition/meter/growatt-hybrid-tlxh.yaml index 71bc44c56e..2de0e31eb8 100644 --- a/templates/definition/meter/growatt-hybrid-tlxh.yaml +++ b/templates/definition/meter/growatt-hybrid-tlxh.yaml @@ -7,7 +7,7 @@ params: - name: usage choice: ["grid", "pv", "battery"] - name: modbus - choice: ["rs485", "tcpip"] + choice: ["rtu", "tcp"] baudrate: 9600 id: 1 - name: capacity diff --git a/templates/definition/meter/growatt-hybrid.yaml b/templates/definition/meter/growatt-hybrid.yaml index 421776829f..5dbb39e86e 100644 --- a/templates/definition/meter/growatt-hybrid.yaml +++ b/templates/definition/meter/growatt-hybrid.yaml @@ -7,7 +7,7 @@ params: - name: usage choice: ["grid", "pv", "battery"] - name: modbus - choice: ["rs485", "tcpip"] + choice: ["rtu", "tcp"] baudrate: 9600 id: 1 - name: capacity diff --git a/templates/definition/meter/huawei-sun2000-dongle-powersensor.yaml b/templates/definition/meter/huawei-sun2000-dongle-powersensor.yaml index 69df646ab1..721d29b6eb 100644 --- a/templates/definition/meter/huawei-sun2000-dongle-powersensor.yaml +++ b/templates/definition/meter/huawei-sun2000-dongle-powersensor.yaml @@ -12,7 +12,7 @@ params: default: 1 advanced: true - name: modbus - choice: ["tcpip"] + choice: ["tcp"] - name: timeout default: 15s - name: capacity diff --git a/templates/definition/meter/huawei-sun2000-dongle.yaml b/templates/definition/meter/huawei-sun2000-dongle.yaml index f4fe7b12e5..d057c07aa7 100644 --- a/templates/definition/meter/huawei-sun2000-dongle.yaml +++ b/templates/definition/meter/huawei-sun2000-dongle.yaml @@ -7,7 +7,7 @@ params: - name: usage choice: ["pv"] - name: modbus - choice: ["tcpip"] + choice: ["tcp"] - name: timeout default: 15s render: | diff --git a/templates/definition/meter/huawei-sun2000-rs485.yaml b/templates/definition/meter/huawei-sun2000-rs485.yaml index e3b31fbf43..0a17282a67 100644 --- a/templates/definition/meter/huawei-sun2000-rs485.yaml +++ b/templates/definition/meter/huawei-sun2000-rs485.yaml @@ -9,7 +9,7 @@ params: - name: usage choice: ["grid", "pv", "battery"] - name: modbus - choice: ["rs485", "tcpip"] + choice: ["rtu"] baudrate: 9600 - name: storageunit type: number diff --git a/templates/definition/meter/inepro.yaml b/templates/definition/meter/inepro.yaml index d1fdf1d8c0..670c218fd3 100644 --- a/templates/definition/meter/inepro.yaml +++ b/templates/definition/meter/inepro.yaml @@ -7,7 +7,7 @@ params: - name: usage choice: ["grid", "charge"] - name: modbus - choice: ["rs485"] + choice: ["rtu"] render: | type: modbus {{- include "modbus" . }} diff --git a/templates/definition/meter/janitza.yaml b/templates/definition/meter/janitza.yaml index b163d9cfe0..571756a060 100644 --- a/templates/definition/meter/janitza.yaml +++ b/templates/definition/meter/janitza.yaml @@ -7,7 +7,7 @@ params: - name: usage choice: ["grid", "charge"] - name: modbus - choice: ["rs485", "tcpip"] + choice: ["rtu", "tcp"] render: | type: modbus {{- include "modbus" . }} diff --git a/templates/definition/meter/kostal-ksem-inverter.yaml b/templates/definition/meter/kostal-ksem-inverter.yaml index 3ed7bffc2d..f106710d36 100644 --- a/templates/definition/meter/kostal-ksem-inverter.yaml +++ b/templates/definition/meter/kostal-ksem-inverter.yaml @@ -12,7 +12,7 @@ params: - name: usage choice: ["grid"] - name: modbus - choice: ["tcpip"] + choice: ["tcp"] port: 1502 id: 71 render: | diff --git a/templates/definition/meter/kostal-ksem.yaml b/templates/definition/meter/kostal-ksem.yaml index 7aa554b3ab..2df93bb546 100644 --- a/templates/definition/meter/kostal-ksem.yaml +++ b/templates/definition/meter/kostal-ksem.yaml @@ -7,7 +7,7 @@ params: - name: usage choice: ["grid"] - name: modbus - choice: ["tcpip"] + choice: ["tcp"] id: 71 render: | type: modbus diff --git a/templates/definition/meter/kostal-plenticore.yaml b/templates/definition/meter/kostal-plenticore.yaml index a8c1baa6e4..e107583faf 100644 --- a/templates/definition/meter/kostal-plenticore.yaml +++ b/templates/definition/meter/kostal-plenticore.yaml @@ -14,7 +14,7 @@ params: choice: ["pv", "battery"] allinone: true - name: modbus - choice: ["tcpip"] + choice: ["tcp"] id: 71 port: 1502 - name: capacity diff --git a/templates/definition/meter/mypv-wifi-meter.yaml b/templates/definition/meter/mypv-wifi-meter.yaml index 9100f7ed7d..42f82b0983 100644 --- a/templates/definition/meter/mypv-wifi-meter.yaml +++ b/templates/definition/meter/mypv-wifi-meter.yaml @@ -7,7 +7,7 @@ params: - name: usage choice: ["grid"] - name: modbus - choice: ["tcpip"] + choice: ["tcp"] port: 502 id: 1 render: | diff --git a/templates/definition/meter/orno.yaml b/templates/definition/meter/orno.yaml index feee0d79e0..142dba127b 100644 --- a/templates/definition/meter/orno.yaml +++ b/templates/definition/meter/orno.yaml @@ -7,7 +7,7 @@ params: - name: usage choice: ["grid", "charge"] - name: modbus - choice: ["rs485"] + choice: ["rtu"] render: | type: modbus {{- include "modbus" . }} diff --git a/templates/definition/meter/powerdog.yaml b/templates/definition/meter/powerdog.yaml index 78a7079128..948dcf0e8b 100644 --- a/templates/definition/meter/powerdog.yaml +++ b/templates/definition/meter/powerdog.yaml @@ -7,7 +7,7 @@ params: choice: ["grid", "pv"] allinone: true - name: modbus - choice: ["tcpip"] + choice: ["tcp"] render: | type: custom power: diff --git a/templates/definition/meter/sax.yaml b/templates/definition/meter/sax.yaml index e6f994e577..ddd4eac038 100644 --- a/templates/definition/meter/sax.yaml +++ b/templates/definition/meter/sax.yaml @@ -7,7 +7,7 @@ params: - name: usage choice: ["grid", "battery"] - name: modbus - choice: ["tcpip"] + choice: ["tcp"] port: 3600 id: 64 render: | diff --git a/templates/definition/meter/sbc-axx3.yaml b/templates/definition/meter/sbc-axx3.yaml index 5334b5bba2..5da31127e4 100644 --- a/templates/definition/meter/sbc-axx3.yaml +++ b/templates/definition/meter/sbc-axx3.yaml @@ -7,7 +7,7 @@ params: - name: usage choice: ["grid", "charge"] - name: modbus - choice: ["rs485"] + choice: ["rtu"] render: | type: modbus {{- include "modbus" . }} diff --git a/templates/definition/meter/schneider-iem3000.yaml b/templates/definition/meter/schneider-iem3000.yaml index 461a7e8c30..161fa0dcda 100644 --- a/templates/definition/meter/schneider-iem3000.yaml +++ b/templates/definition/meter/schneider-iem3000.yaml @@ -7,7 +7,7 @@ params: - name: usage choice: ["grid", "charge"] - name: modbus - choice: ["rs485"] + choice: ["rtu"] render: | type: modbus {{- include "modbus" . }} diff --git a/templates/definition/meter/senergy.yaml b/templates/definition/meter/senergy.yaml index 4df2617c83..8320099176 100644 --- a/templates/definition/meter/senergy.yaml +++ b/templates/definition/meter/senergy.yaml @@ -10,7 +10,7 @@ params: - name: usage choice: ["pv"] - name: modbus - choice: ["tcpip"] + choice: ["tcp"] id: 1 render: | type: custom diff --git a/templates/definition/meter/siemens-7kt1665.yaml b/templates/definition/meter/siemens-7kt1665.yaml index 665765f524..df334b18ad 100644 --- a/templates/definition/meter/siemens-7kt1665.yaml +++ b/templates/definition/meter/siemens-7kt1665.yaml @@ -7,7 +7,7 @@ params: - name: usage choice: ["grid", "charge"] - name: modbus - choice: ["rs485", "tcpip"] + choice: ["rtu", "tcp"] render: | type: custom power: diff --git a/templates/definition/meter/siemens-pac2200.yaml b/templates/definition/meter/siemens-pac2200.yaml index c2a86b87c4..01a7012fb7 100644 --- a/templates/definition/meter/siemens-pac2200.yaml +++ b/templates/definition/meter/siemens-pac2200.yaml @@ -7,7 +7,7 @@ params: - name: usage choice: ["grid", "charge"] - name: modbus - choice: ["rs485", "tcpip"] + choice: ["rtu", "tcp"] render: | type: modbus model: pac2200 diff --git a/templates/definition/meter/sma-hybrid.yaml b/templates/definition/meter/sma-hybrid.yaml index c0f153cffa..b37d145bb5 100644 --- a/templates/definition/meter/sma-hybrid.yaml +++ b/templates/definition/meter/sma-hybrid.yaml @@ -9,7 +9,7 @@ params: choice: ["pv", "battery"] allinone: true - name: modbus - choice: ["tcpip"] + choice: ["tcp"] port: 502 id: 3 help: diff --git a/templates/definition/meter/sma-webbox.yaml b/templates/definition/meter/sma-webbox.yaml index 409334b52a..980ce51302 100644 --- a/templates/definition/meter/sma-webbox.yaml +++ b/templates/definition/meter/sma-webbox.yaml @@ -8,7 +8,7 @@ params: choice: ["pv"] allinone: true - name: modbus - choice: ["tcpip"] + choice: ["tcp"] port: 502 id: 2 help: diff --git a/templates/definition/meter/sofarsolar-g3.yaml b/templates/definition/meter/sofarsolar-g3.yaml index a0131648bf..49d7613ae5 100644 --- a/templates/definition/meter/sofarsolar-g3.yaml +++ b/templates/definition/meter/sofarsolar-g3.yaml @@ -16,7 +16,7 @@ params: - name: usage choice: ["grid", "pv", "battery"] - name: modbus - choice: ["rs485", "tcpip"] + choice: ["rtu", "tcp"] baudrate: 9600 comset: 8N1 port: 502 diff --git a/templates/definition/meter/sofarsolar.yaml b/templates/definition/meter/sofarsolar.yaml index 62b574261e..317fbc4b12 100644 --- a/templates/definition/meter/sofarsolar.yaml +++ b/templates/definition/meter/sofarsolar.yaml @@ -10,7 +10,7 @@ params: - name: usage choice: ["grid", "pv", "battery"] - name: modbus - choice: ["rs485", "tcpip"] + choice: ["rtu", "tcp"] baudrate: 9600 comset: 8N1 port: 502 diff --git a/templates/definition/meter/solaredge-hybrid.yaml b/templates/definition/meter/solaredge-hybrid.yaml index 871f1219fd..fe5092e585 100644 --- a/templates/definition/meter/solaredge-hybrid.yaml +++ b/templates/definition/meter/solaredge-hybrid.yaml @@ -12,7 +12,7 @@ params: choice: ["grid", "pv", "battery"] allinone: true - name: modbus - choice: ["tcpip", "rs485"] + choice: ["tcp", "rtu"] id: 1 port: 1502 - name: timeout diff --git a/templates/definition/meter/solaredge-inverter.yaml b/templates/definition/meter/solaredge-inverter.yaml index 95589c5875..e2ecc772b7 100644 --- a/templates/definition/meter/solaredge-inverter.yaml +++ b/templates/definition/meter/solaredge-inverter.yaml @@ -13,7 +13,7 @@ params: choice: ["grid", "pv"] allinone: true - name: modbus - choice: ["tcpip", "rs485"] + choice: ["tcp", "rtu"] id: 1 port: 1502 - name: timeout diff --git a/templates/definition/meter/solarmax-maxstorage.yaml b/templates/definition/meter/solarmax-maxstorage.yaml index dcee662140..a74d9e4d22 100644 --- a/templates/definition/meter/solarmax-maxstorage.yaml +++ b/templates/definition/meter/solarmax-maxstorage.yaml @@ -8,7 +8,7 @@ params: choice: ["grid", "pv", "battery"] allinone: true - name: modbus - choice: ["tcpip"] + choice: ["tcp"] id: 1 - name: capacity advanced: true diff --git a/templates/definition/meter/solax.yaml b/templates/definition/meter/solax.yaml index cc833a6da9..7d0a90768c 100644 --- a/templates/definition/meter/solax.yaml +++ b/templates/definition/meter/solax.yaml @@ -12,7 +12,7 @@ params: choice: ["grid", "pv", "battery"] allinone: true - name: modbus - choice: ["rs485", "tcpip"] + choice: ["rtu", "tcp"] baudrate: 19200 - name: capacity advanced: true diff --git a/templates/definition/meter/sungrow-hybrid.yaml b/templates/definition/meter/sungrow-hybrid.yaml index 756b43ce34..e7a4bf7178 100644 --- a/templates/definition/meter/sungrow-hybrid.yaml +++ b/templates/definition/meter/sungrow-hybrid.yaml @@ -13,7 +13,7 @@ params: choice: ["grid", "pv", "battery"] allinone: true - name: modbus - choice: ["rs485", "tcpip"] + choice: ["rtu", "tcp"] baudrate: 9600 - name: capacity advanced: true diff --git a/templates/definition/meter/sungrow-inverter.yaml b/templates/definition/meter/sungrow-inverter.yaml index df452681fe..23161c53b4 100644 --- a/templates/definition/meter/sungrow-inverter.yaml +++ b/templates/definition/meter/sungrow-inverter.yaml @@ -8,7 +8,7 @@ params: choice: ["grid", "pv"] allinone: true - name: modbus - choice: ["rs485", "tcpip"] + choice: ["rtu", "tcp"] baudrate: 9600 render: | type: custom diff --git a/templates/definition/meter/sunspec-hybrid.yaml b/templates/definition/meter/sunspec-hybrid.yaml index beb3abb3ef..1b321b8227 100644 --- a/templates/definition/meter/sunspec-hybrid.yaml +++ b/templates/definition/meter/sunspec-hybrid.yaml @@ -10,7 +10,7 @@ params: choice: ["grid", "pv", "battery"] allinone: true - name: modbus - choice: ["tcpip", "rs485"] + choice: ["tcp", "rtu"] - name: integer description: de: Integer Registerzugriff (nur für Netzzähler) diff --git a/templates/definition/meter/sunspec-inverter.yaml b/templates/definition/meter/sunspec-inverter.yaml index acfa63849c..a3c3701a98 100644 --- a/templates/definition/meter/sunspec-inverter.yaml +++ b/templates/definition/meter/sunspec-inverter.yaml @@ -8,7 +8,7 @@ params: - name: usage choice: ["grid", "pv", "battery"] - name: modbus - choice: ["tcpip", "rs485"] + choice: ["tcp", "rtu"] - name: integer description: de: Integer Registerzugriff (nur für Netzzähler) diff --git a/util/templates/defaults.yaml b/util/templates/defaults.yaml index b6f58803af..de01432743 100644 --- a/util/templates/defaults.yaml +++ b/util/templates/defaults.yaml @@ -16,8 +16,8 @@ params: de: Gerätename en: Device name help: - de: USB-RS485 Gerätename - en: USB-RS485 device name + de: Gerätename der lokalen seriellen Schnittstelle + en: Device name of local serial port interface example: /dev/ttyUSB0 - name: modbusbaudrate description: @@ -398,8 +398,9 @@ presets: modbus: interfaces: - rs485: ["rtuserial", "rtutcp", "tcp"] - ethernet: ["tcp"] + tcp: ["tcp"] + rtu: ["rtuserial", "rtutcp", "tcp"] + ascii: ["asciiserial", "asciitcp"] types: rtuserial: description: diff --git a/util/templates/documentation_modbus.tpl b/util/templates/documentation_modbus.tpl index 4f5c70bc17..2b81b1c57f 100644 --- a/util/templates/documentation_modbus.tpl +++ b/util/templates/documentation_modbus.tpl @@ -1,7 +1,7 @@ {{- if .rtuserial }} -# Attached on local serial port (Modbus RTU) -modbus: rtu +# Attached to local serial interface (Modbus RTU) +modbus: rtuserial id: {{ .id }} device: {{ .device }} # Geräteadresse, typische Werte sind /dev/ttyUSB0, /dev/ttyAMA0, /dev/ttyS0 oder COM3 baudrate: {{ .baudrate }} # Baudrate, typische Werte sind 9600, 19200, 38400, 57600, 115200 @@ -10,7 +10,24 @@ comset: {{ .comset }} # Parität, Datenbits, Stoppbits, typische Werte sind 8N1, {{- if .rtutcp }} # Attached to transparent serial device server (Modbus RTU over TCP/IP) -modbus: rtu-over-tcp +modbus: rtutcp +id: {{ .id }} +host: {{ .host }} # Hostname +port: {{ .port }} # Port +{{- end }} +{{- if .asciiserial }} + +# Attached to local serial interface (Modbus ASCII) +modbus: asciiserial +id: {{ .id }} +device: {{ .device }} # Geräteadresse, typische Werte sind /dev/ttyUSB0, /dev/ttyAMA0, /dev/ttyS0 oder COM3 +baudrate: {{ .baudrate }} # Baudrate, typische Werte sind 9600, 19200, 38400, 57600, 115200 +comset: {{ .comset }} # Parität, Datenbits, Stoppbits, typische Werte sind 8N1, 8E1, 8O1 +{{- end }} +{{- if .asciitcp }} + +# Attached to transparent serial device server (Modbus ASCII over TCP/IP) +modbus: asciitcp id: {{ .id }} host: {{ .host }} # Hostname port: {{ .port }} # Port diff --git a/util/templates/modbus.tpl b/util/templates/modbus.tpl index 36ebb85aa2..5dd7d4e169 100644 --- a/util/templates/modbus.tpl +++ b/util/templates/modbus.tpl @@ -1,20 +1,22 @@ {{- define "modbus" }} id: {{ .id }} -{{- if or (eq .modbus "rs485serial") (eq .modbus "rtuserial") }} -# Attached on local serial port (Modbus RTU) +{{- if or (eq .modbus "rs485serial") (eq .modbus "rtuserial") (eq .modbus "asciiserial") }} +# Serial interface (Modbus RTU/ASCII) device: {{ .device }} baudrate: {{ .baudrate }} comset: "{{ .comset }}" {{- else if or (eq .modbus "rs485tcpip") (eq .modbus "rtutcp") }} -# Attached to transparent serial device gateway server (Modbus RTU over TCP/IP) +# Modbus RTU via TCP/IP uri: {{ .host }}:{{ .port }} rtu: true +{{- else if or (eq .modbus "asciitcp") }} +# Modbus ASCII via TCP/IP +uri: {{ .host }}:{{ .port }} {{- else if or (eq .modbus "tcpip") (eq .modbus "tcp") }} -# Modbus TCP (native interface or translated serial device) +# Modbus TCP uri: {{ .host }}:{{ .port }} -rtu: false {{- else }} # configuration error - should not happen modbusConnectionTypeNotDefined: {{ .modbus }} {{- end }} -{{- end }} +{{- end }} \ No newline at end of file From 4c029299fe68fe40af9731bdf27e0c4bff2c66fc Mon Sep 17 00:00:00 2001 From: premultiply <4681172+premultiply@users.noreply.github.com> Date: Sun, 25 Jun 2023 12:14:55 +0000 Subject: [PATCH 12/29] wip --- templates/definition/charger/abl.yaml | 2 +- util/templates/documentation_modbus.tpl | 8 ++++---- util/templates/modbus.tpl | 10 +++++----- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/templates/definition/charger/abl.yaml b/templates/definition/charger/abl.yaml index fc1d1afb63..cfab96818e 100644 --- a/templates/definition/charger/abl.yaml +++ b/templates/definition/charger/abl.yaml @@ -11,7 +11,7 @@ requirements: evcc: ["sponsorship"] params: - name: modbus - choice: ["ascii", "tcp"] + choice: ["ascii"] baudrate: 38400 comset: 8E1 - name: timeout diff --git a/util/templates/documentation_modbus.tpl b/util/templates/documentation_modbus.tpl index 2b81b1c57f..c7a8bc685c 100644 --- a/util/templates/documentation_modbus.tpl +++ b/util/templates/documentation_modbus.tpl @@ -1,7 +1,7 @@ {{- if .rtuserial }} # Attached to local serial interface (Modbus RTU) -modbus: rtuserial +modbus: rtu id: {{ .id }} device: {{ .device }} # Geräteadresse, typische Werte sind /dev/ttyUSB0, /dev/ttyAMA0, /dev/ttyS0 oder COM3 baudrate: {{ .baudrate }} # Baudrate, typische Werte sind 9600, 19200, 38400, 57600, 115200 @@ -10,7 +10,7 @@ comset: {{ .comset }} # Parität, Datenbits, Stoppbits, typische Werte sind 8N1, {{- if .rtutcp }} # Attached to transparent serial device server (Modbus RTU over TCP/IP) -modbus: rtutcp +modbus: rtu-over-tcpip id: {{ .id }} host: {{ .host }} # Hostname port: {{ .port }} # Port @@ -18,7 +18,7 @@ port: {{ .port }} # Port {{- if .asciiserial }} # Attached to local serial interface (Modbus ASCII) -modbus: asciiserial +modbus: ascii id: {{ .id }} device: {{ .device }} # Geräteadresse, typische Werte sind /dev/ttyUSB0, /dev/ttyAMA0, /dev/ttyS0 oder COM3 baudrate: {{ .baudrate }} # Baudrate, typische Werte sind 9600, 19200, 38400, 57600, 115200 @@ -27,7 +27,7 @@ comset: {{ .comset }} # Parität, Datenbits, Stoppbits, typische Werte sind 8N1, {{- if .asciitcp }} # Attached to transparent serial device server (Modbus ASCII over TCP/IP) -modbus: asciitcp +modbus: ascii-over-tcpip id: {{ .id }} host: {{ .host }} # Hostname port: {{ .port }} # Port diff --git a/util/templates/modbus.tpl b/util/templates/modbus.tpl index 5dd7d4e169..aebac291a0 100644 --- a/util/templates/modbus.tpl +++ b/util/templates/modbus.tpl @@ -1,16 +1,16 @@ {{- define "modbus" }} id: {{ .id }} -{{- if or (eq .modbus "rs485serial") (eq .modbus "rtuserial") (eq .modbus "asciiserial") }} +{{- if or (eq .modbus "rs485serial") (eq .modbus "rtu") (eq .modbus "ascii") }} # Serial interface (Modbus RTU/ASCII) device: {{ .device }} baudrate: {{ .baudrate }} comset: "{{ .comset }}" -{{- else if or (eq .modbus "rs485tcpip") (eq .modbus "rtutcp") }} -# Modbus RTU via TCP/IP +{{- else if or (eq .modbus "rs485tcpip") (eq .modbus "rtu-over-tcpip") }} +# Modbus RTU over TCP/IP uri: {{ .host }}:{{ .port }} rtu: true -{{- else if or (eq .modbus "asciitcp") }} -# Modbus ASCII via TCP/IP +{{- else if or (eq .modbus "ascii-over-tcpip") }} +# Modbus ASCII over TCP/IP uri: {{ .host }}:{{ .port }} {{- else if or (eq .modbus "tcpip") (eq .modbus "tcp") }} # Modbus TCP From 48b85bbe93d532c98fb779b86779bdbe672d300d Mon Sep 17 00:00:00 2001 From: premultiply <4681172+premultiply@users.noreply.github.com> Date: Sun, 25 Jun 2023 12:24:58 +0000 Subject: [PATCH 13/29] wip --- util/templates/documentation_modbus.tpl | 10 +++++----- util/templates/modbus.tpl | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/util/templates/documentation_modbus.tpl b/util/templates/documentation_modbus.tpl index c7a8bc685c..60388eb98f 100644 --- a/util/templates/documentation_modbus.tpl +++ b/util/templates/documentation_modbus.tpl @@ -3,7 +3,7 @@ # Attached to local serial interface (Modbus RTU) modbus: rtu id: {{ .id }} -device: {{ .device }} # Geräteadresse, typische Werte sind /dev/ttyUSB0, /dev/ttyAMA0, /dev/ttyS0 oder COM3 +device: {{ .device }} # Schnittstellenname, typische Werte sind /dev/ttyUSB0, /dev/ttyAMA0, /dev/ttyS0 oder COM3 baudrate: {{ .baudrate }} # Baudrate, typische Werte sind 9600, 19200, 38400, 57600, 115200 comset: {{ .comset }} # Parität, Datenbits, Stoppbits, typische Werte sind 8N1, 8E1, 8O1 {{- end }} @@ -12,7 +12,7 @@ comset: {{ .comset }} # Parität, Datenbits, Stoppbits, typische Werte sind 8N1, # Attached to transparent serial device server (Modbus RTU over TCP/IP) modbus: rtu-over-tcpip id: {{ .id }} -host: {{ .host }} # Hostname +host: {{ .host }} # Hostname / IP-Adresse port: {{ .port }} # Port {{- end }} {{- if .asciiserial }} @@ -20,7 +20,7 @@ port: {{ .port }} # Port # Attached to local serial interface (Modbus ASCII) modbus: ascii id: {{ .id }} -device: {{ .device }} # Geräteadresse, typische Werte sind /dev/ttyUSB0, /dev/ttyAMA0, /dev/ttyS0 oder COM3 +device: {{ .device }} # Schnittstellenname, typische Werte sind /dev/ttyUSB0, /dev/ttyAMA0, /dev/ttyS0 oder COM3 baudrate: {{ .baudrate }} # Baudrate, typische Werte sind 9600, 19200, 38400, 57600, 115200 comset: {{ .comset }} # Parität, Datenbits, Stoppbits, typische Werte sind 8N1, 8E1, 8O1 {{- end }} @@ -29,7 +29,7 @@ comset: {{ .comset }} # Parität, Datenbits, Stoppbits, typische Werte sind 8N1, # Attached to transparent serial device server (Modbus ASCII over TCP/IP) modbus: ascii-over-tcpip id: {{ .id }} -host: {{ .host }} # Hostname +host: {{ .host }} # Hostname / IP-Adresse port: {{ .port }} # Port {{- end }} {{- if .tcp }} @@ -37,6 +37,6 @@ port: {{ .port }} # Port # Modbus TCP modbus: tcp id: {{ .id }} -host: {{ .host }} # Hostname +host: {{ .host }} # Hostname / IP-Adresse port: {{ .port }} # Port {{- end -}} diff --git a/util/templates/modbus.tpl b/util/templates/modbus.tpl index aebac291a0..7bf2a0a481 100644 --- a/util/templates/modbus.tpl +++ b/util/templates/modbus.tpl @@ -1,7 +1,7 @@ {{- define "modbus" }} id: {{ .id }} {{- if or (eq .modbus "rs485serial") (eq .modbus "rtu") (eq .modbus "ascii") }} -# Serial interface (Modbus RTU/ASCII) +# Local serial interface (Modbus RTU/ASCII) device: {{ .device }} baudrate: {{ .baudrate }} comset: "{{ .comset }}" From 1492496aa5d500fd3eafc0d7ea71ea82fb7bd654 Mon Sep 17 00:00:00 2001 From: andig Date: Thu, 14 Sep 2023 21:52:39 +0200 Subject: [PATCH 14/29] wip --- templates/definition/charger/abl-em4.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/definition/charger/abl-em4.yaml b/templates/definition/charger/abl-em4.yaml index 3e59928739..bc73f7dc46 100644 --- a/templates/definition/charger/abl-em4.yaml +++ b/templates/definition/charger/abl-em4.yaml @@ -8,7 +8,7 @@ requirements: evcc: ["sponsorship"] params: - name: modbus - choice: ["tcpip"] + choice: ["tcp"] id: 255 - name: connector default: 1 From 93cf7e1c92adfd51e85623f4d877cb228b72955e Mon Sep 17 00:00:00 2001 From: andig Date: Thu, 14 Sep 2023 21:55:22 +0200 Subject: [PATCH 15/29] wip --- templates/definition/charger/amperfied.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/definition/charger/amperfied.yaml b/templates/definition/charger/amperfied.yaml index ab1a7c1e12..a328d43e5d 100644 --- a/templates/definition/charger/amperfied.yaml +++ b/templates/definition/charger/amperfied.yaml @@ -11,7 +11,7 @@ requirements: evcc: ["sponsorship"] params: - name: modbus - choice: ["tcpip"] + choice: ["tcp"] id: 255 render: | type: heidelberg From 64339efdeb2ed0cc9385f559de1d793dfeea6fb3 Mon Sep 17 00:00:00 2001 From: andig Date: Thu, 14 Sep 2023 21:57:17 +0200 Subject: [PATCH 16/29] wip --- templates/definition/charger/phoenix-charx.yaml | 2 +- templates/definition/charger/phoenix-em-eth.yaml | 2 +- templates/definition/charger/phoenix-ev-eth.yaml | 2 +- templates/definition/charger/scheider-evlink.yaml | 2 +- templates/definition/meter/sma-datamanager.yaml | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/templates/definition/charger/phoenix-charx.yaml b/templates/definition/charger/phoenix-charx.yaml index e5b90b9cdd..0953afcfe2 100644 --- a/templates/definition/charger/phoenix-charx.yaml +++ b/templates/definition/charger/phoenix-charx.yaml @@ -8,7 +8,7 @@ products: generic: EvLoad/ Mikro 2.0 params: - name: modbus - choice: ["tcpip"] + choice: ["tcp"] id: 255 - name: connector render: | diff --git a/templates/definition/charger/phoenix-em-eth.yaml b/templates/definition/charger/phoenix-em-eth.yaml index 2a33d26760..36ee0f4ae7 100644 --- a/templates/definition/charger/phoenix-em-eth.yaml +++ b/templates/definition/charger/phoenix-em-eth.yaml @@ -5,7 +5,7 @@ products: generic: EM-CP-PP-ETH (Modbus TCP) params: - name: modbus - choice: ["tcpip"] + choice: ["tcp"] id: 255 render: | type: phoenix-em-eth diff --git a/templates/definition/charger/phoenix-ev-eth.yaml b/templates/definition/charger/phoenix-ev-eth.yaml index fb28fc812a..2945961401 100644 --- a/templates/definition/charger/phoenix-ev-eth.yaml +++ b/templates/definition/charger/phoenix-ev-eth.yaml @@ -20,7 +20,7 @@ requirements: evcc: ["sponsorship"] params: - name: modbus - choice: ["tcpip"] + choice: ["tcp"] id: 255 render: | type: phoenix-ev-eth diff --git a/templates/definition/charger/scheider-evlink.yaml b/templates/definition/charger/scheider-evlink.yaml index c7bda2d1e9..7260bc47d3 100644 --- a/templates/definition/charger/scheider-evlink.yaml +++ b/templates/definition/charger/scheider-evlink.yaml @@ -7,7 +7,7 @@ requirements: evcc: ["sponsorship"] params: - name: modbus - choice: ["tcpip"] + choice: ["tcp"] id: 255 render: | type: schneider diff --git a/templates/definition/meter/sma-datamanager.yaml b/templates/definition/meter/sma-datamanager.yaml index c8fd7da3d1..9437c24de9 100644 --- a/templates/definition/meter/sma-datamanager.yaml +++ b/templates/definition/meter/sma-datamanager.yaml @@ -14,7 +14,7 @@ params: choice: ["grid", "pv", "battery"] allinone: true - name: modbus - choice: ["tcpip"] + choice: ["tcp"] id: 2 - name: capacity advanced: true From 4a4d6ec28e7d8c8a11c0e9d934d0eecc3562fc5a Mon Sep 17 00:00:00 2001 From: andig Date: Thu, 14 Sep 2023 22:00:00 +0200 Subject: [PATCH 17/29] wip --- templates/definition/meter/mtec-eb-gen2.yaml | 2 +- templates/definition/meter/mtec-eb-gen3.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/templates/definition/meter/mtec-eb-gen2.yaml b/templates/definition/meter/mtec-eb-gen2.yaml index 647ed0552d..cdfc9c88df 100644 --- a/templates/definition/meter/mtec-eb-gen2.yaml +++ b/templates/definition/meter/mtec-eb-gen2.yaml @@ -7,7 +7,7 @@ params: - name: usage choice: ["grid", "pv", "battery"] - name: modbus - choice: ["rs485"] + choice: ["rtu"] id: 247 render: | type: custom diff --git a/templates/definition/meter/mtec-eb-gen3.yaml b/templates/definition/meter/mtec-eb-gen3.yaml index ca07ed9393..6c7d48ea10 100644 --- a/templates/definition/meter/mtec-eb-gen3.yaml +++ b/templates/definition/meter/mtec-eb-gen3.yaml @@ -7,7 +7,7 @@ params: - name: usage choice: ["grid", "pv", "battery"] - name: modbus - choice: ["rs485"] + choice: ["rtu"] id: 247 render: | type: custom From eea2ab8881407062df6fc2acc38ae0d2a74b5ab9 Mon Sep 17 00:00:00 2001 From: andig Date: Thu, 14 Sep 2023 22:02:05 +0200 Subject: [PATCH 18/29] wip --- templates/definition/meter/acrel-adw300.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/definition/meter/acrel-adw300.yaml b/templates/definition/meter/acrel-adw300.yaml index 16a2e54cfd..800d47ff81 100644 --- a/templates/definition/meter/acrel-adw300.yaml +++ b/templates/definition/meter/acrel-adw300.yaml @@ -7,7 +7,7 @@ params: - name: usage choice: ["grid", "pv", "charge"] - name: modbus - choice: ["rs485", "tcpip"] + choice: ["rtu", "tcp"] baudrate: 1200 render: | type: custom From 2b60c48bf926063dbb2435c0b2623a2d38bd6391 Mon Sep 17 00:00:00 2001 From: andig Date: Fri, 15 Sep 2023 08:44:40 +0200 Subject: [PATCH 19/29] wip --- templates/definition/meter/fox-ess-h1.yaml | 1 + templates/definition/meter/fox-ess-h3.yaml | 1 + 2 files changed, 2 insertions(+) diff --git a/templates/definition/meter/fox-ess-h1.yaml b/templates/definition/meter/fox-ess-h1.yaml index 80d47b673d..dbacfdab77 100644 --- a/templates/definition/meter/fox-ess-h1.yaml +++ b/templates/definition/meter/fox-ess-h1.yaml @@ -9,6 +9,7 @@ params: choice: ["pv", "battery"] - name: modbus choice: ["tcp"] + id: 247 render: | type: custom {{- if eq .usage "pv" }} diff --git a/templates/definition/meter/fox-ess-h3.yaml b/templates/definition/meter/fox-ess-h3.yaml index 7d34c511b0..bd4d2e723c 100644 --- a/templates/definition/meter/fox-ess-h3.yaml +++ b/templates/definition/meter/fox-ess-h3.yaml @@ -8,6 +8,7 @@ params: choice: ["grid", "pv", "battery"] - name: modbus choice: ["tcp"] + id: 247 render: | type: custom {{- if eq .usage "grid" }} From 5270dc333505cc249a23230968d63f030c3e257f Mon Sep 17 00:00:00 2001 From: andig Date: Fri, 15 Sep 2023 10:26:05 +0200 Subject: [PATCH 20/29] wip --- templates/definition/meter/fox-ess-rs485.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/templates/definition/meter/fox-ess-rs485.yaml b/templates/definition/meter/fox-ess-rs485.yaml index eb9019727d..2172f49a04 100644 --- a/templates/definition/meter/fox-ess-rs485.yaml +++ b/templates/definition/meter/fox-ess-rs485.yaml @@ -8,6 +8,7 @@ params: choice: ["grid", "pv", "battery"] - name: modbus choice: ["rtu"] + id: 247 render: | type: custom {{- if eq .usage "grid" }} From 3b5b2e7460c38ff6db31beb72ace24b5fbdf865e Mon Sep 17 00:00:00 2001 From: andig Date: Fri, 15 Sep 2023 18:17:22 +0200 Subject: [PATCH 21/29] wip --- templates/definition/meter/fox-ess-rs485.yaml | 60 ------------------- 1 file changed, 60 deletions(-) delete mode 100644 templates/definition/meter/fox-ess-rs485.yaml diff --git a/templates/definition/meter/fox-ess-rs485.yaml b/templates/definition/meter/fox-ess-rs485.yaml deleted file mode 100644 index 2172f49a04..0000000000 --- a/templates/definition/meter/fox-ess-rs485.yaml +++ /dev/null @@ -1,60 +0,0 @@ -template: fox-ess-rs485 -products: - - brand: FoxESS - description: - generic: FoxESS via RS485 Modbus -params: - - name: usage - choice: ["grid", "pv", "battery"] - - name: modbus - choice: ["rtu"] - id: 247 -render: | - type: custom - {{- if eq .usage "grid" }} - power: - source: modbus - {{- include "modbus" . | indent 2 }} - # register details - register: - address: 11021 # Grid power - type: holding - decode: int16 - {{- end }} - {{- if eq .usage "pv" }} - power: - source: calc - add: - - source: modbus - {{- include "modbus" . | indent 4 }} - # register details - register: - address: 11002 # PV1 - type: holding - decode: int16 - - source: modbus - {{- include "modbus" . | indent 4 }} - # register details - register: - address: 11005 # PV2 - type: holding - decode: int16 - {{- end }} - {{- if eq .usage "battery" }} - power: - source: modbus - {{- include "modbus" . | indent 2 }} - # register details - register: - address: 11008 # Battery Charge/Discharge - type: holding - decode: int16 - soc: - source: modbus - {{- include "modbus" . | indent 2 }} - # register details - register: - address: 11036 # Soc - type: holding - decode: int16 - {{- end }} From 437ec18906dcf453409ea8d35dc57dc7ddc50e8b Mon Sep 17 00:00:00 2001 From: premultiply <4681172+premultiply@users.noreply.github.com> Date: Fri, 15 Sep 2023 17:26:41 +0000 Subject: [PATCH 22/29] wip --- templates/definition/meter/fox-ess-h1.yaml | 10 +++++----- templates/definition/meter/fox-ess-h3.yaml | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/templates/definition/meter/fox-ess-h1.yaml b/templates/definition/meter/fox-ess-h1.yaml index dbacfdab77..e77cd8dc65 100644 --- a/templates/definition/meter/fox-ess-h1.yaml +++ b/templates/definition/meter/fox-ess-h1.yaml @@ -8,7 +8,7 @@ params: - name: usage choice: ["pv", "battery"] - name: modbus - choice: ["tcp"] + choice: ["rtu", "tcp"] id: 247 render: | type: custom @@ -19,7 +19,7 @@ render: | - source: modbus {{- include "modbus" . | indent 4 }} register: - {{- if or (eq .modbus "tcpip") .tcpip }} + {{- if or (eq .modbus "tcp") .tcp }} address: 31002 # PV1 type: holding {{- else }} @@ -30,7 +30,7 @@ render: | - source: modbus {{- include "modbus" . | indent 4 }} register: - {{- if or (eq .modbus "tcpip") .tcpip }} + {{- if or (eq .modbus "tcp") .tcp }} address: 31005 # PV2 type: holding {{- else }} @@ -44,7 +44,7 @@ render: | source: modbus {{- include "modbus" . | indent 2 }} register: - {{- if or (eq .modbus "tcpip") .tcpip }} + {{- if or (eq .modbus "tcp") .tcp }} address: 31022 # Battery charge/discharge type: holding {{- else }} @@ -56,7 +56,7 @@ render: | source: modbus {{- include "modbus" . | indent 2 }} register: - {{- if or (eq .modbus "tcpip") .tcpip }} + {{- if or (eq .modbus "tcp") .tcp }} address: 31024 # Soc type: holding {{- else }} diff --git a/templates/definition/meter/fox-ess-h3.yaml b/templates/definition/meter/fox-ess-h3.yaml index bd4d2e723c..2da2d8ce82 100644 --- a/templates/definition/meter/fox-ess-h3.yaml +++ b/templates/definition/meter/fox-ess-h3.yaml @@ -7,7 +7,7 @@ params: - name: usage choice: ["grid", "pv", "battery"] - name: modbus - choice: ["tcp"] + choice: ["rtu"] id: 247 render: | type: custom From 4cd5a89d92c85449e1f614f26d625e6bb92e6123 Mon Sep 17 00:00:00 2001 From: premultiply <4681172+premultiply@users.noreply.github.com> Date: Fri, 15 Sep 2023 17:33:06 +0000 Subject: [PATCH 23/29] wip --- templates/README.md | 2 +- util/templates/defaults.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/templates/README.md b/templates/README.md index 825969fc9e..01aff74c36 100644 --- a/templates/README.md +++ b/templates/README.md @@ -117,7 +117,7 @@ Example Use Case: With SMA Home Manager, there can be a SMA Energy Meter used fo **Predefined name values**: - `usage`: specifies a list of meter classes, the device can be used for. Possible values are `grid`, `pv`, `battery`, and `charger` -- `modbus`: specifies that this device is accessed via modbus. It requires the `choice` property to have a list of possible interface values the device provides. These values can be `rs485` and `tcpip`. The command will use either to ask the appropriate questions and settings. The `render` section needs to include the string `{{include "modbus" .}}` in all places where the configuration needs modbus settings. +- `modbus`: specifies that this device is accessed via modbus. It requires the `choice` property to have a list of possible interface values the device provides. These values can be `rtu`, `tcp` or `ascii`. The command will use either to ask the appropriate questions and settings. The `render` section needs to include the string `{{include "modbus" .}}` in all places where the configuration needs modbus settings. #### Usage Options diff --git a/util/templates/defaults.go b/util/templates/defaults.go index 82f58579b3..78eb73d24f 100644 --- a/util/templates/defaults.go +++ b/util/templates/defaults.go @@ -16,7 +16,7 @@ type configDefaults struct { Params []Param } Modbus struct { // Details about possible ModbusInterfaces and ModbusConnectionTypes - Interfaces map[string][]string // Information about physical modbus interface types (rs485, tcpip) + Interfaces map[string][]string // Information about modbus protocol types (rtu, tcp or ascii) Types map[string]struct { // Details about different ways to connect to a ModbusInterface and its defaults Description TextLanguage Params []Param From 24e82cd4f3f5ed2b12af265f23d5660984b8b19d Mon Sep 17 00:00:00 2001 From: premultiply <4681172+premultiply@users.noreply.github.com> Date: Fri, 15 Sep 2023 17:50:41 +0000 Subject: [PATCH 24/29] wip --- util/templates/documentation_modbus.tpl | 44 ++++++++++++------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/util/templates/documentation_modbus.tpl b/util/templates/documentation_modbus.tpl index 60388eb98f..d209e7c97e 100644 --- a/util/templates/documentation_modbus.tpl +++ b/util/templates/documentation_modbus.tpl @@ -1,42 +1,42 @@ {{- if .rtuserial }} # Attached to local serial interface (Modbus RTU) -modbus: rtu -id: {{ .id }} -device: {{ .device }} # Schnittstellenname, typische Werte sind /dev/ttyUSB0, /dev/ttyAMA0, /dev/ttyS0 oder COM3 -baudrate: {{ .baudrate }} # Baudrate, typische Werte sind 9600, 19200, 38400, 57600, 115200 -comset: {{ .comset }} # Parität, Datenbits, Stoppbits, typische Werte sind 8N1, 8E1, 8O1 +modbus: rtu # modbus protocol +id: {{ .id }} # modbus id +device: {{ .device }} # serial device name e.g. /dev/ttyUSB0, /dev/ttyAMA0, /dev/ttyS0 or COM3 (on Windows) +baudrate: {{ .baudrate }} # baud rate e.g. 9600, 19200, 38400, 57600, 115200 +comset: {{ .comset }} # data bits, parity mode (none, even, odd), stop bits e.g. 8n1, 8e1 or 8o1 {{- end }} {{- if .rtutcp }} # Attached to transparent serial device server (Modbus RTU over TCP/IP) -modbus: rtu-over-tcpip -id: {{ .id }} -host: {{ .host }} # Hostname / IP-Adresse -port: {{ .port }} # Port +modbus: rtu-over-tcpip # modbus protocol +id: {{ .id }} # modbus id +host: {{ .host }} # hostname / IP address +port: {{ .port }} # tcp port {{- end }} {{- if .asciiserial }} # Attached to local serial interface (Modbus ASCII) -modbus: ascii -id: {{ .id }} -device: {{ .device }} # Schnittstellenname, typische Werte sind /dev/ttyUSB0, /dev/ttyAMA0, /dev/ttyS0 oder COM3 -baudrate: {{ .baudrate }} # Baudrate, typische Werte sind 9600, 19200, 38400, 57600, 115200 -comset: {{ .comset }} # Parität, Datenbits, Stoppbits, typische Werte sind 8N1, 8E1, 8O1 +modbus: ascii # modbus protocol +id: {{ .id }} # modbus id +device: {{ .device }} # serial device name e.g. /dev/ttyUSB0, /dev/ttyAMA0, /dev/ttyS0 or COM3 (on Windows) +baudrate: {{ .baudrate }} # baud rate e.g. 9600, 19200, 38400, 57600, 115200 +comset: {{ .comset }} # data bits, parity mode (none, even, odd), stop bits e.g. 8n1, 8e1 or 8o1 {{- end }} {{- if .asciitcp }} # Attached to transparent serial device server (Modbus ASCII over TCP/IP) -modbus: ascii-over-tcpip -id: {{ .id }} -host: {{ .host }} # Hostname / IP-Adresse -port: {{ .port }} # Port +modbus: ascii-over-tcpip # modbus protocol +id: {{ .id }} # modbus id +host: {{ .host }} # hostname / IP address +port: {{ .port }} # port {{- end }} {{- if .tcp }} # Modbus TCP -modbus: tcp -id: {{ .id }} -host: {{ .host }} # Hostname / IP-Adresse -port: {{ .port }} # Port +modbus: tcp # modbus protocol +id: {{ .id }} # modbus id +host: {{ .host }} # hostname / IP address +port: {{ .port }} # port {{- end -}} From a9fb09cc0d4c99d8d697c2fdc87f5317438fed9f Mon Sep 17 00:00:00 2001 From: premultiply <4681172+premultiply@users.noreply.github.com> Date: Sun, 17 Sep 2023 21:50:56 +0200 Subject: [PATCH 25/29] wip --- util/templates/modbus.tpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/util/templates/modbus.tpl b/util/templates/modbus.tpl index 7bf2a0a481..1a6c1b47d3 100644 --- a/util/templates/modbus.tpl +++ b/util/templates/modbus.tpl @@ -19,4 +19,4 @@ uri: {{ .host }}:{{ .port }} # configuration error - should not happen modbusConnectionTypeNotDefined: {{ .modbus }} {{- end }} -{{- end }} \ No newline at end of file +{{- end }} From a2b998bdedac15601ca6afb4d463ec70c0a1d12e Mon Sep 17 00:00:00 2001 From: premultiply <4681172+premultiply@users.noreply.github.com> Date: Sun, 1 Oct 2023 12:06:26 +0000 Subject: [PATCH 26/29] wip --- templates/definition/meter/acrel-adw300.yaml | 2 +- templates/definition/meter/cg-emt3xx.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/templates/definition/meter/acrel-adw300.yaml b/templates/definition/meter/acrel-adw300.yaml index 800d47ff81..8026b8ce5e 100644 --- a/templates/definition/meter/acrel-adw300.yaml +++ b/templates/definition/meter/acrel-adw300.yaml @@ -7,7 +7,7 @@ params: - name: usage choice: ["grid", "pv", "charge"] - name: modbus - choice: ["rtu", "tcp"] + choice: ["rtu"] baudrate: 1200 render: | type: custom diff --git a/templates/definition/meter/cg-emt3xx.yaml b/templates/definition/meter/cg-emt3xx.yaml index 0f0dc93515..1b85158927 100644 --- a/templates/definition/meter/cg-emt3xx.yaml +++ b/templates/definition/meter/cg-emt3xx.yaml @@ -7,7 +7,7 @@ params: - name: usage choice: ["grid", "charge"] - name: modbus - choice: ["rtu", "tcp"] + choice: ["rtu"] render: | type: modbus {{- include "modbus" . }} From 986e2cd1f7169788915499b60f7e5d15bcf0eff7 Mon Sep 17 00:00:00 2001 From: premultiply <4681172+premultiply@users.noreply.github.com> Date: Sun, 1 Oct 2023 12:47:00 +0000 Subject: [PATCH 27/29] wip --- templates/definition/meter/deye-hybrid.yaml | 2 +- templates/definition/meter/siemens-7kt1665.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/templates/definition/meter/deye-hybrid.yaml b/templates/definition/meter/deye-hybrid.yaml index 43cf80ec1e..f62f4ef272 100644 --- a/templates/definition/meter/deye-hybrid.yaml +++ b/templates/definition/meter/deye-hybrid.yaml @@ -11,7 +11,7 @@ params: choice: ["grid", "pv", "battery"] allinone: true - name: modbus - choice: ["rtu", "tcp"] + choice: ["rtu"] baudrate: 9600 id: 1 - name: capacity diff --git a/templates/definition/meter/siemens-7kt1665.yaml b/templates/definition/meter/siemens-7kt1665.yaml index df334b18ad..395bb41d8d 100644 --- a/templates/definition/meter/siemens-7kt1665.yaml +++ b/templates/definition/meter/siemens-7kt1665.yaml @@ -7,7 +7,7 @@ params: - name: usage choice: ["grid", "charge"] - name: modbus - choice: ["rtu", "tcp"] + choice: ["rtu"] render: | type: custom power: From 6df6170275bff3dfec07cb84590d8efbd62de4fe Mon Sep 17 00:00:00 2001 From: premultiply <4681172+premultiply@users.noreply.github.com> Date: Sun, 1 Oct 2023 16:24:45 +0000 Subject: [PATCH 28/29] wip --- util/templates/types.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/util/templates/types.go b/util/templates/types.go index 80807dc4bb..4520ff81d2 100644 --- a/util/templates/types.go +++ b/util/templates/types.go @@ -23,11 +23,11 @@ const ( ModbusChoiceRTU = "rtu" ModbusChoiceTCP = "tcp" ModbusChoiceASCII = "ascii" - ModbusKeyRTUSerial = "rtuserial" - ModbusKeyRTUTCP = "rtutcp" + ModbusKeyRTUSerial = "rtu" + ModbusKeyRTUTCP = "rtu-over-tcpip" ModbusKeyTCP = "tcp" - ModbusKeyASCIISerial = "asciiserial" - ModbusKeyASCIITCP = "asciitcp" + ModbusKeyASCIISerial = "ascii" + ModbusKeyASCIITCP = "ascii-over-tcpip" ModbusParamNameId = "id" ModbusParamNameDevice = "device" From cd3e955b5edffb2e91599d17a7d0e140fa3d6159 Mon Sep 17 00:00:00 2001 From: premultiply <4681172+premultiply@users.noreply.github.com> Date: Sun, 1 Oct 2023 16:42:52 +0000 Subject: [PATCH 29/29] update victron charger --- templates/definition/charger/victron.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/definition/charger/victron.yaml b/templates/definition/charger/victron.yaml index 1bd524012a..4b3673c14b 100644 --- a/templates/definition/charger/victron.yaml +++ b/templates/definition/charger/victron.yaml @@ -10,7 +10,7 @@ requirements: de: Wallbox muss sich im Modus "Manual" befinden und Modbus ID 100 konfiguriert sein. params: - name: modbus - choice: ["tcpip"] + choice: ["tcp"] id: 100 render: | type: victron