evcc-io/templates/definition/meter/volkszaehler-importexport.yaml
2024-04-05 10:44:22 +02:00

40 lines
1.3 KiB
YAML

template: volkszaehler-importexport
products:
- brand: Volkszähler
description:
generic: HTTP API, Import & Export
group: generic
params:
- name: usage
choice: ["grid"]
- name: url
description:
de: URL des "data" Kontexts der Volkszähler Middleware
en: URL of the middleware's "data" context
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
required: true
render: |
type: custom
power:
source: calc # use calc plugin
add:
- source: http # import channel
{{- if .host }}
uri: http://{{ .host }}:{{ .port }}/api/data/{{ trimAll "'" .importuuid }}.json?from=now
{{ else }}
uri: {{ trimSuffix "/" .url }}/{{ trimAll "'" .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/{{ trimAll "'" .exportuuid }}.json?from=now
{{ else }}
uri: {{ trimSuffix "/" .url }}/{{ trimAll "'" .exportuuid }}.json?from=now
{{- end }}
jq: .data.tuples[0][1] # parse response json
scale: -1 # export must result in negative values