Skip to content

Commit

Permalink
Smartfox: add aux (#12119)
Browse files Browse the repository at this point in the history
  • Loading branch information
andig authored Feb 7, 2024
1 parent 1e98f3d commit 8d1a109
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 23 deletions.
22 changes: 10 additions & 12 deletions templates/definition/meter/smartfox-em2.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,28 +6,19 @@ products:
requirements:
description:
de: |
Kann verwendet werden, um Daten für `grid`, `pv` und `aux` zu erhalten.
Wenn `usage` nicht definiert ist, wird die Leistung für die Warmwasserbereitung zurückgegeben (als `aux` zu verwenden).
`aux` kann für die Leistung der Warmwasserbereitung verwendet werden.
en: |
Can be used to get `grid`, `pv` and `aux` data.
If `usage` is not defined, then return the power for the water heating (to be used as `aux`).
`aux` can be used for water heating power.
params:
- name: usage
choice: ["grid", "pv"]
choice: ["grid", "pv", "aux"]
- name: host
render: |
{{- define "uri" -}}
http://{{ .host }}/values.xml
{{- end }}
type: custom
# jq: parse json generated from response values.xml (https://jqplay.org is your friend to test queries)
{{- if not .usage }}
power: # heating power in W
source: http
uri: {{ include "uri" . }}
jq: .values.value[] | select(.attrid=="htPowerMeasValue")."#content" | rtrimstr(" kW")
scale: 1000
{{- end }}
{{- if eq .usage "grid" }}
power: # grid power in W
source: http
Expand Down Expand Up @@ -80,3 +71,10 @@ render: |
uri: {{ include "uri" . }}
jq: '[.values.value[] | select(.attrid|test("wr\\d+EnergyValue"))."#content" | rtrimstr(" kWh") | tonumber] | add'
{{- end }}
{{- if eq .usage "aux" }}
power: # heating power in W
source: http
uri: {{ include "uri" . }}
jq: .values.value[] | select(.attrid=="htPowerMeasValue")."#content" | rtrimstr(" kW")
scale: 1000
{{- end }}
20 changes: 9 additions & 11 deletions templates/definition/meter/smartfox.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,26 +6,18 @@ products:
requirements:
description:
de: |
Kann verwendet werden, um Daten für `grid`, `pv` und `aux` zu erhalten.
Wenn `usage` nicht definiert ist, wird die Leistung für die Warmwasserbereitung zurückgegeben (als `aux` zu verwenden).
`aux` kann für die Leistung der Warmwasserbereitung verwendet werden.
en: |
Can be used to get `grid`, `pv` and `aux` data.
If `usage` is not defined, then return the power for the water heating (to be used as `aux`).
`aux` can be used for water heating power.
params:
- name: usage
choice: ["grid", "pv"]
choice: ["grid", "pv", "aux"]
- name: host
render: |
{{- define "uri" -}}
http://{{ .host }}/all
{{- end }}
type: custom
{{- if not .usage }}
power:
source: http
uri: {{ include "uri" . }}
jq: .power_sf
{{- end }}
{{- if eq .usage "grid" }}
power:
source: http
Expand Down Expand Up @@ -78,3 +70,9 @@ render: |
jq: .PvEnergy[0]
scale: 0.001
{{- end }}
{{- if eq .usage "aux" }}
power:
source: http
uri: {{ include "uri" . }}
jq: .power_sf
{{- end }}

0 comments on commit 8d1a109

Please sign in to comment.