home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
71.14k stars 29.82k forks source link

Tesla Powerall integration fails to load when one Power Wall is failing #110516

Open matellis opened 7 months ago

matellis commented 7 months ago

The problem

I have four powerwalls connceted to one gateway. One of the powerwalls is failing, in the Tesla One app it says "Unable to Read Data" for that unit. Consequently the Tesla Powerwall integration fails to load at start and when instructed to reload. Error message in logs says "ValueError: '' is not a valid GridState'. See logs for specific error stack.

It would be great if the integration could handle this and still load, and even better if it could flag that there may be a fault. Tesla didn't tell me until I investigated and found this.

What version of Home Assistant Core has the issue?

core-2024.2.1

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant OS

Integration causing the issue

Tesla Powerwall

Link to integration documentation on our website

https://www.home-assistant.io/integrations/powerwall/

Diagnostics information

2024-02-13 18:51:55.793 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry PDX-2 (Right/9Y/4U/Primary) for powerwall
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 444, in async_setup
    result = await component.async_setup_entry(hass, self)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/powerwall/__init__.py", line 133, in async_setup_entry
    base_info = await _login_and_fetch_base_info(
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/powerwall/__init__.py", line 219, in _login_and_fetch_base_info
    return await _call_base_info(power_wall, host)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/powerwall/__init__.py", line 241, in _call_base_info
    raise e.exceptions[0] from None
  File "/usr/local/lib/python3.12/site-packages/tesla_powerwall/powerwall.py", line 127, in get_batteries
    return [BatteryResponse.from_dict(battery) for battery in batteries]
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/tesla_powerwall/responses.py", line 305, in from_dict
    grid_state=GridState(src["pinv_grid_state"]),
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/enum.py", line 744, in __call__
    return cls.__new__(cls, value)
           ^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/enum.py", line 1158, in __new__
    raise ve_exc
ValueError: '' is not a valid GridState

Example YAML snippet

No response

Anything in the logs that might be useful for us?

"ValueError: '' is not a valid GridState'" The faulty powerwall is returning no data.

Additional information

No response

home-assistant[bot] commented 7 months ago

Hey there @bdraco, @jrester, @daniel-simpson, mind taking a look at this issue as it has been labeled with an integration (powerwall) you are listed as a code owner for? Thanks!

Code owner commands Code owners of `powerwall` can trigger bot actions by commenting: - `@home-assistant close` Closes the issue. - `@home-assistant rename Awesome new title` Renames the issue. - `@home-assistant reopen` Reopen the issue. - `@home-assistant unassign powerwall` Removes the current integration label and assignees on the issue, add the integration domain after the command. - `@home-assistant add-label needs-more-information` Add a label (needs-more-information, problem in dependency, problem in custom component) to the issue. - `@home-assistant remove-label needs-more-information` Remove a label (needs-more-information, problem in dependency, problem in custom component) on the issue.

(message by CodeOwnersMention)


powerwall documentation powerwall source (message by IssueLinks)

borski commented 7 months ago

I have this same issue, and to my knowledge none of my powerwalls are failing yet.

borski commented 7 months ago

I have this same issue, and to my knowledge none of my powerwalls are failing yet.

Upon further investigation with the NetZero app, it would indeed appear one of my Powerwalls is down/failing.

@matellis aside: how did you set up the Tesla One app? It asks me to connect to the wifi but I worry about having to reconfigure the entire thing if I 'add it as a job'

matellis commented 7 months ago

I did "Begin Install" and then scanned the QR code. Or you can ping support and tell them you've got a faulty power wall.

borski commented 7 months ago

I did "Begin Install" and then scanned the QR code. Or you can ping support and tell them you've got a faulty power wall.

Got it, thanks - that worked; was nervous about it reinstalling. Definitely one down. :(

nugget commented 6 months ago

Having the same issue here. I have three Gateways configured and one of them breaks any time I try to upgrade to 2024.2. Restoring back to Home Assistant 2024.1 "fixes the glitch." I've tried with 2024.2.0 and 2024.2.2 both with the same problem.

Curiously, the Tesla custom integration installed via HACS is still able to communicate to all three Gateways, but I thing that's going through the cloud API and not direct to the gateway locally.

No sign of trouble in the Tesla app, but I installed the NetZero app and I can see that the failing Powerwall lacks a graph for "Powerwall" although "Solar", "Home", and "Grid" all look fine. So it does appear there's a config or provisioning issue with the Powerwall that's failing in 2024.2.

@borski @matellis what are you seeing that you're describing as a "down" Powerwall? My failing powerwall seems to be functioning perfectly well otherwise, aside from this glitch.

borski commented 6 months ago

Using "Diagnostics" in the NetZero app I can see one powerwall is not responding. My installer came and checked it out with Tesla on the phone and they RMA'd it. New one is getting installed today. image

nugget commented 6 months ago

Thanks, very helpful. They sure didn't make the diagnostics option easy to find in the NetZero app.

All my Powerwall batteries are healthy on the failing gateway, but I do see that I have an orphan inverter showing up in the Tesla app under a 4th "house" and I bet that's the source of my brokenness that's causing problems in the integration. One of my 4 batteries is disabled due to the inverter misconfiguration (or some other issue, probably related). See the issue I opened below on the library repo for more details

nugget commented 6 months ago

I just tested and confirmed that the underlying bug in the library is fixed in tesla_powerwall v0.5.2. As soon as Home Assistant is updated to use that version we should be good to go. Thanks @bdraco !

deveus commented 5 months ago

I think thread might have just helped me discover that one of my powerwall batteries isn't working. I was chasing down the same error message, found this issue report, and it led me to troubleshooting the actual hardware. Ty @borski for sharing the name of the NetZero app and pointing me in a new direction. Will report back

deveus commented 5 months ago

Confirmed. Tesla is gonna RMA my powerwall battery because they say it's been broken for months. Tesla app reports nothing wrong and no error messages, but Home-Assistant spotted it and threw an error in the logs. Ty friends. Should be replaced soon.

Edit May 10: Bad Powerwall replaced. Integration immediately started working

jrester commented 3 months ago

@matellis @nugget Could you please try the new home-assistant version 2024.6.2, and check if the problem is fixed?

nugget commented 3 months ago

I've since had my installation repaired and I no longer have an inoperative battery to test the bug with.

matellis commented 2 months ago

It's not good that we have to discover ourselves when our very expensive Powerwalls are failing. I wonder how many folks are running sub-optimal after paying thousands and don't know it? Glad you're both mended/on the mend.

matellis commented 2 months ago

@jrester I'm also fixed after my unit got replaced, so unfortunately I'm unable to help, just like @nugget Maybe we should keep this ticket open to see if anyone complains this is for them and close it in a few weeks? Thanks for the patch. Somehow I'm sure I'll be back with more problems in the near future.