From 64664f0abf2a24ac7d081b5ea498dfc2b724082b Mon Sep 17 00:00:00 2001 From: jlegen Date: Sun, 4 May 2025 12:23:55 +0200 Subject: [PATCH] Add Victron VRM solar forecast (#20882) --- templates/definition/tariff/victron.yaml | 61 ++++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 templates/definition/tariff/victron.yaml diff --git a/templates/definition/tariff/victron.yaml b/templates/definition/tariff/victron.yaml new file mode 100644 index 000000000..560abbfc6 --- /dev/null +++ b/templates/definition/tariff/victron.yaml @@ -0,0 +1,61 @@ +template: victron +products: + - brand: Victron + description: + generic: VRM Solar Forecast +requirements: + description: + en: >- + [vrm.victronenergy.com](https://vrm.victronenergy.com) get the + 2-days-forecast from your installation in VRM portal. You need a free user + access token. + de: >- + [vrm.victronenergy.com](https://vrm.victronenergy.com) abrufen der + 2-Tage-Prognose einer Installation im VRM-Portal. Es wird ein kostenloses + User Access Token benoetigt. + evcc: ["skiptest"] +group: solar +params: + - name: idsite + description: + en: VRM Site ID of the installation + de: VRM-Installations-ID der Installation + help: + en: The VRM Site ID is displayed in the intallation settings under "General" + de: Die VRM-Installations-ID wird in den Einstellungen der Installation unter "Allgemeines" angezeigt + example: 123456 + required: true + - name: token + description: + en: API access token + de: API Zugriffstoken + help: + en: Tokens can be created in VRM in Preferences->Integrations + de: Token können im VRM erstellt werden unter Präferenzen->Integrationen + required: true + - name: interval + default: 1h + advanced: true +render: > + {{- $n := now -}} + {{- $start := $n | unixEpoch | int -}} + {{- $end := add $start 172800 -}} + + type: custom + tariff: solar + forecast: + source: http + uri: >- + https://vrmapi.victronenergy.com/v2/installations/{{ .idsite }} + /stats?start={{ $start }}&end={{ $end }} + &interval=hours&type=forecast + method: "GET" + headers: + - X-Authorization: "Token {{ .token }}" + jq: | + .records.solar_yield_forecast | map({ + "start": ((.[0] / 1000) | todateiso8601), + "end": (((.[0] + 3600000) / 1000 ) | todateiso8601), + "value": .[1] + }) | tostring + interval: {{ .interval }}