From e8b4ff3d67a2fbbacb4ccdc4c5cd705903d9fc44 Mon Sep 17 00:00:00 2001 From: andig Date: Fri, 15 Aug 2025 11:35:01 +0200 Subject: [PATCH] Enphase: make schema configurable (#22996) --- templates/definition/meter/enphase.yaml | 25 ++++++++++++---------- templates/definition/meter/senec-home.yaml | 4 ---- util/templates/defaults.yaml | 6 ++++++ 3 files changed, 20 insertions(+), 15 deletions(-) diff --git a/templates/definition/meter/enphase.yaml b/templates/definition/meter/enphase.yaml index bd586327d..fbd99aa6b 100644 --- a/templates/definition/meter/enphase.yaml +++ b/templates/definition/meter/enphase.yaml @@ -11,6 +11,9 @@ params: - name: usage choice: ["grid", "pv", "battery"] - name: host + - name: schema + default: http + advanced: 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" @@ -25,7 +28,7 @@ render: | {{- if eq .usage "grid" }} power: source: http - uri: http://{{ .host }}/production.json + uri: {{ .schema }}://{{ .host }}/production.json?details=1 {{- if .token }} auth: type: bearer @@ -36,7 +39,7 @@ render: | jq: .consumption[] | select(.measurementType == "net-consumption").wNow currents: - source: http - uri: http://{{ .host }}/production.json?details=1 + uri: {{ .schema }}://{{ .host }}/production.json?details=1 {{- if .token }} auth: type: bearer @@ -46,7 +49,7 @@ render: | cache: {{ .cache }} 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 + uri: {{ .schema }}://{{ .host }}/production.json?details=1 {{- if .token }} auth: type: bearer @@ -56,7 +59,7 @@ render: | cache: {{ .cache }} 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 + uri: {{ .schema }}://{{ .host }}/production.json?details=1 {{- if .token }} auth: type: bearer @@ -69,7 +72,7 @@ render: | {{- if eq .usage "pv" }} power: source: http - uri: http://{{ .host }}/production.json + uri: {{ .schema }}://{{ .host }}/production.json?details=1 {{- if .token }} auth: type: bearer @@ -80,7 +83,7 @@ render: | 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 + uri: {{ .schema }}://{{ .host }}/production.json?details=1 {{- if .token }} auth: type: bearer @@ -92,7 +95,7 @@ render: | scale: 0.001 currents: - source: http - uri: http://{{ .host }}/production.json?details=1 + uri: {{ .schema }}://{{ .host }}/production.json?details=1 {{- if .token }} auth: type: bearer @@ -102,7 +105,7 @@ render: | cache: {{ .cache }} 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 + uri: {{ .schema }}://{{ .host }}/production.json?details=1 {{- if .token }} auth: type: bearer @@ -112,7 +115,7 @@ render: | cache: {{ .cache }} 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 + uri: {{ .schema }}://{{ .host }}/production.json?details=1 {{- if .token }} auth: type: bearer @@ -125,7 +128,7 @@ render: | {{- if eq .usage "battery" }} power: source: http - uri: http://{{ .host }}/production.json + uri: {{ .schema }}://{{ .host }}/production.json?details=1 {{- if .token }} auth: type: bearer @@ -136,7 +139,7 @@ render: | jq: .storage[] | .wNow soc: source: http - uri: http://{{ .host }}/ivp/ensemble/inventory + uri: {{ .schema }}://{{ .host }}/ivp/ensemble/inventory {{- if .token }} auth: type: bearer diff --git a/templates/definition/meter/senec-home.yaml b/templates/definition/meter/senec-home.yaml index 91a83f6bd..e3c4485ec 100644 --- a/templates/definition/meter/senec-home.yaml +++ b/templates/definition/meter/senec-home.yaml @@ -14,10 +14,6 @@ params: allinone: true - name: host - name: schema - description: - generic: Schema - type: choice - choice: ["https", "http"] default: https - name: capacity advanced: true diff --git a/util/templates/defaults.yaml b/util/templates/defaults.yaml index eaa2f5eb9..cf29b1fa0 100644 --- a/util/templates/defaults.yaml +++ b/util/templates/defaults.yaml @@ -66,6 +66,12 @@ params: en: Network interface advanced: true example: eth0 + - name: schema + description: + generic: Schema + type: choice + choice: ["https", "http"] + default: https - name: user description: de: Benutzerkonto