Skip to content

Zeversolar is showing wrong daily energy under certain circumstances #8

Description

@QuaySo

While I was debugging I noticed my daily energy from de inverter shows incorrect values under certain circumstances. Normally the daily energy is given with 2 decimals, but when it is below 0.10 the values are displayed wrong.

Normally the sequence would be: 0.01, 0.02, 0.03, 0.04, 0.05 .... 0.09, 0.10, 0.11, 0.12
But values I receive are: 0.1, 0.2, 0.3, 0.4, 0.5 .... 0.9, 0.10, 0.11, 0.12

Because of this, Homeassistant is showing incorrect hourly values in the energy dashboard.

I'm not sure this is a general problem, or just on my site. As a workaround I added a couple of lines of code to determine the correct values for the daily energy sensor. If your seeing the same behavior on your site, you may try this:

    #---------------------------------------------------------------------
    #-- Gets the reading from the URL. Returns 0 if no generation
    def requestSolarGeneration(self, arg):
        self.dateOfReading = datetime.now() # Get date & time of reading
        req = Request(zeverSolarURL)
        try:
            response = urlopen(req)
            htmlresponse = response.read()
            st = htmlresponse.decode()
            st = st.split() # Convert the string into a list
            #-- Get the string for the Generated Power and Daily Energy
            genPower = st[genPowerIndex]
            dailyEnergy = st[dailyEnergyIndex]
            #-- Because Zeversolar calculation of kWh is incorrect (23.1  is not 23.1 but 23.01) a correction is done
            dailyEnergySplit = dailyEnergy.split('.')
            dailyEnergyWhole = dailyEnergySplit[0]
            dailyEnergyDec = dailyEnergySplit[1]

            if len(dailyEnergyDec) == 1:
              dailyEnergyDec = '0'+ dailyEnergyDec
            dailyEnergyCorrect = dailyEnergyWhole + '.' + dailyEnergyDec

            #-- Convert string into Int and Float
            self.generatedPower = float(genPower)/1000 # Its in W eg. 4978. Convert into kW
            self.totalEnergyDaily = float(dailyEnergyCorrect) # It is already in kWh eg. 14.52
            return
        except:
            self.log("Error in connecting to Zever solar server", log="main_log")
            self.generatedPower = 0.00
            self.totalEnergyDaily = None
            return

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions