From ddf27d541f152a85decd9497d82d5d52138ad6a7 Mon Sep 17 00:00:00 2001 From: StefanSchoof <4662023+StefanSchoof@users.noreply.github.com> Date: Fri, 7 Feb 2025 14:31:51 +0100 Subject: [PATCH] vzlogger: add cache (#18617) --- templates/definition/meter/vzlogger.yaml | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/templates/definition/meter/vzlogger.yaml b/templates/definition/meter/vzlogger.yaml index abcc9ed47..b57625678 100644 --- a/templates/definition/meter/vzlogger.yaml +++ b/templates/definition/meter/vzlogger.yaml @@ -65,12 +65,16 @@ params: description: de: Die vzlogger Kanal uuid für Spannung in Phase 3 (OBIS Code 72.7.0) en: The vzlogger channel uuid for voltage on phase 3 (OBIS Code 72.7.0) + - name: cache + advanced: true + default: 1s render: | type: custom power: # power reading source: http # use http plugin uri: http://{{ .host }}:{{ .port }}/ jq: .data[] | select(.uuid=={{ quote (trimAll "'" .uuid) }}) | .tuples[0][1] # parse response json + cache: {{ .cache }} {{- if .scale }} scale: {{ .scale }} {{- end }} @@ -79,34 +83,43 @@ render: | - source: http uri: http://{{ .host }}:{{ .port }}/ jq: .data[] | select(.uuid=={{ quote (trimAll "'" .l1currentuuid) }}) | .tuples[0][1] + cache: {{ .cache }} - source: http uri: http://{{ .host }}:{{ .port }}/ jq: .data[] | select(.uuid=={{ quote (trimAll "'" .l2currentuuid) }}) | .tuples[0][1] + cache: {{ .cache }} - source: http uri: http://{{ .host }}:{{ .port }}/ jq: .data[] | select(.uuid=={{ quote (trimAll "'" .l3currentuuid) }}) | .tuples[0][1] + cache: {{ .cache }} {{ end -}} {{ if and .l1poweruuid .l2poweruuid .l3poweruuid -}} powers: - source: http uri: http://{{ .host }}:{{ .port }}/ jq: .data[] | select(.uuid=={{ quote (trimAll "'" .l1poweruuid) }}) | .tuples[0][1] + cache: {{ .cache }} - source: http uri: http://{{ .host }}:{{ .port }}/ jq: .data[] | select(.uuid=={{ quote (trimAll "'" .l2poweruuid) }}) | .tuples[0][1] + cache: {{ .cache }} - source: http uri: http://{{ .host }}:{{ .port }}/ jq: .data[] | select(.uuid=={{ quote (trimAll "'" .l3poweruuid) }}) | .tuples[0][1] + cache: {{ .cache }} {{ end -}} {{ if and .l1voltageuuid .l2voltageuuid .l3voltageuuid -}} voltages: - source: http uri: http://{{ .host }}:{{ .port }}/ jq: .data[] | select(.uuid=={{ quote (trimAll "'" .l1voltageuuid) }}) | .tuples[0][1] + cache: {{ .cache }} - source: http uri: http://{{ .host }}:{{ .port }}/ jq: .data[] | select(.uuid=={{ quote (trimAll "'" .l2voltageuuid) }}) | .tuples[0][1] + cache: {{ .cache }} - source: http uri: http://{{ .host }}:{{ .port }}/ jq: .data[] | select(.uuid=={{ quote (trimAll "'" .l3voltageuuid) }}) | .tuples[0][1] + cache: {{ .cache }} {{ end -}}