Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improved handling on 0 Watts spurious power reads #317

Merged
merged 4 commits into from
May 26, 2022

Conversation

giachello
Copy link
Contributor

Some systems that pre-date Tesla aquisition of SolarCity will have grid_status: Unknown, but will have solar power values. At the same time, newer systems will report spurious reads of 0 Watts and grid status "Unknown". In this case, if solar power is 0 return null.

Solves #287

@alandtse
Copy link
Collaborator

Hi @bassrock do you mind checking if this PR does anything that impacts your solar setup? It is closing an issue raised with you original edits. I want to avoid a situation where two people keep reverting each others edits unintentionally.

@giachello
Copy link
Contributor Author

Note that I took @bassrock 's original change and comment into account – it should not affect his case (where status was undefined and watts>0)

@bassrock
Copy link
Contributor

@alandtse yea this change is ok 👍

@alandtse
Copy link
Collaborator

Awesome. Thanks to you both. I'll merge and get a release so it can be updated in the main component.

@alandtse alandtse merged commit 213a8e2 into zabuldon:dev May 26, 2022
alandtse added a commit that referenced this pull request May 26, 2022
fix: improve handling on 0 Watts spurious power reads (#317)
@shred86
Copy link
Contributor

shred86 commented Aug 19, 2022

@giachello Sorry, reviving another old commit but this one is causing some issues now that I've implemented getting grid and load power for users that have the Neurio energy monitoring device. I think this solution will work but wanted to make sure it made sense with you.

Basically I moved the check you added to return None to the get_and_process_site_data method. The reason being is if we have the case where grid_status is Unknown and solar_power is 0, I'm simply deleting those two key/values from the response but updating the self.__power dictionary with the rest of the data since it's still valid.

I updated the comments to since this is a "normal" condition for my setup which is a Tesla solar system with a Tesla inverter and no Powerwalls. The grid_status is always Unknown so at night I'm always hitting this case since solar_power is 0. Not a big deal since as soon as we get a solar_power value > 0, it will just start updating again.

@giachello
Copy link
Contributor Author

So the challenge is that with my setup, A Delta M with solar panels and no power wall. there are spurious reports during the day, with grid_status Unknown, and power =0 in-between valid readings with power > 0. If you report that number back instead of null, that will screw up reporting to home assistant. Will your solution work in that scenario?

@shred86
Copy link
Contributor

shred86 commented Aug 19, 2022

In that situation, it should just continue to use the last valid value so I think it would be the same as it currently is. The self.__power dictionary is retained, just the solar_power value won't be updated so whatever was reported last, is what HA will continue to see when it refreshes since it's just pulling from that dictionary.

@shred86
Copy link
Contributor

shred86 commented Aug 19, 2022

Also, if you're able to provide the JSON response to PRODUCT_LIST and SITE_DATA, that would be extremely helpful just to make sure I don't miss anything with your setup. There's some discussion over here about it: #334

So far we have my setup and a Solar Edge Inverter with a Home Energy Gateway and Powerwall 2. I'm trying to gather as many different setups as I can to see how to best implement stuff for the rewrite.

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.

4 participants