OK, SMA Australia just got back to me with an answer on why I was getting the WebConnect interface to shut down automatically every time. Here is what they said:
It is natural for the inverter’s Webconnect function to be disabled because the Home Manager is the data logger that captures the data locally before sending it to Sunny Portal. This means the Sunny Boy has no insentive to itself send data out to the Portal, and lets itself be subject to what the Home Manager requests of it.
This means that your SB5.0 can still communicate with local devices including the Home Manager, but cannot send out data to the internet. As an example, if you set a static IP address on the SB5.0 and use Modbus, you should be able to pull data. However, it now depends on what protocol your home automation system works on. In my opinion, you will need to speak to the developer of your home automation system for advice on how to integrate information from our SB5.0 into their system.
Now, this does not help and means that when using Home Manager, you need to look at ModBus or scraper options… Back to square one, thanks SMA!
So I’ve been busy rewriting my .yaml to use ModBus instead of WebConnect. Trouble is HA’s ModBus implementation only allows for one ModBus device. With a battery charger and an inverter, I need at least 2 ModBus devices… I decided the easiest route would be to run a separate instance of HA in Docker, have that read the ModBus values from my Sunny Boy, then publish MQTT messages with the values that I need.
Here is the configuration of the HA instance used to do the above:
This works really well. The Docker container uses 32MB ram and does not use much processing. This may help someone else who is trying to do the same. I may want more sensors in the future and start scraping the Sunny Portal as there is no way to access data from the Home Manager 2.0 on the LAN…
@TD22057 created a script to read the SMA energy meter and publish it on MQTT, which should then work to ingest in HomeAssistant with MQTT
I also have one of these meters and have thought of including it in pysma (the lib behind the Hass SMA integration) and then exposing it as a sensor, but not gotten so far… I already get consumption from my SB and only need 1 phase
However once I restart HA I get the following errors on my log file:
2019-01-16 16:44:31 ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
File "/usr/local/lib/python3.6/site-packages/homeassistant/components/sensor/sma.py", line 125, in async_sma
values = await sma.read(used_sensors)
File "/usr/local/lib/python3.6/site-packages/pysma/__init__.py", line 163, in read
yield from self.new_session()
File "/usr/local/lib/python3.6/site-packages/pysma/__init__.py", line 134, in new_session
body = yield from self._fetch_json(URL_LOGIN, self._new_session_data)
File "/usr/local/lib/python3.6/site-packages/pysma/__init__.py", line 125, in _fetch_json
return (yield from res.json()) or {}
File "/usr/local/lib/python3.6/site-packages/aiohttp/client_reqrep.py", line 1001, in json
headers=self.headers)
aiohttp.client_exceptions.ContentTypeError: 0, message='Attempt to decode JSON with unexpected mimetype: text/html'
Possibly you have simply not copied it in here but the sensor config above does not include the platform?
I assume that this may be needed. My SunnyBoy is nicely answering with the following sensor config including platfrom:
i’ve a sunny boy also, and i never had error.
I didn’t have access to my config right now to show it to you, but i have made exactly what is described in the doc
interesting, where did-you find the other available options ?
i search something like a the total_year, total_last_year, total_day, and a total_yesterday
Actually i only use the current_power and total_yield
I learned this somewhere here in the forum. (Can’t remember where)
Those values are partly depending on the modell type. One way to reverse engineer those sma identifiers is to log on to the web interface of the inverter and inspect the web site objects with the network-developer tools of the browser. Depending on the browser you would have different options. It is worth playing around with multiple browsers there. I found some identifies with firefox and some others with chrome depending how they are being used.
E.g. You may find them (Firefox) with developer tools enabled as follows: Highlight the value you are interested in, click right mouse and choose investigate element. If this value is using an identifier it will give you a hint in the deveolper tools window:
In this case it is the identifier for current_power 6100_40263F00.
But for my understand this does not work for each and every element since some of them are not refering to identifiers directly but trigger a script to calculate them. The method above will just give no identifier directly.
You may analyse then the different java scripts running on the actual page using the Networkanalyser tab and filter for the parameters being used in the scripts. This will give you a list of identifiers which are being used on this webpage for your specific device.
My experience is that you can use them all as custom sensor. Nevertheless none of them gives you historical data.
I am also trying currently to get historical data with a small automation since total_consumption is available. But I am new to the automation part in home assistant so I am not yet successful. There are already entries which give guidance for this. E.g: https://community.home-assistant.io/t/how-to-calculate-daily-power-consumption-from-dsmr-sensors/37696
…but this a different topic.
If you find repective direct sma identifiers for total consumption today / yesterday this would be very interesting.I am only aware of ‘dailly_yield’ which is part of the sma component: https://www.home-assistant.io/components/sensor.sma/
Anyone successfully integrated SunnyBoy 4000SBL in Combination with a HomeManager1.0 ?
If yes, please give my some hints, maybe relevant part from your yaml.
Many thanks