Oh sorry for not answering for so long. I thought the forum would send E-Mails (I set the thread to watching).
No I have not yet figured out how/if you can get those values via Modbus. For those values I use the REST API. (And I am not sure if the endpoints other than the _sum/ channels are officially supported, but it works fine)
You can find out which API-Endpoints exist by either looking at the Websocket Connection in the Browser Dev Tools (FEMS) or by sending requests like the following one in the Talend API Tester (The setup of that is described by Fenecon here):
http://<YOUR IP HERE>:8084/rest/channel/charger.+/.+
This gets every value from every charger (PV-String) (for example the voltages or production values), it works because the REST API apparently supports some kind of Regex. (Thanks for openWB, I saw that trick in their source code, you could also look at the openEMS-Source-Code)
The first part after the channel is the same as in the “Anlagenprofil”:
I have to use the selectattr("address", "equalto", "battery0/Tower0PackVoltage") | map(attribute="value") | first
filter because the order of the response is kind of random, so you should not use a simple [2] for example.
(Please let me know if there is a better way to do that.)
Alternatively you could send responses for every value, but I do not like that approach as that would send to many HTTP-Requests for my taste. (AFAIK there is basically just a poor Raspberry Pi running the FEMS-Box.)
This is my current REST-Configuration (for example for getting the temperatures):
(You need to replace the IP for every URL)
- resource: "http://<YOUR IP HERE>:8084/rest/channel/battery0/(Tower0PackVoltage|Current|Soh)"
username: x
password: user
authentication: basic
scan_interval: 60
sensor:
- value_template: '{{value_json | selectattr("address", "equalto", "battery0/Tower0PackVoltage") | map(attribute="value") | first / 10 }}'
name: "FEMS Batteriespannung"
unit_of_measurement: "V"
device_class: voltage
state_class: measurement
unique_id: "fems/battery0/Tower0PackVoltage"
- value_template: '{{value_json | selectattr("address", "equalto", "battery0/Current") | map(attribute="value") | first }}'
name: "FEMS Batteriestrom"
unit_of_measurement: "A"
device_class: current
state_class: measurement
unique_id: "fems/battery0/Current"
- value_template: '{{value_json | selectattr("address", "equalto", "battery0/Soh") | map(attribute="value") | first }}'
name: "FEMS Batterie State of Health"
unit_of_measurement: "%"
#device_class: current
state_class: measurement
unique_id: "fems/battery0/Soh"
- resource: "http://<YOUR IP HERE>:8084/rest/channel/charger.+/(ActualPower|Voltage|Current|ActualEnergy)"
username: x
password: user
authentication: basic
scan_interval: 20
sensor:
- name: "FEMS PV 2 Leistung"
value_template: '{{value_json | selectattr("address", "equalto", "charger1/ActualPower") | map(attribute="value") | first }}'
unit_of_measurement: "W"
device_class: power
state_class: measurement
unique_id: "fems/charger1/ActualPower"
- value_template: '{{value_json | selectattr("address", "equalto", "charger1/Voltage") | map(attribute="value") | first / 1000 }}'
name: "FEMS PV 2 Spannung"
unit_of_measurement: "V"
device_class: voltage
state_class: measurement
unique_id: "fems/charger1/Voltage"
- value_template: '{{value_json | selectattr("address", "equalto", "charger1/Current") | map(attribute="value") | first / 1000 }}'
name: "FEMS PV 2 Strom"
unit_of_measurement: "A"
device_class: current
state_class: measurement
unique_id: "fems/charger1/Current"
- value_template: '{{value_json | selectattr("address", "equalto", "charger1/ActualEnergy") | map(attribute="value") | first }}'
name: "FEMS PV 2 Erzeugung"
unit_of_measurement: "Wh"
device_class: energy
state_class: total_increasing
unique_id: "fems/charger1/ActualEnergy"
- value_template: '{{value_json | selectattr("address", "equalto", "charger0/ActualPower") | map(attribute="value") | first }}'
name: "FEMS PV 1 Leistung"
unit_of_measurement: "W"
device_class: power
state_class: measurement
unique_id: "fems/charger0/ActualPower"
- value_template: '{{value_json | selectattr("address", "equalto", "charger0/Voltage") | map(attribute="value") | first / 1000 }}'
name: "FEMS PV 1 Spannung"
unit_of_measurement: "V"
device_class: voltage
state_class: measurement
unique_id: "fems/charger0/Voltage"
- value_template: '{{value_json | selectattr("address", "equalto", "charger0/Current") | map(attribute="value") | first / 1000 }}'
name: "FEMS PV 1 Strom"
unit_of_measurement: "A"
device_class: current
state_class: measurement
unique_id: "fems/charger0/Current"
- value_template: '{{value_json | selectattr("address", "equalto", "charger0/ActualEnergy") | map(attribute="value") | first }}'
name: "FEMS PV 1 Erzeugung"
unit_of_measurement: "Wh"
device_class: energy
state_class: total_increasing
unique_id: "fems/charger0/ActualEnergy"
- resource: "http://<YOUR IP HERE>:8084/rest/channel/batteryInverter0/(AirTemperature|BmsPackTemperature|RadiatorTemperature)"
username: x
password: user
authentication: basic
scan_interval: 60
sensor:
- value_template: '{{value_json | selectattr("address", "equalto", "batteryInverter0/AirTemperature") | map(attribute="value") | first }}'
name: "FEMS batteryInverter0/AirTemperature"
unit_of_measurement: "°C"
device_class: temperature
state_class: measurement
unique_id: "fems/batteryInverter0/AirTemperature"
- value_template: '{{value_json | selectattr("address", "equalto", "batteryInverter0/BmsPackTemperature") | map(attribute="value") | first }}'
name: "FEMS batteryInverter0/BmsPackTemperature"
unit_of_measurement: "°C"
device_class: temperature
state_class: measurement
unique_id: "fems/batteryInverter0/BmsPackTemperature"
- value_template: '{{value_json | selectattr("address", "equalto", "batteryInverter0/RadiatorTemperature") | map(attribute="value") | first }}'
name: "FEMS batteryInverter0/RadiatorTemperature"
unit_of_measurement: "°C"
device_class: temperature
state_class: measurement
unique_id: "fems/batteryInverter0/RadiatorTemperature"
To integrate it: (thanks to @Skeletitor for the clear instructions)
- ssh to /config/ and add to
configuration.yaml
or use the File Editor Addon
rest: !include rest_integration.yaml
- create a file
rest_integration.yaml
(in the same directory as configuration.yaml
and paste the upper code for the rest integration. Attention! Adjust the IP of your Fenecon installation in the multiple places. Also you should adjust the channels to those that are interesting to you.
- restart Home Assistant