Getting data from a Solis (ginlong) inverter

This is the “Current Power” element from my inverter that isn’t currently working with Appdaemon

<div class="lab_r2" id="webdata_now_p" style="color:#666666;font-weight:bold;">---</div>

This is the “Current Power” element from 1 of my inverters that is working with Appdaemon

<div class="lab_r2" id="webdata_now_p" style="color:#666666;font-weight:bold;">20 W</div>

I’m hoping you can see the reason!! it’s not working

I’ve noticed the none working 1 does not give numbers to a decimal place like the other 2 inverters, does the code need adjusting for that and the “Current Power” just gives — instead of a number, but strangely it uploads a number to the Solis Cloud

You are on the wrong page. It is ‘/status.html’ that is evaluated. The normal front page uses some JavaScript and is not that easy to parse.

Can you PM me the source code of the whole page please? I can check later this evening, but it looks like this status page is very different from mine. You could also compare it with the status pages of your other two inverters.

1st is WORKING
2ns is NOT

I notice a slight difference in the 2nd “slave.css” instead of “status.html:44”

I’d typed this up earlier and got side tracked

How do I do that?

Send me the source code? Open the page in a browser, goto ‘file’ ‘save’ and save the complete page.
To send me a PM click on your profile and then on the mail icon.
Just send me the one that is not working.

The only option I can find is to save to a html file, is that correct?

Yes, html is ok.

Hello,
I’m new to HA and have it currently only installed as an os on a virtual machine and using the GUI
Where or how can I have scrape working?
Have tried the scrape addon but not getting anything from there.
Was also trying to figure out how to do the task performed in the first post but not knowing where to do that either.
Could someone help me?

I found Studio code server so that I could edit and add scripts but now I,m stuck with that it does not reach the inverter.
Is there any good way of debugging that does it even log into the WiFi logger or does it not even find it on the network?

EDIT: The inverter is pingable by HA
EDIT2: Seems like it fails when it starts looking for interesting data

The source of the status page looks like this

Hi @jseppeli

the part where the script is looking for data is a bit above the picture you posted.
Look here:

...
var webdata_rate_p = "";
var webdata_now_p = "140";
var webdata_today_e = "0.40";
var webdata_total_e = "195.0";

...

What does it look like on your page?

Seems that the status page is different for me :frowning:
Can’t find anyt of those

Yeah, looks unfortunately like that. There seem to be many versions of the firmware, and most of them hide the values in JavaScript. There’s surely a way to get at that, too. But I don’t know how.

Ok.
Thank you for your help!
Have to continue searching for a way

I found a solution to at least those who has a status page that does not work with this one

Based on the original code I have modified it so that also the logger that has incompatible status page can be used with inverter.cgi file instead.

import appdaemon.plugins.hass.hassapi as hass
import requests
from requests.auth import HTTPBasicAuth

#
# scrape the inverters web page
#
# Args:
#


class SolisScrape(hass.Hass):

    def initialize(self):
        self.log("Solis scrape started")
        self.run_in(self.update, 0)
        # update every minute
        self.run_every(self.update, "now", 60) #60 can be changed to some other value for how many seconds between reloads of data.

    def update(self, kwargs):

        try:   # no sun, no fun
            # get the status page
            URL = "http://192.168.1.127/inverter.cgi"
            try:
                page = requests.get(URL, auth = HTTPBasicAuth('admin', 'enter password here'))

                # split it
                liste = page.text.split(";")

                # setting values into variables ;
                solis_scrape_current_power = float(liste[4])
                solis_scrape_energy_today = float(liste[5])
                #solis_scrape_total_energy = float(liste[6])  #comment out this row if total energy is not found in inverter.cgi file

                # Build the HA sensor entity with the values returned 
                entity = "sensor.solis_scrape_current_power"
                self.set_state(entity, state = solis_scrape_current_power, attributes={"friendly_name":"Current power", "unit_of_measurement": "W", "icon": "mdi:flash-outline"})
                entity = "sensor.solis_scrape_energy_today"
                self.set_state(entity, state = solis_scrape_energy_today, attributes={"friendly_name":"Energy today", "unit_of_measurement": "kWh", "icon": "mdi:flash-outline"})
                #entity = "sensor.solis_scrape_total_energy"  #comment out this row if total energy is not found in inverter.cgi file
                #self.set_state(entity, state = solis_scrape_total_energy, attributes={"friendly_name":"Energy total", "unit_of_measurement": "kWh", "icon": "mdi:flash-outline"})  #comment out this row if total energy is not found in inverter.cgi file


                #write out to log
                logstring = "Solis: Current: {current_power}W Today: {energy_today}kWh"  #comment out this row if total energy is found in inverter.cgi file
                #logstring = "Solis: Current: {current_power}W Today: {energy_today}kWh Total: {total_energy}kWh" #comment out this row if total energy is not found in inverter.cgi file
                self.log(logstring)
            except:
                self.log("Failed to reach inverter")    # do nothing
                self.set_state(entity, state = 0)
        except:   # no sun, no power
            entity = "sensor.solis_current_power"
            self.set_state(entity, state = 0)
1 Like

This looks like an excellent local solution, but my HA is running inside docker, so I suspect stuff like appdaemon is not going to be available and haas.haas is going to cause me issues too. Is there any hope of something which can run in / on a regular pi / docker / ha system and suck me the key values?