The only way to get data from my Sonnen Battery eco6 (from 2013) is to send a browser URL and the return is a list of battery parameters in the browser.
Later models have a different API and a HA integration.
I have no programming knowledge, just basic understanding.
How can I get entities for each parameter in HA to be used in Energy Dashboard?
I enter in Firfox: http://192.168.178.xx:7979/rest/devices/battery
The result is a list:
{
“C07”: 0,
“C08”: 0,
“C09”: 0,
“C10”: 0,
“C11”: 0,
“C12”: 0,
“C23”: 0,
“C24”: 0,
“M03”: 0,
“M04”: 976.1,
“M05”: 0,
“M06”: 10,
“M07”: 801.8,
“M08”: 60.4,
“M09”: 113.9,
“M30”: 0,
“M31”: 20260000,
…
}
There are more items, which I just deleted.
Anybody with some experience? I think ist has to do with JSON somehow…
Thanks a lot
Peter
I have an old Sonnen Batterie, too.
In the past I got my data via IO-Broker and stored in in InfluxDB and
visualized it with Grafana (2015-2025)
Meanwhile I started again with Home Assistant as it is more advanced,
than years ago.
How to
a) add file editor to HA
b) edit configuration.yaml
rest:
resource: http://192.168.178.48:7979/rest/devices/battery
method: GET
headers:
User-Agent: Home Assistant
Content-Type: application/json
scan_interval: 60
timeout: 15
sensor:
- name: "Sonnenbatterie current pv power"
value_template: '{{ value_json["M03"] }}'
unit_of_measurement: W
device_class: energy
- name: "Sonnenbatterie current total consumption"
value_template: '{{ value_json["M04"] }}'
unit_of_measurement: W
device_class: power
- name: "Sonnenbatterie display state of charge (SOC)"
value_template: '{{ value_json["M05"] }}'
unit_of_measurement: '%'
device_class: battery
- name: "Sonnenbatterie current consumption L1"
value_template: '{{ value_json["M07"] }}'
unit_of_measurement: W
device_class: power
- name: "Sonnenbatterie current consumption L2"
value_template: '{{ value_json["M08"] }}'
unit_of_measurement: W
device_class: power
- name: "Sonnenbatterie current consumption L3"
value_template: '{{ value_json["M09"] }}'
unit_of_measurement: W
device_class: power
- name: "Sonnenbatterie soc relative to usable capacity"
value_template: '{{ value_json["M30"] }}'
unit_of_measurement: '%'
device_class: battery
- name: "Sonnenbatterie total stored energy over lifetime"
value_template: '{{ value_json["M31"] }}'
unit_of_measurement: kWh
device_class: battery
- name: "Sonnenbatterie current discharging power"
value_template: '{{ value_json["M34"] }}'
unit_of_measurement: W
device_class: power
- name: "Sonnenbatterie current charging power"
value_template: '{{ value_json["M35"] }}'
unit_of_measurement: W
device_class: power
- name: "Sonnenbatterie current feed in"
value_template: '{{ value_json["M38"] }}'
unit_of_measurement: W
device_class: power
- name: "Sonnenbatterie usable battery capacity"
value_template: '{{ value_json["S69"] }}'
unit_of_measurement: Wh
device_class: battery
This will get you some new sensor data / entities.
To integrate them into the Energy View, you
need a helper function:
Intergral Sensor (Left Riemann sum).
This will give ou a sum function.
e.g.
Sonnenbatteri current pv power = PV production per day