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
73.41k stars 30.65k forks source link

Tesla Wall Connector setup failing #94441

Closed evarsanyi closed 1 year ago

evarsanyi commented 1 year ago

The problem

Tesla wall connector was providing connected/disconnector sensor without issues until I upgraded to 2023.5, sensor shows up as unavailable, integration reports "Failed to set up" with a 'key error' in the logs.

Charger info (from charger):

Part Number 1457768-01-G Serial Number B7S20323Y0xxxx

Integration reports (from before it started failing I think):

Device info 1457768-01-G by Tesla Firmware: 23.8.2+gce13e49b546382

What version of Home Assistant Core has the issue?

2023.6.1

What was the last working version of Home Assistant Core?

2022.12.5

What type of installation are you running?

Home Assistant OS

Integration causing the issue

tesla_wall_connector

Link to integration documentation on our website

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

Diagnostics information

No response

Example YAML snippet

No response

Anything in the logs that might be useful for us?

2023-06-11 15:39:12.269 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry Tesla Wall Connector for tesla_wall_connector
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 387, in async_setup
    result = await component.async_setup_entry(hass, self)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/tesla_wall_connector/__init__.py", line 91, in async_setup_entry
    part_number=version_data.part_number,
                ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/tesla_wall_connector/version.py", line 18, in part_number
    return self.raw_data["part_number"]
           ~~~~~~~~~~~~~^^^^^^^^^^^^^^^
KeyError: 'part_number'

Additional information

No intentional configuration changes, first failed for me when I upgraded from 2022.12 to 2023.5.

home-assistant[bot] commented 1 year ago

Hey there @einarhauks, mind taking a look at this issue as it has been labeled with an integration (tesla_wall_connector) you are listed as a code owner for? Thanks!

Code owner commands Code owners of `tesla_wall_connector` 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 tesla_wall_connector` Removes the current integration label and assignees on the issue, add the integration domain after the command.

(message by CodeOwnersMention)


tesla_wall_connector documentation tesla_wall_connector source (message by IssueLinks)

evarsanyi commented 1 year ago

The API on my unit is returning this for version:

imp-269:core ev$ curl http://charger/api/1/version
{"firmware_version":"23.8.2+gce13e49b546382","part_number":"1457768-01G","serial_number":"B7S20323Y04437"}

I put a logging print in before the error:

    await coordinator.async_config_entry_first_refresh()                               

    _LOGGER.info("XXXXXXXXX about to print version data");
    _LOGGER.info("XXXXXXXXX version data = {}".format(vars(version_data)));
    _LOGGER.info("XXXXXXXXX printed version data");                                   

    hass.data[DOMAIN][entry.entry_id] = WallConnectorData(                   
        wall_connector_client=wall_connector,             
        hostname=hostname,          
        part_number=version_data.part_number,                                       
        firmware_version=version_data.firmware_version,
        serial_number=version_data.serial_number,                                       
        update_coordinator=coordinator,
    )                                         
2023-06-11 16:24:25.010 INFO (MainThread) [homeassistant.components.tesla_wall_connector] XXXXXXXXX about to print version data
2023-06-11 16:24:25.010 INFO (MainThread) [homeassistant.components.tesla_wall_connector] XXXXXXXXX version data = {'raw_data': {}}
2023-06-11 16:24:25.010 INFO (MainThread) [homeassistant.components.tesla_wall_connector] XXXXXXXXX printed version data
2023-06-11 16:24:25.011 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry Tesla Wall Connector for tesla_wall_connector
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 387, in async_setup
    result = await component.async_setup_entry(hass, self)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/tesla_wall_connector/__init__.py", line 95, in async_setup_entry
    part_number=version_data.part_number,
                ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/tesla_wall_connector/version.py", line 18, in part_number
    return self.raw_data["part_number"]
           ~~~~~~~~~~~~~^^^^^^^^^^^^^^^
KeyError: 'part_number'
evarsanyi commented 1 year ago

Finally: I deleted and reinstalled the integration and it cleared the error up (?). The only thing that might have been different is I used a FQDN (charger.foo21.com) rather than just "charger" (my DNS server answers either way even without a resolv.conf default domain set up on the client). I didn't see any errors from the underlying wall charger library in the logs so still a mystery.

issue-triage-workflows[bot] commented 1 year ago

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.