Volkszähler: allow full url config (#3561)

This commit is contained in:
StefanSchoof 2022-06-24 14:16:13 +02:00 • committed by GitHub
parent ce487de2e5
commit 8f6727edf3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 28 additions and 10 deletions

View file

@ -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

View file

@ -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

View file

@ -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:

View file

@ -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: