diff --git a/templates/definition/meter/enphase.yaml b/templates/definition/meter/enphase.yaml index dbb9f6b1ad..581e4c677d 100644 --- a/templates/definition/meter/enphase.yaml +++ b/templates/definition/meter/enphase.yaml @@ -41,7 +41,7 @@ render: | password: {{ .token }} insecure: true {{- end }} - jq: if .production[] | select(.measurementType == "production").activeCount >= 1 then .production[] | select(.measurementType == "production").wNow else .production[] | select(.type == "inverters").wNow end + jq: if (.production | length) > 1 and (.production[] | select(.measurementType == "production").activeCount >= 1) then .production[] | select(.measurementType == "production").wNow else .production[] | select(.type == "inverters").wNow end energy: source: http uri: http://{{ .host }}/production.json @@ -51,7 +51,7 @@ render: | password: {{ .token }} insecure: true {{- end }} - jq: if .production[] | select(.measurementType == "production").activeCount >= 1 then .production[] | select(.measurementType == "production").whLifetime else .production[] | select(.type == "inverters").whLifetime end + jq: if (.production | length) > 1 and (.production[] | select(.measurementType == "production").activeCount >= 1) then .production[] | select(.measurementType == "production").whLifetime else .production[] | select(.type == "inverters").whLifetime end scale: 0.001 {{- end }} {{- if eq .usage "battery" }}