evcc-io/templates/definition/meter/openems.yaml
2026-01-25 18:54:37 +01:00

167 lines
5.1 KiB
YAML

template: openems
products:
- brand: OpenEMS
description:
generic: REST-API
- brand: FENECON
description:
generic: REST-API
capabilities: ["battery-control"]
requirements:
description:
de: |
##### Lizenzhinweis:
Für FENECON FEMS Systeme ist für die aktive Batteriesteuerung eine kommerzielle Lizenz *FEMS App REST/JSON Schreibzugriff* erforderlich.
##### FEMS-Dokumentation:
- FEMS App REST/JSON Lesezugriff: [docs.fenecon.de](https://docs.fenecon.de/de/fems/fems-app/App_REST-JSON_Lesezugriff.html)
- FEMS App REST/JSON Schreibzugriff: [docs.fenecon.de](https://docs.fenecon.de/de/fems/fems-app/App_REST-JSON_Schreibzugriff.html)
##### OpenEMS-Dokumentation:
- OpenEMS Edge REST-Api Controller: [openems.github.io](https://openems.github.io/openems.io/openems/latest/edge/controller.html#_rest_api_controller)
en: |
##### License notice:
For active battery control on FENECON FEMS systems, a commercial license (*FEMS App REST/JSON Write Access*) is required.
##### FEMS documentation:
- FEMS App REST/JSON Read Access: [docs.fenecon.de](https://docs.fenecon.de/en/fems/fems-app/App_REST-JSON_Lesezugriff.html)
- FEMS App REST/JSON Write Access: [docs.fenecon.de](https://docs.fenecon.de/en/fems/fems-app/App_REST-JSON_Schreibzugriff.html)
##### OpenEMS documentation:
- OpenEMS Edge REST-Api Controller: [openems.github.io](https://openems.github.io/openems.io/openems/latest/edge/controller.html#_rest_api_controller)
params:
- name: usage
choice: ["grid", "pv", "battery"]
- name: host
- name: password
default: user
advanced: true
- name: maxacpower
- name: battery
example: ess0
description:
de: Steuerbare Batterie Komponente
en: Controllable battery component
help:
de: aktive Batteriesteuerung (REST/JSON schreibend)
en: active battery control (REST/JSON Write Access)
usages: ["battery"]
advanced: true
- name: watchdog
type: duration
default: 60s
description:
de: FEMS/OpenEMS Batteriesteuerung API-Timeout
en: FEMS/OpenEMS battery control API timeout
help:
de: FEMS/OpenEMS Standard 60s
en: FEMS/OpenEMS standard 60s
usages: ["battery"]
advanced: true
- preset: battery-params
render: |
type: custom
{{- if eq .usage "grid" }}
power:
source: http
uri: http://{{ .host }}/rest/channel/_sum/GridActivePower
auth:
type: basic
user: x
password: {{ .password }}
jq: (.value // 0)
energy:
source: http
uri: http://{{ .host }}/rest/channel/_sum/GridBuyActiveEnergy
auth:
type: basic
user: x
password: {{ .password }}
jq: (.value / 1000 // 0) # convert Wh to kWh
{{- end }}
{{- if eq .usage "pv" }}
power:
source: http
uri: http://{{ .host }}/rest/channel/_sum/ProductionActivePower
auth:
type: basic
user: x
password: {{ .password }}
jq: (.value // 0)
energy:
source: http
uri: http://{{ .host }}/rest/channel/_sum/ProductionActiveEnergy
auth:
type: basic
user: x
password: {{ .password }}
jq: (.value / 1000 // 0) # convert Wh to kWh
maxacpower: {{ .maxacpower }} # W
{{- end }}
{{- if eq .usage "battery" }}
power:
source: http
uri: http://{{ .host }}/rest/channel/_sum/EssDischargePower
auth:
type: basic
user: x
password: {{ .password }}
jq: (.value // 0)
soc:
source: http
uri: http://{{ .host }}/rest/channel/_sum/EssSoc
auth:
type: basic
user: x
password: {{ .password }}
jq: (.value // 0)
{{- if .battery }}
batterymode:
source: watchdog
timeout: {{ .watchdog }} # re-write at timeout/2
reset: 1
set:
source: switch
switch:
- case: 1 # normal
set:
source: http
uri: http://{{ .host }}/rest/channel/{{ .battery }}/SetActivePowerLessOrEquals
auth:
type: basic
user: x
password: {{ .password }}
method: POST
headers:
- content-type: application/json
body: '{"value": 0}'
- case: 2 # hold
set:
source: http
uri: http://{{ .host }}/rest/channel/{{ .battery }}/SetActivePowerLessOrEquals
auth:
type: basic
user: x
password: {{ .password }}
method: POST
headers:
- content-type: application/json
body: '{"value": 0}'
- case: 3 # charge
set:
{{- if .maxchargepower }}
source: http
uri: http://{{ .host }}/rest/channel/{{ .battery }}/SetActivePowerLessOrEquals
auth:
type: basic
user: x
password: {{ .password }}
method: POST
headers:
- content-type: application/json
body: '{"value": {{ mul .maxchargepower -1 }}}' # charge power is negative
{{- else }}
source: error
error: ErrNotAvailable
{{- end }}
{{- end }}
{{- include "battery-params" . }}
{{- end }}