From 31aa841a4a88f373b7220fee5356a8d75a45b68f Mon Sep 17 00:00:00 2001 From: salz3n <79696598+salz3n@users.noreply.github.com> Date: Tue, 6 Jun 2023 11:45:38 +0200 Subject: [PATCH] Enphase: add token auth (firmware D7.x.xxx) and grid (#8247) --- templates/definition/meter/enphase.yaml | 51 +++++++++++++++++++++++-- templates/docs/meter/enphase_0.yaml | 8 ++++ templates/evcc.io/brands.json | 1 + 3 files changed, 57 insertions(+), 3 deletions(-) diff --git a/templates/definition/meter/enphase.yaml b/templates/definition/meter/enphase.yaml index 4b7a51176..b4b832ab4 100644 --- a/templates/definition/meter/enphase.yaml +++ b/templates/definition/meter/enphase.yaml @@ -5,19 +5,64 @@ products: generic: IQ Envoy params: - name: usage - choice: ["pv"] + choice: ["grid", "pv"] - 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" render: | type: custom + {{- if eq .usage "grid" }} power: source: http uri: http://{{ .host }}/production.json method: GET - jq: .production[0].wNow + {{- if .token }} + auth: + type: bearer + password: {{ .token }} + insecure: true + {{- end }} + jq: .consumption[] | select(.measurementType == "net-consumption").wNow + scale: 1 energy: source: http uri: http://{{ .host }}/production.json method: GET - jq: .production[0].whLifetime + {{- if .token }} + auth: + type: bearer + password: {{ .token }} + insecure: true + {{- end }} + jq: .consumption[] | select(.measurementType == "net-consumption").whLifetime scale: 0.001 + {{- end }} + {{- if eq .usage "pv" }} + power: + source: http + uri: http://{{ .host }}/production.json + method: GET + {{- if .token }} + auth: + type: bearer + password: {{ .token }} + insecure: true + {{- end }} + jq: .production[] | select(.measurementType == "production").wNow + scale: 1 + energy: + source: http + uri: http://{{ .host }}/production.json + method: GET + {{- if .token }} + auth: + type: bearer + password: {{ .token }} + insecure: true + {{- end }} + jq: .production[] | select(.measurementType == "production").whLifetime + scale: 0.001 + {{- end }} diff --git a/templates/docs/meter/enphase_0.yaml b/templates/docs/meter/enphase_0.yaml index 56bb9b54c..09000212a 100644 --- a/templates/docs/meter/enphase_0.yaml +++ b/templates/docs/meter/enphase_0.yaml @@ -2,9 +2,17 @@ product: brand: Enphase description: IQ Envoy render: + - usage: grid + default: | + 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 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) diff --git a/templates/evcc.io/brands.json b/templates/evcc.io/brands.json index 3a2a5c705..092397b88 100644 --- a/templates/evcc.io/brands.json +++ b/templates/evcc.io/brands.json @@ -84,6 +84,7 @@ "DZG", "E3/DC", "Eastron", + "Enphase", "FENECON", "FoxESS", "Fronius",