From fad7d2537d06b102f3d39bcf1b082b6057fa63a6 Mon Sep 17 00:00:00 2001 From: salz3n <79696598+salz3n@users.noreply.github.com> Date: Wed, 19 Jul 2023 09:01:37 +0200 Subject: [PATCH] Enphase: Add battery (#9019) Co-authored-by: Sjard Bleecken --- templates/definition/meter/enphase.yaml | 33 ++++++++++++++++++++++--- templates/docs/meter/enphase_0.yaml | 26 +++++++++++++++++++ 2 files changed, 56 insertions(+), 3 deletions(-) diff --git a/templates/definition/meter/enphase.yaml b/templates/definition/meter/enphase.yaml index b4b832ab4..2ff2f0e56 100644 --- a/templates/definition/meter/enphase.yaml +++ b/templates/definition/meter/enphase.yaml @@ -5,13 +5,15 @@ products: generic: IQ Envoy params: - name: usage - choice: ["grid", "pv"] + choice: ["grid", "pv", "battery"] - name: host required: true - name: token help: en: "Required if Envoy Firmware D7.x.xxx. Token is valid for one year. Instructions for obtaining a token via web UI: https://enphase.com/download/accessing-iq-gateway-local-apis-or-local-ui-token-based-authentication" de: "Ab Envoy Firmware D7.x.xxx notwendig. Token ist ein Jahr gültig. Anleitung (Obtaining a token via web UI): https://enphase.com/download/accessing-iq-gateway-local-apis-or-local-ui-token-based-authentication" + - name: capacity + advanced: true render: | type: custom {{- if eq .usage "grid" }} @@ -26,7 +28,6 @@ render: | insecure: true {{- end }} jq: .consumption[] | select(.measurementType == "net-consumption").wNow - scale: 1 energy: source: http uri: http://{{ .host }}/production.json @@ -52,7 +53,6 @@ render: | insecure: true {{- end }} jq: .production[] | select(.measurementType == "production").wNow - scale: 1 energy: source: http uri: http://{{ .host }}/production.json @@ -66,3 +66,30 @@ render: | jq: .production[] | select(.measurementType == "production").whLifetime scale: 0.001 {{- end }} + {{- if eq .usage "battery" }} + power: + source: http + uri: http://{{ .host }}/production.json?details=1 + method: GET + {{- if .token }} + auth: + type: bearer + password: {{ .token }} + insecure: true + {{- end }} + jq: .storage[] | select(.type == "acb").wNow + soc: + source: http + uri: http://{{ .host }}/ivp/ensemble/inventory + method: GET + {{- if .token }} + auth: + type: bearer + password: {{ .token }} + insecure: true + {{- end }} + jq: .[].devices | map(.percentFull) | add / length + {{- if .capacity }} + capacity: {{ .capacity }} # kWh + {{- end }} + {{- end }} diff --git a/templates/docs/meter/enphase_0.yaml b/templates/docs/meter/enphase_0.yaml index 09000212a..9d2ee2ca2 100644 --- a/templates/docs/meter/enphase_0.yaml +++ b/templates/docs/meter/enphase_0.yaml @@ -9,6 +9,12 @@ render: usage: grid host: 192.0.2.2 # IP-Adresse oder Hostname token: # Ab Envoy Firmware D7.x.xxx notwendig. Token ist ein Jahr gültig. Anleitung (Obtaining a token via web UI): https://enphase.com/download/accessing-iq-gateway-local-apis-or-local-ui-token-based-authentication (Optional) + advanced: | + type: template + template: enphase + usage: grid + host: 192.0.2.2 # IP-Adresse oder Hostname + token: # Ab Envoy Firmware D7.x.xxx notwendig. Token ist ein Jahr gültig. Anleitung (Obtaining a token via web UI): https://enphase.com/download/accessing-iq-gateway-local-apis-or-local-ui-token-based-authentication (Optional) - usage: pv default: | type: template @@ -16,3 +22,23 @@ render: usage: pv host: 192.0.2.2 # IP-Adresse oder Hostname token: # Ab Envoy Firmware D7.x.xxx notwendig. Token ist ein Jahr gültig. Anleitung (Obtaining a token via web UI): https://enphase.com/download/accessing-iq-gateway-local-apis-or-local-ui-token-based-authentication (Optional) + advanced: | + type: template + template: enphase + usage: pv + host: 192.0.2.2 # IP-Adresse oder Hostname + token: # Ab Envoy Firmware D7.x.xxx notwendig. Token ist ein Jahr gültig. Anleitung (Obtaining a token via web UI): https://enphase.com/download/accessing-iq-gateway-local-apis-or-local-ui-token-based-authentication (Optional) + - usage: battery + default: | + type: template + template: enphase + usage: battery + host: 192.0.2.2 # IP-Adresse oder Hostname + token: # Ab Envoy Firmware D7.x.xxx notwendig. Token ist ein Jahr gültig. Anleitung (Obtaining a token via web UI): https://enphase.com/download/accessing-iq-gateway-local-apis-or-local-ui-token-based-authentication (Optional) + advanced: | + type: template + template: enphase + usage: battery + host: 192.0.2.2 # IP-Adresse oder Hostname + token: # Ab Envoy Firmware D7.x.xxx notwendig. Token ist ein Jahr gültig. Anleitung (Obtaining a token via web UI): https://enphase.com/download/accessing-iq-gateway-local-apis-or-local-ui-token-based-authentication (Optional) + capacity: 50 # Akkukapazität in kWh (Optional)