Hi!
We will soon move to our new hom and ofc HA will be a part there also. We will be producing solar power enough to not have to use the grid almost at all with the help of 16 kWh sonnenBatterie system from Germany. Would be nice to be able to integrate the also the batterie system in HA but I cant find anything about it.
Here is a link for homematic integration. The script runs under homematic. The data from the sonnenbatterie are visualize in home assistant. it should be easy to transform the script to home assistant.
BR Oliver
https://homematic-forum.de/forum/viewtopic.php?f=26&t=42786&p=425615&hilit=sonnen+rsoc#p427667
After having a look at the link @Oliver_Baumgart has posted this could probably already be done with the RESTful sensor manually.
Daniel. thanx for the tip.
Here solution with the Restful sensor:
- platform: rest
name: JSON sonnen
json_attributes:
- Consumption_W
- GridFeedIn_W
- Production_W
- USOC
resource: http://ip_sonnenbatterie:8080/api/v1/status
value_template: '{{ value_json.sonnen }}'
- platform: template
sensors:
sonnen_stromverbrauch:
friendly_name: 'Stromverbrauch W'
value_template: '{{ states.sensor.json_sonnen.attributes["Consumption_W"] }}'
sonnen_stromeinspeisung:
friendly_name: 'Stromeinspeisung W'
value_template: '{{ states.sensor.json_sonnen.attributes["GridFeedIn_W"] }}'
sonnen_stromerzeugung:
friendly_name: 'Stromeinspeisung W'
value_template: '{{ states.sensor.json_sonnen.attributes["Production_W"] }}'
sonnen_stromspeicher:
friendly_name: 'Batteriespeicher %'
value_template: '{{ states.sensor.json_sonnen.attributes["USOC"] }}'
Thanks forvthis. Will be tested when we sre in place and our solar is installed
Is there a way to create an array from each variable so they can be plotted in lovelace in a history-graph.
This image is from Sonnen web site and plots data from my battery. Would be useful to see this in HA.
I have two Gen 1 sonnen eCO 16s and used the REST sensor to create a display. However at least on the Gen1s the rest API is very slow and unresponsive. I have several tickets and feature requests open with Sonnen support. Maybe now that Shell purchased them, their dev team will ramp up!
Interesting. Didn’t know Shell had bought them. They’re setting up a factory in South Australia so are a favourite in Australia.
I have an eco 9.43/10. Used the rest scripts and present usable state of charge in a gauge card and power generation in a line graph. all I need.
hey Robert, the “posted” normal API doesn’t work at my Sonnenbatterie (eco, 9Kw), but the REST api works fine - BUT I am “newbie” - are you able to send me the “files” for Your integration auf all parameters? I doesn’t find a working configuration otherwise. THX
Uwe
All I do is read the available data from the battery via rest API.
This is in my configuration.yaml file:
sensor:
# Sonnen Battery
- platform: rest
name: JSON sonnen
json_attributes:
- Consumption_W
- GridFeedIn_W
- Production_W
- USOC
resource: http://192.168.0.8:8080/api/v1/status
value_template: '{{ value_json.sonnen }}'
- platform: template
sensors:
sonnen_stromverbrauch:
friendly_name: 'Power Consumption W'
value_template: '{{ states.sensor.json_sonnen.attributes["Consumption_W"] }}'
unit_of_measurement: watt
sonnen_stromeinspeisung:
friendly_name: 'Electricity Feed In W'
value_template: '{{ states.sensor.json_sonnen.attributes["GridFeedIn_W"] }}'
unit_of_measurement: watt
sonnen_stromerzeugung:
friendly_name: 'Power Generation W'
value_template: '{{ states.sensor.json_sonnen.attributes["Production_W"] }}'
unit_of_measurement: watt
sonnen_stromspeicher:
friendly_name: 'Remaining Charge %'
value_template: '{{ states.sensor.json_sonnen.attributes["USOC"] }}'
Then I use these variables in lovelace cards for example:
entity: sensor.sonnen_stromspeicher
max: 100
min: 0
name: SOC
severity:
green: 100
red: 0
yellow: 0
theme: default
type: gauge
This produces the following in Lovelace:
And this:
entities:
- sensor.sonnen_stromerzeugung
- sensor.sonnen_stromverbrauch
- sensor.sonnen_stromeinspeisung
hours_to_show: 24
refresh_interval: 10
title: Power
type: history-graph
Produces this:
Does this help?
hey Robert, thx again … It works from the code point of view. But I remember in a message from other users, that “sonnen” block the API in new version of the software. I´ve got a update end of year 2019. my sonnen battery is from 2014. how it works with the “direct” way (URL: http://192.168.178.XX:7979/rest/devices/battery/M05)? return of this call is the “USOC”-value? thx in advance! uwe
the error message from “home-assistant-log”: Protokolldetails ( ERROR )
Sun Feb 23 2020 11:23:45 GMT+0100 (CET)
Error fetching data: http://192.168.178.xx:8080/api/v1/status failed with HTTPConnectionPool(host=‘192.168.178.xx’, port=8080): Max retries exceeded with url: /api/v1/status (Caused by NewConnectionError(’<urllib3.connection.HTTPConnection object at 0x7fb3d53710>: Failed to establish a new connection: [Errno 111] Connection refused’))
What version of the software do you have?
Mine seems to be: 1.2.0.478292 – Channel: stable
HW Version: 5.03 und SW Version 5.00 (438) - I created a ticket to Sonnen SUPPORT … THX! BR …
hello Robert, I´ve got the actual documentary from sonnen … the right call is http://192.168.178.xx:3480/data_request?id=sdata - I have also the documentation of the values - how would be the “Jason/YAML” notation than? many thx in advance BR uwe
Hi! Do you know if this will work in the US? I have 2 sonnen Ecolinx 16 and they are driving my crazy! Sonnen is useless! They won’t discharge so I am having to learn about the api’s and try and program them myself. Any advice would be wonderful! Thank you in advance!