weltmeyer / ha_sonnenbatterie Goto Github PK
View Code? Open in Web Editor NEWHomeassistant integration to show many stats of Sonnenbatterie
License: GNU General Public License v3.0
Homeassistant integration to show many stats of Sonnenbatterie
License: GNU General Public License v3.0
Hello I have a SonnenBatterie 10 (with 11kW),
but the sensor only show me a capacity from 4800 W
di i do something wrong?
Modell: power unit sB10s sI1 9010 IP30 sDCM
Firmware is 1.6.18
Can you help me?
Thank you
in the last 2 updates my HA is not able to receive Temp and Charga/Discharge status, is it only a problem of my installation or is it an issue?
this is that I found in the log file
2024-06-10 02:29:54.657 ERROR (MainThread) [custom_components.sonnenbatterie] Traceback (most recent call last):
File "/config/custom_components/sonnenbatterie/coordinator.py", line 83, in _async_update_data
self.latestData["battery"] = await self.hass.async_add_executor_job(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/concurrent/futures/thread.py", line 58, in run
result = self.fn(*self.args, **self.kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/sonnenbatterie/sonnenbatterie.py", line 142, in get_battery
return self._get(SONNEN_API_PATH_BATTERY)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/sonnenbatterie/sonnenbatterie.py", line 71, in _get
response.raise_for_status()
File "/usr/local/lib/python3.12/site-packages/requests/models.py", line 1024, in raise_for_status
raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 502 Server Error: Bad Gateway for url: http://192.168.178.51/api/battery
2024-06-10 02:30:04.852 ERROR (MainThread) [custom_components.sonnenbatterie] Traceback (most recent call last):
File "/config/custom_components/sonnenbatterie/coordinator.py", line 83, in _async_update_data
self.latestData["battery"] = await self.hass.async_add_executor_job(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/concurrent/futures/thread.py", line 58, in run
result = self.fn(*self.args, **self.kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/sonnenbatterie/sonnenbatterie.py", line 142, in get_battery
return self._get(SONNEN_API_PATH_BATTERY)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/sonnenbatterie/sonnenbatterie.py", line 71, in _get
response.raise_for_status()
File "/usr/local/lib/python3.12/site-packages/requests/models.py", line 1024, in raise_for_status
raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 502 Server Error: Bad Gateway for url: http://192.168.178.51/api/battery
2024-06-10 02:30:14.851 ERROR (MainThread) [custom_components.sonnenbatterie] Traceback (most recent call last):
File "/config/custom_components/sonnenbatterie/coordinator.py", line 83, in _async_update_data
self.latestData["battery"] = await self.hass.async_add_executor_job(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/concurrent/futures/thread.py", line 58, in run
result = self.fn(*self.args, **self.kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/sonnenbatterie/sonnenbatterie.py", line 142, in get_battery
return self._get(SONNEN_API_PATH_BATTERY)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/sonnenbatterie/sonnenbatterie.py", line 71, in _get
response.raise_for_status()
File "/usr/local/lib/python3.12/site-packages/requests/models.py", line 1024, in raise_for_status
raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 502 Server Error: Bad Gateway for url: http://192.168.178.51/api/battery
2024-06-10 02:30:24.847 ERROR (MainThread) [custom_components.sonnenbatterie] Traceback (most recent call last):
File "/config/custom_components/sonnenbatterie/coordinator.py", line 83, in _async_update_data
self.latestData["battery"] = await self.hass.async_add_executor_job(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/concurrent/futures/thread.py", line 58, in run
result = self.fn(*self.args, **self.kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/sonnenbatterie/sonnenbatterie.py", line 142, in get_battery
return self._get(SONNEN_API_PATH_BATTERY)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/sonnenbatterie/sonnenbatterie.py", line 71, in _get
response.raise_for_status()
File "/usr/local/lib/python3.12/site-packages/requests/models.py", line 1024, in raise_for_status
raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 502 Server Error: Bad Gateway for url: http://192.168.178.51/api/battery
Hi
I want to install the integration, and I followed the guide here to get HACS installed
https://hacs.xyz/docs/setup/prerequisites
However I can't find it in HACS, am I doing something wrong?
Also looked under HA_sonnenbattery - but nothing there as well
Thanks in advance!
Hi,
I have installed the latest version of HA 2021.8
Unfortunately, the sonnebatterie data is not recognized by HA as power management.
Is it possible that the integration was not designed for this?
Update: I found what the entity needs to be availible in Energy :
state_class: measurement
last_reset: 1970-01-01T00:00:00+00:00
unit_of_measurement: kWh
device_class: energy
Since the last weeks my Sonnenbatteri integrations freeze and drop entites intermittently. Could it be related to the inactivation functinality of "unavailable sensors"?
This started at the same time as i added a second battery (I have one ECO 8 and one 10P), but it may be unrelated, as someone else alse asks about this error in the forum at the same time (9 days ago):
https://community.home-assistant.io/t/custom-integration-sonnenbatterie/181781/179?u=johanschelin
For example even my State of Charge sensors get unavailable. A total restart of HA brings them back sometimes, but at the moment I cant seem to get them back at all. Attaching a debug log.
Can I do something more to help with the troubleshooting?
Can the api this integration calls get the PPV2 values? After losing access to the installer section(Sonnen upgrade) i can't get readings for the secondary ppv in the ui. But it looks like the api here returns it, just doesn't populate sensor values?
@Xitee1 Since the update I'm seeing these meters report undefined
when their actual value should be 0
:
meter_production_a_l1
meter_production_a_l2
meter_production_a_l3
meter_production_w_l1
meter_production_w_l2
meter_production_w_l3
meter_production_w_total
To me this looks like a division by zero error somewhere in the code but I can't find any logs to that effect.
Since upgrade to latest version be1b593 this error comes at every restart in the HA log:
inverter_status_fac' not in inverter/status/status/fac -> disabled
I had some issues with the integration and decided to do a re-install.
Now it seems I can no longer find my battery on my network?
https://find-my.sonnen-batterie.com/ provides 172.16.172.14 as IP but I this does not seem as a valid IP address (I cannot find u via my router) and when I click on Assistant 2.0 the page does not load...
Anybody knows how to fix this issue so I can add my battery back to Home Assistant..?
Thanks in advance!
I don't know if your are accepting issues, but I thought I might give it a try. The integration is causing warnings during HA startup:
2020-12-11 11:58:43 WARNING (MainThread) [homeassistant.util.async_] Detected I/O inside the event loop. This is causing stability issues. Please report issue to the custom component author for sonnenbatterie doing I/O at custom_components/sonnenbatterie/sensor.py, line 134: self.latestData["battery"]=self.sbInst.get_battery()
2020-12-11 11:58:43 WARNING (MainThread) [homeassistant.util.async_] Detected I/O inside the event loop. This is causing stability issues. Please report issue to the custom component author for sonnenbatterie doing I/O at custom_components/sonnenbatterie/sensor.py, line 133: self.latestData["status"]=self.sbInst.get_status()
2020-12-11 11:58:43 WARNING (MainThread) [homeassistant.util.async_] Detected I/O inside the event loop. This is causing stability issues. Please report issue to the custom component author for sonnenbatterie doing I/O at custom_components/sonnenbatterie/sensor.py, line 132: self.latestData["systemdata"]=self.sbInst.get_systemdata()
2020-12-11 11:58:43 WARNING (MainThread) [homeassistant.util.async_] Detected I/O inside the event loop. This is causing stability issues. Please report issue to the custom component author for sonnenbatterie doing I/O at custom_components/sonnenbatterie/sensor.py, line 131: self.latestData["inverter"]=self.sbInst.get_inverter()
2020-12-11 11:58:43 WARNING (MainThread) [homeassistant.util.async_] Detected I/O inside the event loop. This is causing stability issues. Please report issue to the custom component author for sonnenbatterie doing I/O at custom_components/sonnenbatterie/sensor.py, line 130: self.latestData["battery_system"]=self.sbInst.get_batterysystem()
2020-12-11 11:58:43 WARNING (MainThread) [homeassistant.util.async_] Detected I/O inside the event loop. This is causing stability issues. Please report issue to the custom component author for sonnenbatterie doing I/O at custom_components/sonnenbatterie/sensor.py, line 129: self.latestData["powermeter"]=self.sbInst.get_powermeter()
2020-12-11 11:58:43 WARNING (MainThread) [homeassistant.util.async_] Detected I/O inside the event loop. This is causing stability issues. Please report issue to the custom component author for sonnenbatterie doing I/O at custom_components/sonnenbatterie/sensor.py, line 33: systemdata=sonnenInst.get_systemdata()
2020-12-11 11:58:42 WARNING (MainThread) [homeassistant.util.async_] Detected I/O inside the event loop. This is causing stability issues. Please report issue to the custom component author for sonnenbatterie doing I/O at custom_components/sonnenbatterie/sensor.py, line 32: sonnenInst=sonnenbatterie(username,password,ipaddress)
2020-12-11 11:58:42 WARNING (MainThread) [homeassistant.util.async_] Detected I/O inside the event loop. This is causing stability issues. Please report issue to the custom component author for sonnenbatterie doing I/O at custom_components/sonnenbatterie/sensor.py, line 32: sonnenInst=sonnenbatterie(username,password,ipaddress)
Created by accident
As this is asked very often:
The Home Assistant Energy Dashboard does not show the entities created by ha_sonnenbatterie.
Thats because this addon does not show any energy(as Watt) values. (Except Battery, maybe...)
We show you Power(!=Energy) values.
Energy is Power Times Time (or as you may know it "WattHour" or KiloWattHour(kwh))
To make values from sonnenbatterie usable in your energy dashboard you have to somewhat "convert" the values.
As Energy is Power timeTime, you need to measure power that is pushed through your home for a certain time.
Example:
You are using a fridge, which is drawing a constant 100W. After one hour your fridge used 100Wh, after 24h it used 2400Wh or 2.4kWh :)
To get to these values you can use the "Riemann integral(https://en.wikipedia.org/wiki/Riemann_integral)" which is an approximation of the used power times time(=energy).
Fortunately, home assistant has a tool for this: The "integration" integration(https://www.home-assistant.io/integrations/integration/)
An example for the energy consumption, calculated over time from the power sensor of the sonnenbatterie:
- platform: integration
source: sensor.sonnenbatterie_XXXXXX_meter_consumption_4_2_w_total
name: PowerConsumption
unit_prefix: k
This yaml creates a sensor for ConsumptionEnergy named "PowerConsumption" with unit kWh and usable in energy-dashboard
EDIT:
correcteded units, thx2 @jezzaaa
Dieser Fehler wurde von einer benutzerdefinierten Integration verursacht
Logger: custom_components.sonnenbatterie
Source: custom_components/sonnenbatterie/sensor.py:239
Integration: Sonnenbatterie (documentation)
First occurred: 26. Januar 2024 um 04:45:21 (19 occurrences)
Last logged: 04:45:56
Traceback (most recent call last): File "/usr/local/lib/python3.11/site-packages/urllib3/connection.py", line 174, in _new_conn conn = connection.create_connection( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/urllib3/util/connection.py", line 95, in create_connection raise err File "/usr/local/lib/python3.11/site-packages/urllib3/util/connection.py", line 85, in create_connection sock.connect(sa) TimeoutError: timed out During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/usr/local/lib/python3.11/site-packages/urllib3/connectionpool.py", line 715, in urlopen httplib_response = self._make_request( ^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/urllib3/connectionpool.py", line 416, in _make_request conn.request(method, url, **httplib_request_kw) File "/usr/local/lib/python3.11/site-packages/urllib3/connection.py", line 244, in request super(HTTPConnection, self).request(method, url, body=body, headers=headers) File "/usr/local/lib/python3.11/http/client.py", line 1286, in request self._send_request(method, url, body, headers, encode_chunked) File "/usr/local/lib/python3.11/http/client.py", line 1332, in _send_request self.endheaders(body, encode_chunked=encode_chunked) File "/usr/local/lib/python3.11/http/client.py", line 1281, in endheaders self._send_output(message_body, encode_chunked=encode_chunked) File "/usr/local/lib/python3.11/http/client.py", line 1041, in _send_output self.send(msg) File "/usr/local/lib/python3.11/http/client.py", line 979, in send self.connect() File "/usr/local/lib/python3.11/site-packages/urllib3/connection.py", line 205, in connect conn = self._new_conn() ^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/urllib3/connection.py", line 179, in _new_conn raise ConnectTimeoutError( urllib3.exceptions.ConnectTimeoutError: (<urllib3.connection.HTTPConnection object at 0x7f7aecb410>, 'Connection to 192.168.1.180 timed out. (connect timeout=60)') During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/usr/local/lib/python3.11/site-packages/requests/adapters.py", line 486, in send resp = conn.urlopen( ^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/urllib3/connectionpool.py", line 799, in urlopen retries = retries.increment( ^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/urllib3/util/retry.py", line 592, in increment raise MaxRetryError(_pool, url, error or ResponseError(cause)) urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='192.168.1.180', port=80): Max retries exceeded with url: /api/battery (Caused by ConnectTimeoutError(<urllib3.connection.HTTPConnection object at 0x7f7aecb410>, 'Connection to 192.168.1.180 timed out. (connect timeout=60)')) During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/config/custom_components/sonnenbatterie/sensor.py", line 230, in updateData self.latestData["battery"] = await self.hass.async_add_executor_job(self.sbInst.get_battery); ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/concurrent/futures/thread.py", line 58, in run result = self.fn(*self.args, **self.kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/sonnenbatterie/sonnenbatterie.py", line 142, in get_battery return self._get(SONNEN_API_PATH_BATTERY) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/sonnenbatterie/sonnenbatterie.py", line 64, in _get response=requests.get(url, ^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/requests/api.py", line 73, in get return request("get", url, params=params, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/requests/api.py", line 59, in request return session.request(method=method, url=url, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/requests/sessions.py", line 589, in request resp = self.send(prep, **send_kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/requests/sessions.py", line 703, in send r = adapter.send(request, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/requests/adapters.py", line 507, in send raise ConnectTimeout(e, request=request) requests.exceptions.ConnectTimeout: HTTPConnectionPool(host='192.168.1.180', port=80): Max retries exceeded with url: /api/battery (Caused by ConnectTimeoutError(<urllib3.connection.HTTPConnection object at 0x7f7aecb410>, 'Connection to 192.168.1.180 timed out. (connect timeout=60)'))
Traceback (most recent call last): File "/config/custom_components/sonnenbatterie/sensor.py", line 230, in updateData self.latestData["battery"] = await self.hass.async_add_executor_job(self.sbInst.get_battery); ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/concurrent/futures/thread.py", line 58, in run result = self.fn(*self.args, **self.kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/sonnenbatterie/sonnenbatterie.py", line 142, in get_battery return self._get(SONNEN_API_PATH_BATTERY) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/sonnenbatterie/sonnenbatterie.py", line 71, in _get response.raise_for_status() File "/usr/local/lib/python3.11/site-packages/requests/models.py", line 1021, in raise_for_status raise HTTPError(http_error_msg, response=self) requests.exceptions.HTTPError: 502 Server Error: Bad Gateway for url: http://192.168.1.180/api/battery
Traceback (most recent call last): File "/usr/local/lib/python3.11/site-packages/urllib3/connection.py", line 174, in _new_conn conn = connection.create_connection( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/urllib3/util/connection.py", line 95, in create_connection raise err File "/usr/local/lib/python3.11/site-packages/urllib3/util/connection.py", line 85, in create_connection sock.connect(sa) ConnectionRefusedError: [Errno 111] Connection refused During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/usr/local/lib/python3.11/site-packages/urllib3/connectionpool.py", line 715, in urlopen httplib_response = self._make_request( ^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/urllib3/connectionpool.py", line 416, in _make_request conn.request(method, url, **httplib_request_kw) File "/usr/local/lib/python3.11/site-packages/urllib3/connection.py", line 244, in request super(HTTPConnection, self).request(method, url, body=body, headers=headers) File "/usr/local/lib/python3.11/http/client.py", line 1286, in request self._send_request(method, url, body, headers, encode_chunked) File "/usr/local/lib/python3.11/http/client.py", line 1332, in _send_request self.endheaders(body, encode_chunked=encode_chunked) File "/usr/local/lib/python3.11/http/client.py", line 1281, in endheaders self._send_output(message_body, encode_chunked=encode_chunked) File "/usr/local/lib/python3.11/http/client.py", line 1041, in _send_output self.send(msg) File "/usr/local/lib/python3.11/http/client.py", line 979, in send self.connect() File "/usr/local/lib/python3.11/site-packages/urllib3/connection.py", line 205, in connect conn = self._new_conn() ^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/urllib3/connection.py", line 186, in _new_conn raise NewConnectionError( urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPConnection object at 0x7f73fa6510>: Failed to establish a new connection: [Errno 111] Connection refused During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/usr/local/lib/python3.11/site-packages/requests/adapters.py", line 486, in send resp = conn.urlopen( ^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/urllib3/connectionpool.py", line 799, in urlopen retries = retries.increment( ^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/urllib3/util/retry.py", line 592, in increment raise MaxRetryError(_pool, url, error or ResponseError(cause)) urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='192.168.1.180', port=80): Max retries exceeded with url: /api/battery (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f73fa6510>: Failed to establish a new connection: [Errno 111] Connection refused')) During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/config/custom_components/sonnenbatterie/sensor.py", line 230, in updateData self.latestData["battery"] = await self.hass.async_add_executor_job(self.sbInst.get_battery); ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/concurrent/futures/thread.py", line 58, in run result = self.fn(*self.args, **self.kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/sonnenbatterie/sonnenbatterie.py", line 142, in get_battery return self._get(SONNEN_API_PATH_BATTERY) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/sonnenbatterie/sonnenbatterie.py", line 64, in _get response=requests.get(url, ^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/requests/api.py", line 73, in get return request("get", url, params=params, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/requests/api.py", line 59, in request return session.request(method=method, url=url, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/requests/sessions.py", line 589, in request resp = self.send(prep, **send_kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/requests/sessions.py", line 703, in send r = adapter.send(request, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/requests/adapters.py", line 519, in send raise ConnectionError(e, request=request) requests.exceptions.ConnectionError: HTTPConnectionPool(host='192.168.1.180', port=80): Max retries exceeded with url: /api/battery (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f73fa6510>: Failed to establish a new connection: [Errno 111] Connection refused'))
Traceback (most recent call last): File "/usr/local/lib/python3.11/site-packages/urllib3/connection.py", line 174, in _new_conn conn = connection.create_connection( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/urllib3/util/connection.py", line 95, in create_connection raise err File "/usr/local/lib/python3.11/site-packages/urllib3/util/connection.py", line 85, in create_connection sock.connect(sa) OSError: [Errno 113] Host is unreachable During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/usr/local/lib/python3.11/site-packages/urllib3/connectionpool.py", line 715, in urlopen httplib_response = self._make_request( ^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/urllib3/connectionpool.py", line 416, in _make_request conn.request(method, url, **httplib_request_kw) File "/usr/local/lib/python3.11/site-packages/urllib3/connection.py", line 244, in request super(HTTPConnection, self).request(method, url, body=body, headers=headers) File "/usr/local/lib/python3.11/http/client.py", line 1286, in request self._send_request(method, url, body, headers, encode_chunked) File "/usr/local/lib/python3.11/http/client.py", line 1332, in _send_request self.endheaders(body, encode_chunked=encode_chunked) File "/usr/local/lib/python3.11/http/client.py", line 1281, in endheaders self._send_output(message_body, encode_chunked=encode_chunked) File "/usr/local/lib/python3.11/http/client.py", line 1041, in _send_output self.send(msg) File "/usr/local/lib/python3.11/http/client.py", line 979, in send self.connect() File "/usr/local/lib/python3.11/site-packages/urllib3/connection.py", line 205, in connect conn = self._new_conn() ^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/urllib3/connection.py", line 186, in _new_conn raise NewConnectionError( urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPConnection object at 0x7f8f3a8990>: Failed to establish a new connection: [Errno 113] Host is unreachable During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/usr/local/lib/python3.11/site-packages/requests/adapters.py", line 486, in send resp = conn.urlopen( ^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/urllib3/connectionpool.py", line 799, in urlopen retries = retries.increment( ^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/urllib3/util/retry.py", line 592, in increment raise MaxRetryError(_pool, url, error or ResponseError(cause)) urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='192.168.1.180', port=80): Max retries exceeded with url: /api/battery (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f8f3a8990>: Failed to establish a new connection: [Errno 113] Host is unreachable')) During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/config/custom_components/sonnenbatterie/sensor.py", line 230, in updateData self.latestData["battery"] = await self.hass.async_add_executor_job(self.sbInst.get_battery); ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/concurrent/futures/thread.py", line 58, in run result = self.fn(*self.args, **self.kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/sonnenbatterie/sonnenbatterie.py", line 142, in get_battery return self._get(SONNEN_API_PATH_BATTERY) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/sonnenbatterie/sonnenbatterie.py", line 64, in _get response=requests.get(url, ^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/requests/api.py", line 73, in get return request("get", url, params=params, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/requests/api.py", line 59, in request return session.request(method=method, url=url, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/requests/sessions.py", line 589, in request resp = self.send(prep, **send_kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/requests/sessions.py", line 703, in send r = adapter.send(request, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/requests/adapters.py", line 519, in send raise ConnectionError(e, request=request) requests.exceptions.ConnectionError: HTTPConnectionPool(host='192.168.1.180', port=80): Max retries exceeded with url: /api/battery (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f8f3a8990>: Failed to establish a new connection: [Errno 113] Host is unreachable'))
Traceback (most recent call last): File "/usr/local/lib/python3.11/site-packages/urllib3/connection.py", line 174, in _new_conn conn = connection.create_connection( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/urllib3/util/connection.py", line 95, in create_connection raise err File "/usr/local/lib/python3.11/site-packages/urllib3/util/connection.py", line 85, in create_connection sock.connect(sa) TimeoutError: timed out During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/usr/local/lib/python3.11/site-packages/urllib3/connectionpool.py", line 715, in urlopen httplib_response = self._make_request( ^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/urllib3/connectionpool.py", line 416, in _make_request conn.request(method, url, **httplib_request_kw) File "/usr/local/lib/python3.11/site-packages/urllib3/connection.py", line 244, in request super(HTTPConnection, self).request(method, url, body=body, headers=headers) File "/usr/local/lib/python3.11/http/client.py", line 1286, in request self._send_request(method, url, body, headers, encode_chunked) File "/usr/local/lib/python3.11/http/client.py", line 1332, in _send_request self.endheaders(body, encode_chunked=encode_chunked) File "/usr/local/lib/python3.11/http/client.py", line 1281, in endheaders self._send_output(message_body, encode_chunked=encode_chunked) File "/usr/local/lib/python3.11/http/client.py", line 1041, in _send_output self.send(msg) File "/usr/local/lib/python3.11/http/client.py", line 979, in send self.connect() File "/usr/local/lib/python3.11/site-packages/urllib3/connection.py", line 205, in connect conn = self._new_conn() ^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/urllib3/connection.py", line 179, in _new_conn raise ConnectTimeoutError( urllib3.exceptions.ConnectTimeoutError: (<urllib3.connection.HTTPConnection object at 0x7f73cfcf10>, 'Connection to 192.168.1.180 timed out. (connect timeout=60)') During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/usr/local/lib/python3.11/site-packages/requests/adapters.py", line 486, in send resp = conn.urlopen( ^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/urllib3/connectionpool.py", line 799, in urlopen retries = retries.increment( ^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/urllib3/util/retry.py", line 592, in increment raise MaxRetryError(_pool, url, error or ResponseError(cause)) urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='192.168.1.180', port=80): Max retries exceeded with url: /api/battery (Caused by ConnectTimeoutError(<urllib3.connection.HTTPConnection object at 0x7f73cfcf10>, 'Connection to 192.168.1.180 timed out. (connect timeout=60)')) During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/config/custom_components/sonnenbatterie/sensor.py", line 230, in updateData self.latestData["battery"] = await self.hass.async_add_executor_job(self.sbInst.get_battery); ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/concurrent/futures/thread.py", line 58, in run result = self.fn(*self.args, **self.kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/sonnenbatterie/sonnenbatterie.py", line 142, in get_battery return self._get(SONNEN_API_PATH_BATTERY) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/sonnenbatterie/sonnenbatterie.py", line 64, in _get response=requests.get(url, ^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/requests/api.py", line 73, in get return request("get", url, params=params, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/requests/api.py", line 59, in request return session.request(method=method, url=url, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/requests/sessions.py", line 589, in request resp = self.send(prep, **send_kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/requests/sessions.py", line 703, in send r = adapter.send(request, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/requests/adapters.py", line 507, in send raise ConnectTimeout(e, request=request) requests.exceptions.ConnectTimeout: HTTPConnectionPool(host='192.168.1.180', port=80): Max retries exceeded with url: /api/battery (Caused by ConnectTimeoutError(<urllib3.connection.HTTPConnection object at 0x7f73cfcf10>, 'Connection to 192.168.1.180 timed out. (connect timeout=60)'))
Dieser Fehler wurde von einer benutzerdefinierten Integration verursacht
Logger: custom_components.sonnenbatterie
Source: custom_components/sonnenbatterie/sensor.py:135
Integration: Sonnenbatterie (documentation)
First occurred: 25. Januar 2024 um 11:27:33 (1 occurrences)
Last logged: 25. Januar 2024 um 11:27:33
hass not set, sensor: 267841
It is not possible to add the battery sensors to the energy dashboard "Batteriespeicher zu Hause". They just don't appear in the selection. I don't know the reason but maybe the device_class parameters are set incorrectly? Just a guess...
Anyways it would be very benefitial if the battery stats could be imported into the energy dashboard.
Thanks in advance!
Hey, how can I change the IP address of the Sonnenbatterie? I can't find any config...
Why the new Energy dashboard of HA does not support Sonnen sensors in term of 'no sensors available on the dropdown of the energy configuration' to select sensors for In/Out grid, solar production and battery system ?
Hello,
since a few weeks my sensors regularly stop working and freeze. I need to reload the integration or restart HASS to fix it.
Any idea where this comes from? And how can I fix this?
Can I provide you any Information that?
Thanks for your help!
And should we better speak in German?
Hey,
would it be possible to integrate a Radio Button to start a manual loading process? With maximum power.
And when disabling going back to self consumption?
That would be really great!
Dieser Fehler wurde von einer benutzerdefinierten Integration verursacht
Logger: custom_components.sonnenbatterie
Source: custom_components/sonnenbatterie/sensor.py:313
Integration: Sonnenbatterie (documentation)
First occurred: 25. Januar 2024 um 11:27:33 (8 occurrences)
Last logged: 25. Januar 2024 um 11:27:33
'inverter_ipv2' not in inverter/status/ipv2 -> disabled
'inverter_ppv' not in inverter/status/ppv -> disabled
'inverter_ppv2' not in inverter/status/ppv2 -> disabled
'inverter_upv' not in inverter/status/upv -> disabled
'inverter_upv2' not in inverter/status/upv2 -> disabled
The integration connected with my battery and I only have 1 entity which is the battery only.
I have no other entities.
Below is the log file.
This error originated from a custom integration.
Logger: custom_components.sonnenbatterie
Source: custom_components/sonnenbatterie/sensor.py:173
Integration: Sonnenbatterie (documentation)
First occurred: 8:32:12 PM (282 occurrences)
Last logged: 9:22:41 PM
Traceback (most recent call last): File "/config/custom_components/sonnenbatterie/sensor.py", line 159, in watcher self.updateData(); File "/config/custom_components/sonnenbatterie/sensor.py", line 145, in updateData self.latestData["inverter"]['status']=self.latestData["inverter"]['status']['status'] KeyError: 'status'
The unit of your entity is not a supported unit for the device class of the entity, power.
Statistics can not be generated until this entity has a supported unit.
If this unit was provided by an integration, this is a bug. Please report an issue.
If you have set this unit yourself, and want to have statistics generated, make sure the unit matches the device class. The supported units are documented in the developer documentation.
Some example are Charge Percentage User/Real that has 'power' class with unit % and need to changed to 'battery'
Thanks for the integration. I just got started with a new PV system with a Sonnenbatterie 10.
I have the ha_sonnenbatterie installed and it collects data - I'm just not sure what exactly I am getting 😅
Is "consumption w_total" the entire consumption of the house towards the grid? I'm currently feeding into the grid, so that number is negative.
What I haven't found is how much energy is consumed or provided by the battery itself. Is that perhaps "Current production (in)" and "Current production (out)"? Probably not.
Your screenshots show a "Sonnenbatterie" device (?). I suspect that might be a problem: I already had a "sonnenbatterie" device provided by the FritzBox integration, because that is also the name that I gave to the battery in my local network. Could it be that this now shadows whatever device ha_sonnenbatterie is adding?
The integration sonnenbatterie is broken since core-2021.4.0/ 2021.4.1. No sensors are available.
I'm not sure if this an issue with my system or an issue with the HA integration, so apologies if it's something up with my battery.
Ever since January 26th the readings for PPV1 have been incorrect. Some reading shows when the sun is down, and when the sun is up the reading is too high, plus at all times the reading looks 'noisy'. However, the readings for PPV2 look absolutely fine. Was there an update or something that changed around Jan 26th that could do this?
I’m trying to install the repository via HACS.
I can’t find it in the list of integrations.
Hey,
I try to set this up with my ECO 8 but I cannot even login. The password is def. correct (see GIF). I also tried "User" as user, but that offers the same result
This error originated from a custom integration.
Logger: custom_components.sonnenbatterie
Source: custom_components/sonnenbatterie/config_flow.py:50
Integration: sonnenbatterie (documentation)
First occurred: 9:02:06 PM (6 occurrences)
Last logged: 9:12:53 PM
Unable to connect to sonnenbatterie: Traceback (most recent call last): File "/config/custom_components/sonnenbatterie/config_flow.py", line 42, in async_step_user sonnenInst=await self.hass.async_add_executor_job(_internal_setup,username,password,ipaddress); File "/usr/local/lib/python3.9/concurrent/futures/thread.py", line 52, in run result = self.fn(*self.args, **self.kwargs) File "/config/custom_components/sonnenbatterie/config_flow.py", line 41, in _internal_setup return sonnenbatterie(_username,_password,_ipaddress) File "/usr/local/lib/python3.9/site-packages/sonnenbatterie/sonnenbatterie.py", line 10, in __init__ self._login() File "/usr/local/lib/python3.9/site-packages/sonnenbatterie/sonnenbatterie.py", line 24, in _login getsession.raise_for_status() File "/usr/local/lib/python3.9/site-packages/requests/models.py", line 953, in raise_for_status raise HTTPError(http_error_msg, response=self) requests.exceptions.HTTPError: 401 Client Error: Unauthorized for url: http://192.168.10.209/api/session
Would it be possible to display the “systemstatus” sensor in the process so that it works like the sunbattery sensor itself. By this I mean the display not as a graphical table, but as a crossbar (like with the solarbattery: charching, discharching) only with OnGrid, etc.
I'm sorry I can't express myself better. But I don't have the technical terms.
I hope you can understand what I mean.
Hi. This is a question, not an issue. How does this custom component connect to the Sonnen unit? Is this over modbus, serial or over IP? My hope is this is over IP, if so - do the Sonnen units have ethernet interfaces, or WiFi client connectivity built in? I'm asking as I may be connecting to one in the coming weeks. and want to prepare any equipment like WiFi to Ethernet bridges, or Serial2USB adaptors.
The sonnenbatterie has a few operating modes, 'Manual', Automatic - Self Consumption' and 'Time of Use'. I use 'TOS' whereby I can set intervals to charge from the grid at cheap times throughout the day. Currently you have to go into the sonnen app and set this up. I'd love to be able to use HA to automate this 'TOU' so that if my solar panels are producing energy during my set time of use then it will disable the 'TOS' charge from the grid and switch to 'Automatic' and use the solar only to charge the battery.
When I look for the "sonnenbatterie.set_time_of_use" service I am unable to find it or any mention of 'Operation' modes
Is that something you could implement? or will an API be needed to do with?
Here's documentation on the Sonnen API feature (way above my understanding)
sonnenBatterie API
1.0.0
[ Base URL: = ip of the system ]
The sonnenBatterie API allows to remote control a sonnenBatterie. Most API endpoints require an authentication token. This token is available in the sonnenBatterie Dashboard (‘Software-Integration’).
Unproteced endpoints are marked below.
Example request:
curl --header ‘Auth-Token: TOKEN’ http://system-ip/api/v2/latestdata
POST
/api/v2/setpoint/discharge/{watt}
Sends a discharge command to the battery (Write API)
GET
/api/v2/configurations/{name}
Gets the value of a given configuration (Read API)
GET
/api/v2/io
Get inputs and outputs (Read API)
GET
/api/v2/battery
Gets the battery measurements (Read API)
GET
/api/v2/status
Gets status data for this sonnenBatterie
PUT
/api/v2/configurations
Sets the value of configurations (Write API)
GET
/api/v2/configurations
Gets the values of all configurations (Read API)
GET
/api/v2/inverter
Gets the inverter measurements (Read API)
GET
/api/v2/latestdata
Gets latest data for this sonnenBatterie (Read API)
POST
/api/v2/setpoint/charge/{watt}
Sends a charge command to the battery (Write API)
GET
/api/v2/powermeter
Gets the latest power-meter measurements (Read API)
When I try to add the repository to supervisor -> add-on-store -> repositories I receive to message "not a valid add-on repository
HA 2021.6.6
Thanks again for your great work, i've been using your integration to change my battery's operating modes via automations and all is fine.
I was wondering if there is a way of obtaining the status of the actual mode in which the battery is currently running? I'd like to add an entity to my HA so i can visually see if it is in Manual, Self consumption or TOU mode. Is that a thing already? If not how easy would that be to add? Would it be as simple as reading the current value and then setting a flag? (excuse my ignorance as i'm not a programmer in the slightest)
Hi,
I am using a sonnenbatterie 8.0 and i would like to display the inside temperature of the battery. Acc. to sonnen service that is possible by using API. Does anyone realized it?
Thanks for a short feedback.
Hi,
There is differences in the read-out of the total production and that Sonnen shows in the app.
When adding the other sensors together (consumption, battery and grid) these dosen't add up the the read-out of productions sensor, but confirm the number that can be read-out in Sonnen App.
Entity sensor.sonnenbatterie_107778_meter_consumption_4_2_v_l1_n (<class 'custom_components.sonnenbatterie.sensor.SonnenBatterieSensor'>) implements device_state_attributes. Please report it to the custom component author.
Entity sensor.sonnenbatterie_107778_meter_consumption_4_2_a_l1 (<class 'custom_components.sonnenbatterie.sensor.SonnenBatterieSensor'>) implements device_state_attributes. Please report it to the custom component author.
Entity sensor.sonnenbatterie_107778_meter_consumption_4_2_w_l2 (<class 'custom_components.sonnenbatterie.sensor.SonnenBatterieSensor'>) implements device_state_attributes. Please report it to the custom component author.
Entity sensor.sonnenbatterie_107778_meter_consumption_4_2_a_l3 (<class 'custom_components.sonnenbatterie.sensor.SonnenBatterieSensor'>) implements device_state_attributes. Please report it to the custom component author.
Upon attempting to upgrade from 274ce8b to the newly published 75a3e8c, I receive the following error:
"Failed to call service update/install. The version 75a3e8c for this integration can not be used with HACS."
Home Assistant versions:
Core: 2024.3.0
Supervisor: 2024.02.1
Operating System: 12.0
Frontend: 20240306.0
Hi!
Would like to have this integrated:
https://developers.home-assistant.io/docs/core/entity/sensor/#long-term-statistics
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.