Thomas55555 / husqvarna_automower

Custom component for Home Assistant to monitor and control your Husqvarna Automower
https://github.com/Thomas55555/husqvarna_automower
MIT License
105 stars 28 forks source link

KeyError: 'data' in coordinator.session.data["data"] #553

Closed javierarrieta closed 10 months ago

javierarrieta commented 10 months ago

Prerequirements [x] I have connected my mower(s) to the Automower Connect App [x] I have connected my Husqvanra developers account to the Authentication API [x] I have connected my Husqvarna developers account to the Automower Connect API

Describe the bug The integration is failing for the last couple of/three weeks, I have tried removing the credentials, removing the integration and redownloading it and reconfiguring it but I am still getting the same error: KeyError: 'data' in coordinator.session.data["data"]. This is the same error as before removing the credentials and redownloading the integration.

Expected behavior The integration has been working for a few months but failed a while back and haven't been able to fix it.

Additional context This is the detailed log:

2023-11-06 18:41:06.064 ERROR (MainThread) [homeassistant.components.binary_sensor] Error while setting up husqvarna_automower platform for binary_sensor
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 359, in _async_setup_platform
    await asyncio.shield(task)
  File "/config/custom_components/husqvarna_automower/binary_sensor.py", line 25, in async_setup_entry
    for idx, ent in enumerate(coordinator.session.data["data"])
                              ~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^
KeyError: 'data'
2023-11-06 18:41:06.067 ERROR (MainThread) [homeassistant.components.calendar] Error while setting up husqvarna_automower platform for calendar
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 359, in _async_setup_platform
    await asyncio.shield(task)
  File "/config/custom_components/husqvarna_automower/calendar.py", line 33, in async_setup_entry
    for idx, ent in enumerate(coordinator.session.data["data"])
                              ~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^
KeyError: 'data'
2023-11-06 18:41:06.070 ERROR (MainThread) [homeassistant.components.image] Error while setting up husqvarna_automower platform for image
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 359, in _async_setup_platform
    await asyncio.shield(task)
  File "/config/custom_components/husqvarna_automower/image.py", line 51, in async_setup_entry
    for idx, ent in enumerate(coordinator.session.data["data"]):
                              ~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^
KeyError: 'data'
2023-11-06 18:41:06.073 ERROR (MainThread) [homeassistant.components.device_tracker] Error while setting up husqvarna_automower platform for device_tracker
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 359, in _async_setup_platform
    await asyncio.shield(task)
  File "/config/custom_components/husqvarna_automower/device_tracker.py", line 22, in async_setup_entry
    for idx, ent in enumerate(coordinator.session.data["data"]):
                              ~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^
KeyError: 'data'
2023-11-06 18:41:06.076 ERROR (MainThread) [homeassistant.components.number] Error while setting up husqvarna_automower platform for number
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 359, in _async_setup_platform
    await asyncio.shield(task)
  File "/config/custom_components/husqvarna_automower/number.py", line 28, in async_setup_entry
    for idx, ent in enumerate(coordinator.session.data["data"])
                              ~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^
KeyError: 'data'
2023-11-06 18:41:06.078 ERROR (MainThread) [homeassistant.components.select] Error while setting up husqvarna_automower platform for select
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 359, in _async_setup_platform
    await asyncio.shield(task)
  File "/config/custom_components/husqvarna_automower/select.py", line 25, in async_setup_entry
    for idx, ent in enumerate(coordinator.session.data["data"])
                              ~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^
KeyError: 'data'
2023-11-06 18:41:06.080 ERROR (MainThread) [homeassistant.components.sensor] Error while setting up husqvarna_automower platform for sensor
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 359, in _async_setup_platform
    await asyncio.shield(task)
  File "/config/custom_components/husqvarna_automower/sensor.py", line 280, in async_setup_entry
    for idx, ent in enumerate(coordinator.session.data["data"]):
                              ~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^
KeyError: 'data'
2023-11-06 18:41:06.081 ERROR (MainThread) [homeassistant.components.vacuum] Error while setting up husqvarna_automower platform for vacuum
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 359, in _async_setup_platform
    await asyncio.shield(task)
  File "/config/custom_components/husqvarna_automower/vacuum.py", line 48, in async_setup_entry
    for idx, ent in enumerate(coordinator.session.data["data"])
                              ~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^
KeyError: 'data'
2023-11-06 18:42:11.217 INFO (MainThread) [homeassistant.components.image] Setting up image.husqvarna_automower
2023-11-06 18:42:11.218 ERROR (MainThread) [homeassistant.components.image] Error while setting up husqvarna_automower platform for image
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 359, in _async_setup_platform
    await asyncio.shield(task)
  File "/config/custom_components/husqvarna_automower/image.py", line 51, in async_setup_entry
    for idx, ent in enumerate(coordinator.session.data["data"]):
                              ~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^
KeyError: 'data'

Any help appreciated and thanks for creating this!!

kleinerhobbit commented 10 months ago

Same here

kleinerhobbit commented 10 months ago

After removing the integration (incl. Oauth) and adding the integration again, it is working. Maybe this works also to others.

javierarrieta commented 10 months ago

Same here, unsure why it didn't work the first time I removing the integration and credential.

Closing now

javierarrieta commented 10 months ago

Worked when removing the integration and credentials