diff --git a/templates/definition/meter/smartfox-em2.yaml b/templates/definition/meter/smartfox-em2.yaml index b8c3491d0..c9999c1fa 100644 --- a/templates/definition/meter/smartfox-em2.yaml +++ b/templates/definition/meter/smartfox-em2.yaml @@ -14,7 +14,7 @@ products: generic: Pro Light 2 - brand: Smartfox description: - generic: Light (EM2 firmware) + generic: Light requirements: description: de: | @@ -39,51 +39,51 @@ render: | source: http cache: {{ .cache }} uri: {{ include "uri" . }} - jq: .values.value[] | select(.attrid=="detailsPowerValue")."#content" | rtrimstr(" W") + jq: .values.value[] | select((.id // .attrid)=="detailsPowerValue")."#content" | rtrimstr(" W") energy: # grid energy in kWh source: http cache: {{ .cache }} uri: {{ include "uri" . }} - jq: .values.value[] | select(.attrid=="energyValue")."#content" | rtrimstr(" kWh") + jq: .values.value[] | select((.id // .attrid)=="energyValue")."#content" | rtrimstr(" kWh") voltages: # grid voltages in V - source: http cache: {{ .cache }} uri: {{ include "uri" . }} - jq: .values.value[] | select(.attrid=="voltageL1Value")."#content" | rtrimstr(" V") + jq: .values.value[] | select((.id // .attrid)=="voltageL1Value")."#content" | rtrimstr(" V") - source: http cache: {{ .cache }} uri: {{ include "uri" . }} - jq: .values.value[] | select(.attrid=="voltageL2Value")."#content" | rtrimstr(" V") + jq: .values.value[] | select((.id // .attrid)=="voltageL2Value")."#content" | rtrimstr(" V") - source: http cache: {{ .cache }} uri: {{ include "uri" . }} - jq: .values.value[] | select(.attrid=="voltageL3Value")."#content" | rtrimstr(" V") + jq: .values.value[] | select((.id // .attrid)=="voltageL3Value")."#content" | rtrimstr(" V") currents: # grid currents in A - source: http cache: {{ .cache }} uri: {{ include "uri" . }} - jq: .values.value[] | select(.attrid=="ampereL1Value")."#content" | rtrimstr(" A") + jq: .values.value[] | select((.id // .attrid)=="ampereL1Value")."#content" | rtrimstr(" A") - source: http cache: {{ .cache }} uri: {{ include "uri" . }} - jq: .values.value[] | select(.attrid=="ampereL2Value")."#content" | rtrimstr(" A") + jq: .values.value[] | select((.id // .attrid)=="ampereL2Value")."#content" | rtrimstr(" A") - source: http cache: {{ .cache }} uri: {{ include "uri" . }} - jq: .values.value[] | select(.attrid=="ampereL3Value")."#content" | rtrimstr(" A") + jq: .values.value[] | select((.id // .attrid)=="ampereL3Value")."#content" | rtrimstr(" A") powers: # grid powers in W - source: http cache: {{ .cache }} uri: {{ include "uri" . }} - jq: .values.value[] | select(.attrid=="powerL1Value")."#content" | rtrimstr(" W") + jq: .values.value[] | select((.id // .attrid)=="powerL1Value")."#content" | rtrimstr(" W") - source: http cache: {{ .cache }} uri: {{ include "uri" . }} - jq: .values.value[] | select(.attrid=="powerL2Value")."#content" | rtrimstr(" W") + jq: .values.value[] | select((.id // .attrid)=="powerL2Value")."#content" | rtrimstr(" W") - source: http cache: {{ .cache }} uri: {{ include "uri" . }} - jq: .values.value[] | select(.attrid=="powerL3Value")."#content" | rtrimstr(" W") + jq: .values.value[] | select((.id // .attrid)=="powerL3Value")."#content" | rtrimstr(" W") {{- end }} {{- if eq .usage "pv" }} # PV power and energy values are delivered for each inverter, we select them via regex and sum the values @@ -91,19 +91,19 @@ render: | source: http cache: {{ .cache }} uri: {{ include "uri" . }} - jq: '[.values.value[] | select(.attrid|test("wr\\d+PowerValue"))."#content" | rtrimstr(" kW") | tonumber] | add' + jq: '[.values.value[] | select((.id // .attrid)|test("wr\\d+PowerValue"))."#content" | rtrimstr(" kW") | tonumber] | add' scale: 1000 # wr1PowerValue, ..., wr5PowerValue are in kW energy: # PV energy in kWh source: http cache: {{ .cache }} uri: {{ include "uri" . }} - jq: '[.values.value[] | select(.attrid|test("wr\\d+EnergyValue"))."#content" | rtrimstr(" kWh") | tonumber] | add' + jq: '[.values.value[] | select((.id // .attrid)|test("wr\\d+EnergyValue"))."#content" | rtrimstr(" kWh") | tonumber] | add' {{- end }} {{- if eq .usage "aux" }} power: # heating power in W source: http cache: {{ .cache }} uri: {{ include "uri" . }} - jq: .values.value[] | select(.attrid=="htPowerMeasValue")."#content" | rtrimstr(" kW") + jq: .values.value[] | select((.id // .attrid)=="htPowerMeasValue")."#content" | rtrimstr(" kW") scale: 1000 {{- end }}