From 4acb4ccfcae50d326b927740e567003d95b76ba2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ante=20Karamati=C4=87?= Date: Mon, 13 Jan 2025 14:38:48 +0100 Subject: [PATCH] Enphase: fix multiphase currents (#18200) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Ante Karamatić --- templates/definition/meter/enphase.yaml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/templates/definition/meter/enphase.yaml b/templates/definition/meter/enphase.yaml index 7d22b15a1..300e0e6b2 100644 --- a/templates/definition/meter/enphase.yaml +++ b/templates/definition/meter/enphase.yaml @@ -39,7 +39,7 @@ render: | password: {{ .token }} insecure: true {{- end }} - jq: if .consumption[] | select(.measurementType == "net-consumption").activeCount >= 1 then .consumption[] | select(.measurementType == "net-consumption").lines[0].rmsCurrent else 0 end + jq: if (( .consumption[] | select(.measurementType == "net-consumption").activeCount >= 1 ) and ( .consumption[] | select(.measurementType == "net-consumption").lines | length >= 1 )) then .consumption[] | select(.measurementType == "net-consumption").lines[0].rmsCurrent else 0 end - source: http uri: http://{{ .host }}/production.json?details=1 {{- if .token }} @@ -48,7 +48,7 @@ render: | password: {{ .token }} insecure: true {{- end }} - jq: if .consumption[] | select(.measurementType == "net-consumption").activeCount >= 1 then .consumption[] | select(.measurementType == "net-consumption").lines[1].rmsCurrent else 0 end + jq: if (( .consumption[] | select(.measurementType == "net-consumption").activeCount >= 1 ) and ( .consumption[] | select(.measurementType == "net-consumption").lines | length >= 2 )) then .consumption[] | select(.measurementType == "net-consumption").lines[1].rmsCurrent else 0 end - source: http uri: http://{{ .host }}/production.json?details=1 {{- if .token }} @@ -57,7 +57,7 @@ render: | password: {{ .token }} insecure: true {{- end }} - jq: if .consumption[] | select(.measurementType == "net-consumption").activeCount >= 1 then .consumption[] | select(.measurementType == "net-consumption").lines[2].rmsCurrent else 0 end + jq: if (( .consumption[] | select(.measurementType == "net-consumption").activeCount >= 1 ) and ( .consumption[] | select(.measurementType == "net-consumption").lines | length >= 3 )) then .consumption[] | select(.measurementType == "net-consumption").lines[2].rmsCurrent else 0 end {{- end }} {{- if eq .usage "pv" }} power: @@ -90,7 +90,7 @@ render: | password: {{ .token }} insecure: true {{- end }} - jq: if .production[] | select(.measurementType == "production").activeCount >= 1 then .production[] | select(.measurementType == "production").lines[0].rmsCurrent else 0 end + jq: if (( .production[] | select(.measurementType == "production").activeCount >= 1 ) and ( .production[] | select(.measurementType == "production").lines | length >= 1 )) then .production[] | select(.measurementType == "production").lines[0].rmsCurrent else 0 end - source: http uri: http://{{ .host }}/production.json?details=1 {{- if .token }} @@ -99,7 +99,7 @@ render: | password: {{ .token }} insecure: true {{- end }} - jq: if .production[] | select(.measurementType == "production").activeCount >= 1 then .production[] | select(.measurementType == "production").lines[1].rmsCurrent else 0 end + jq: if (( .production[] | select(.measurementType == "production").activeCount >= 1 ) and ( .production[] | select(.measurementType == "production").lines | length >= 2 )) then .production[] | select(.measurementType == "production").lines[1].rmsCurrent else 0 end - source: http uri: http://{{ .host }}/production.json?details=1 {{- if .token }} @@ -108,7 +108,7 @@ render: | password: {{ .token }} insecure: true {{- end }} - jq: if .production[] | select(.measurementType == "production").activeCount >= 1 then .production[] | select(.measurementType == "production").lines[2].rmsCurrent else 0 end + jq: if (( .production[] | select(.measurementType == "production").activeCount >= 1 ) and ( .production[] | select(.measurementType == "production").lines | length >= 3 )) then .production[] | select(.measurementType == "production").lines[2].rmsCurrent else 0 end {{- end }} {{- if eq .usage "battery" }} power: