From 8f6727edf38fcf7a89fa26c25928b6c31dc2bba1 Mon Sep 17 00:00:00 2001 From: StefanSchoof <4662023+StefanSchoof@users.noreply.github.com> Date: Fri, 24 Jun 2022 14:16:13 +0200 Subject: [PATCH] =?UTF-8?q?Volksz=C3=A4hler:=20allow=20full=20url=20config?= =?UTF-8?q?=20(#3561)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../definition/meter/volkszaehler-http.yaml | 14 +++++++++++--- .../meter/volkszaehler-importexport.yaml | 18 +++++++++++++++--- templates/docs/meter/volkszaehler-http_0.yaml | 3 +-- .../meter/volkszaehler-importexport_0.yaml | 3 +-- 4 files changed, 28 insertions(+), 10 deletions(-) diff --git a/templates/definition/meter/volkszaehler-http.yaml b/templates/definition/meter/volkszaehler-http.yaml index 86aad29ae..5e978e39f 100644 --- a/templates/definition/meter/volkszaehler-http.yaml +++ b/templates/definition/meter/volkszaehler-http.yaml @@ -7,14 +7,22 @@ group: generic params: - name: usage choice: ["grid"] - - name: host - - name: port - default: 80 + - name: url + description: + de: URL des "data" Kontexts der Volkszähler Middleware (ohne / am Ende) + en: URL of the middleware#s "data" context (without trailing /) + help: + de: "Beispiel: http://zaehler.network.local:8080/api/data" + en: "Example: http://zaehler.network.local:8080/api/data" - name: uuid required: true render: | type: custom power: # power reading source: http # use http plugin + {{- if .host }} uri: http://{{ .host }}:{{ .port }}/api/data/{{ .uuid }}.json?from=now + {{ else }} + uri: {{ .url }}/{{ .uuid }}.json?from=now + {{- end }} jq: .data.tuples[0][1] # parse response json diff --git a/templates/definition/meter/volkszaehler-importexport.yaml b/templates/definition/meter/volkszaehler-importexport.yaml index 5cbe1e281..312f2b636 100644 --- a/templates/definition/meter/volkszaehler-importexport.yaml +++ b/templates/definition/meter/volkszaehler-importexport.yaml @@ -7,9 +7,13 @@ group: generic params: - name: usage choice: ["grid"] - - name: host - - name: port - default: 80 + - name: url + description: + de: URL des "data" Kontext der volkszahler Middleware (ohne ein / am Ende) + en: URL of the "data" context of the volkszaheler middleware (without the / at the end) + help: + de: "Die URL ist zum Beispiel: http://zaehler.network.local:8080/api/data" + en: "The URL is for example: http://zaehler.network.local:8080/api/data" - name: importuuid required: true - name: exportuuid @@ -20,9 +24,17 @@ render: | source: calc # use calc plugin add: - source: http # import channel + {{- if .host }} uri: http://{{ .host }}:{{ .port }}/api/data/{{ .importuuid }}.json?from=now + {{ else }} + uri: {{ .url }}/{{ .importuuid }}.json?from=now + {{- end }} jq: .data.tuples[0][1] # parse response json - source: http # export channel + {{- if .host }} uri: http://{{ .host }}:{{ .port }}/api/data/{{ .exportuuid }}.json?from=now + {{ else }} + uri: {{ .url }}/{{ .exportuuid }}.json?from=now + {{- end }} jq: .data.tuples[0][1] # parse response json scale: -1 # export must result in negative values diff --git a/templates/docs/meter/volkszaehler-http_0.yaml b/templates/docs/meter/volkszaehler-http_0.yaml index bf55c2a4e..1415c0487 100644 --- a/templates/docs/meter/volkszaehler-http_0.yaml +++ b/templates/docs/meter/volkszaehler-http_0.yaml @@ -8,6 +8,5 @@ render: type: template template: volkszaehler-http usage: grid - host: 192.0.2.2 # IP-Adresse oder Hostname - port: 80 # Port # Optional + url: # Beispiel: http://zaehler.network.local:8080/api/data # Optional uuid: diff --git a/templates/docs/meter/volkszaehler-importexport_0.yaml b/templates/docs/meter/volkszaehler-importexport_0.yaml index bc0dad5c4..3014be94f 100644 --- a/templates/docs/meter/volkszaehler-importexport_0.yaml +++ b/templates/docs/meter/volkszaehler-importexport_0.yaml @@ -8,7 +8,6 @@ render: type: template template: volkszaehler-importexport usage: grid - host: 192.0.2.2 # IP-Adresse oder Hostname - port: 80 # Port # Optional + url: # Die URL ist zum Beispiel: http://zaehler.network.local:8080/api/data # Optional importuuid: exportuuid: