136 lines
4.6 KiB
YAML
136 lines
4.6 KiB
YAML
template: sonnenbatterie
|
|
covers: ["sonnenbatterie-eco10"]
|
|
products:
|
|
- brand: Sonnen
|
|
description:
|
|
generic: sonnenBatterie
|
|
capabilities: ["battery-control"]
|
|
requirements:
|
|
description:
|
|
de: |
|
|
Für die aktive Batteriesteuerung muss über das Webinterface der sonnenBatterie (unter Software-Integration) das "JSON Write API" aktiviert und das dort generierte API-Token in der Batteriekonfiguration unter `token` eingetragen werden.
|
|
Als Betriebsart der sonnenBatterie werden die beiden Modi "Eigenverbrauch" (Standard) und "Time-of-use" unterstützt. Der Modus kann über den Parameter `defaultmode` an die Konfiguration der sonnenBatterie angepasst werden.
|
|
Die Leistung für das Netzladen kann an die Wechselrichterleistung der sonnenBatterie über den Parameter `maxchargepower` angepasst werden.
|
|
en: |
|
|
For active battery control, the "JSON Write API" must be activated via the sonnenBatterie web interface (under Software-Integration) and the API token generated there must be entered in the battery configuration under `token`.
|
|
The two operating modes supported for the sonnenBatterie are "self-consumption" (default) and "time-of-use". The mode can be adapted to the configuration of the sonnenBatterie via the 'defaultmode' parameter.
|
|
The power for grid charging can be adapted to the inverter power of the sonnenBatterie via the `maxchargepower` parameter.
|
|
params:
|
|
- name: usage
|
|
choice: ["grid", "pv", "battery"]
|
|
- name: host
|
|
- name: port
|
|
default: 8080
|
|
- preset: battery-params
|
|
- name: maxchargepower
|
|
default: 3300
|
|
- name: token
|
|
help:
|
|
de: API Token (benötigt für aktive Batteriesteuerung)
|
|
en: API Token (required for active battery control)
|
|
usages: ["battery"]
|
|
- name: defaultmode
|
|
type: choice
|
|
choice: ["self-consumption", "time-of-use"]
|
|
default: self-consumption
|
|
required: true
|
|
- name: cache
|
|
default: 1s
|
|
- name: chargepower
|
|
deprecated: true
|
|
render: |
|
|
type: custom
|
|
power:
|
|
source: http
|
|
uri: http://{{ .host }}:{{ .port }}/api/v1/status
|
|
cache: {{ .cache }}
|
|
{{- if eq .usage "grid" }}
|
|
jq: .GridFeedIn_W
|
|
scale: -1 # reverse direction
|
|
{{- end }}
|
|
{{- if eq .usage "pv" }}
|
|
jq: .Production_W
|
|
{{- end }}
|
|
{{- if eq .usage "battery" }}
|
|
jq: .Pac_total_W
|
|
soc:
|
|
source: http
|
|
uri: http://{{ .host }}:{{ .port }}/api/v1/status
|
|
cache: {{ .cache }}
|
|
jq: .USOC
|
|
{{- if .token }}
|
|
batterymode:
|
|
source: switch
|
|
switch:
|
|
- case: 1 # normal
|
|
set:
|
|
source: http
|
|
uri: http://{{ .host }}/api/v2/configurations
|
|
insecure: true
|
|
method: PUT
|
|
headers:
|
|
- content-type: application/json
|
|
- Auth-Token: {{ .token }}
|
|
{{- if eq .defaultmode "time-of-use" }}
|
|
body: '{"EM_OperatingMode":"10"}' # Time-of-use
|
|
{{- else }}
|
|
body: '{"EM_OperatingMode":"2"}' # Self-consumption
|
|
{{- end }}
|
|
- case: 2 # hold
|
|
set:
|
|
source: sequence
|
|
set:
|
|
- source: http
|
|
uri: http://{{ .host }}/api/v2/configurations
|
|
insecure: true
|
|
method: PUT
|
|
headers:
|
|
- content-type: application/json
|
|
- Auth-Token: {{ .token }}
|
|
body: '{"EM_OperatingMode":"1"}' # Manual
|
|
- source: http
|
|
uri: http://{{ .host }}/api/v2/setpoint/discharge/0
|
|
insecure: true
|
|
method: POST
|
|
headers:
|
|
- content-type: application/json
|
|
- Auth-Token: {{ .token }}
|
|
- source: http
|
|
uri: http://{{ .host }}/api/v2/setpoint/charge/0
|
|
insecure: true
|
|
method: POST
|
|
headers:
|
|
- content-type: application/json
|
|
- Auth-Token: {{ .token }}
|
|
- case: 3 # charge
|
|
set:
|
|
source: sequence
|
|
set:
|
|
- source: http
|
|
uri: http://{{ .host }}/api/v2/configurations
|
|
insecure: true
|
|
method: PUT
|
|
headers:
|
|
- content-type: application/json
|
|
- Auth-Token: {{ .token }}
|
|
body: '{"EM_OperatingMode":"1"}' # manual
|
|
- source: http
|
|
uri: http://{{ .host }}/api/v2/setpoint/discharge/0
|
|
insecure: true
|
|
method: POST
|
|
headers:
|
|
- content-type: application/json
|
|
- Auth-Token: {{ .token }}
|
|
- source: http
|
|
uri: http://{{ .host }}/api/v2/setpoint/charge/{{ .maxchargepower }}
|
|
insecure: true
|
|
method: POST
|
|
headers:
|
|
- content-type: application/json
|
|
- Auth-Token: {{ .token }}
|
|
default:
|
|
source: error
|
|
error: ErrNotAvailable
|
|
{{- end }}
|
|
{{- include "battery-params" . }}
|
|
{{- end }}
|