From 91592bbd264e643a73685ea092cdbd62cd88931f Mon Sep 17 00:00:00 2001 From: Bernd Krannich <12008975+berndkrannich@users.noreply.github.com> Date: Sat, 27 Jan 2024 10:35:40 +0100 Subject: [PATCH] Fronius Solar API: add battery control (#11879) --- .../definition/meter/fronius-solarapi-v1.yaml | 44 +++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/templates/definition/meter/fronius-solarapi-v1.yaml b/templates/definition/meter/fronius-solarapi-v1.yaml index 643f2eb0b..463543ab9 100644 --- a/templates/definition/meter/fronius-solarapi-v1.yaml +++ b/templates/definition/meter/fronius-solarapi-v1.yaml @@ -3,6 +3,7 @@ products: - brand: Fronius description: generic: Solar API V1 +capabilities: ["battery-control"] params: - name: usage choice: ["grid", "pv", "battery"] @@ -10,6 +11,10 @@ params: - name: host - name: capacity advanced: true + - name: user + required: false + - name: password + required: false render: | type: custom power: @@ -27,6 +32,45 @@ render: | source: http uri: http://{{ .host }}/solar_api/v1/GetPowerFlowRealtimeData.fcgi jq: .Body.Data.Inverters."1".SOC + batterymode: + source: switch + switch: + - case: 1 # normal + set: + source: http + uri: http://{{ .host }}/config/timeofuse + method: POST + headers: + - content-type: application/json + auth: + type: digest + user: {{ .user }} + password: {{ .password }} + body: '{"timeofuse":[]}' + - case: 2 # hold + set: + source: http + uri: http://{{ .host }}/config/timeofuse + method: POST + headers: + - content-type: application/json + auth: + type: digest + user: {{ .user }} + password: {{ .password }} + body: '{"timeofuse":[{"Active":true,"Power":0,"ScheduleType":"DISCHARGE_MAX","TimeTable":{"Start":"00:00","End":"23:59"},"Weekdays":{"Mon":true,"Tue":true,"Wed":true,"Thu":true,"Fri":true,"Sat":true,"Sun":true}}]}' + - case: 3 # charge + set: + source: http + uri: http://{{ .host }}/config/timeofuse + method: POST + headers: + - content-type: application/json + auth: + type: digest + user: {{ .user }} + password: {{ .password }} + body: '{"timeofuse":[]}' {{- if .capacity }} capacity: {{ .capacity }} # kWh {{- end }}