Skip to content

Update appd_ZeverSolarSensor.py#5

Open
ByteBrewerJB wants to merge 1 commit intoCheongKoo:masterfrom
ByteBrewerJB:makeitworkforenergydashboard
Open

Update appd_ZeverSolarSensor.py#5
ByteBrewerJB wants to merge 1 commit intoCheongKoo:masterfrom
ByteBrewerJB:makeitworkforenergydashboard

Conversation

@ByteBrewerJB
Copy link
Copy Markdown

i tried to make it work for the energy dashboard.

@QuaySo
Copy link
Copy Markdown

QuaySo commented Aug 12, 2021

It works for me, except the value drops to 0 when the inverter is shut down. This look weird in the energy graph, as if the inverter is using energy. To work properly for the energy dashboard the value should keep it's last value of that day until a new day starts.

@ByteBrewerJB
Copy link
Copy Markdown
Author

and what if we set it al 'null' when there is no data?

@QuaySo
Copy link
Copy Markdown

QuaySo commented Aug 12, 2021

That would probably work too. It's worth a try

@QuaySo
Copy link
Copy Markdown

QuaySo commented Aug 19, 2021

and what if we set it al 'null' when there is no data?

I haven't been able to get this working. Did you>

@RemcoA1
Copy link
Copy Markdown

RemcoA1 commented Aug 20, 2021

For me it's working by setting the value to None when the inverter is offline.

       except:
            self.log("Error in connecting to Zever solar server", log="main_log")
            self.generatedPower = 0.00
            self.totalEnergyDaily = None

and I changed the last_reset attribute:

    def doGetGenAndSendAsSensor(self, arg):
        self.log("----- ZeverSolar sensor callback -----", log="main_log")
        #-- Get the generated power & energy
        self.requestSolarGeneration(self)
        lastUpdated = self.dateOfReading.strftime(datetimeFormat) # Last updated
        lastReset = self.dateOfReading.strftime("%Y-%m-%d 00:00:00+02:00")
        #-- Output the sensor values
        #-- Instantaneous Generated power
        stateInfo1 = generationFormat.format(self.generatedPower)
        self.set_state("sensor.zeverSolar_generated_power", state=stateInfo1, attributes=\
                       {"unit_of_measurement": "kW", \
                        "last_reset" : lastReset, \
                        "state_class": "measurement", \
                        "device_class": "energy", \
                        "icon": "mdi:white-balance-sunny", \
                        "friendly_name": "Generated Power",
                        "lastUpdated": lastUpdated
                       })
        #-- Daily energy generated
        #- Icons are located at http://materialdesignicons.com/
        stateInfo2 = generationFormat.format(self.totalEnergyDaily)
        self.set_state("sensor.zeverSolar_daily_energy", state=stateInfo2, attributes=\
                       {"unit_of_measurement": "kWh", \
                        "last_reset" : lastReset, \
                        "state_class": "measurement", \
                        "device_class": "energy", \
                        "icon": "mdi:white-balance-sunny", \
                        "friendly_name": "Daily Generated Energy",
                        "lastUpdated": lastUpdated
                       })

@ByteBrewerJB
Copy link
Copy Markdown
Author

Thanks i will try it soon! I have a newborn at the moment, so my pc time is limited the next couple of weeks :)

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants