Just another way of getting this done.
I needed to use the current power from the SunnyBoy to be used and diplayed in OpenHab2. This for switching the electro car charger on and off, depending on the power from the solar panels.
For this purpose I installed a headless webscraper on the OpenHabian Pi, made a Python script to get the values from sunnyPortal.com and send the current values to OpenHab2 by the mqtt binding. With an alogorithm using the current value and the average of the last 5 minutes I switch the charger on and off.
The average of the last 5 minutes is easily calculated thanks to the persistence functions of OpenHab.
The Python script needs a lot of error handling to get the input stream stable, but it finally seems to work so far.
For webscraping see: http://www.mantonel.com/tutorials/web-scraping-raspberry-pi-and-python
Adressing the “currentPower” in the webbrowser:
divElement = browser.find_element_by_xpath(’//div[@data-name=“pvPower”]’)
SubHead = divElement.find_element_by_xpath(’.//div[@class=“widgetSubHead”]’).text
currentPower = divElement.find_element_by_xpath(’.//span[@class=“mainValueAmount”]’).text
Nb. you will need the SubHead info to, if it is not null, the currentPower is old info.
If anyone is interested in more info, let me know.
Good luck !