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.04k stars 29.7k forks source link

Unexpected error fetching husqvarna_automower data #122273

Closed julianrehm87 closed 1 month ago

julianrehm87 commented 1 month ago

The problem

With home assistant 2024.7 I have issues with the husquvarna integration. My mower cannot be added anymore into home assistant. Authentication on via application secret and application ID still seems to work thus automower shows an error in the integration.

What version of Home Assistant Core has the issue?

core-2024.7.3

What was the last working version of Home Assistant Core?

core-2024.6

What type of installation are you running?

Home Assistant OS

Integration causing the issue

Husqvarna Automower

Link to integration documentation on our website

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

Diagnostics information

Logger: homeassistant.components.husqvarna_automower.coordinator Quelle: helpers/update_coordinator.py:312 Integration: Husqvarna Automower (Dokumentation, Probleme) Erstmals aufgetreten: 21:17:18 (13 Vorkommnisse) Zuletzt protokolliert: 21:33:06

Unexpected error fetching husqvarna_automower data Traceback (most recent call last): File "", line 15, in mashumaro_from_dict File "/usr/local/lib/python3.12/site-packages/aioautomower/model.py", line 211, in husqvarna_schedule_to_calendar if getattr(eventlist[0], "end") > now:


IndexError: list index out of range

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<string>", line 37, in __mashumaro_from_dict__
  File "<string>", line 17, in __mashumaro_from_dict__
mashumaro.exceptions.InvalidFieldValue: Field "events" of type list[AutomowerCalendarEvent] in Tasks has invalid value []

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<string>", line 14, in __mashumaro_from_dict__
  File "<string>", line 39, in __mashumaro_from_dict__
mashumaro.exceptions.InvalidFieldValue: Field "calendar" of type Tasks in MowerAttributes has invalid value {'tasks': []}

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<string>", line 8, in __mashumaro_from_dict__
  File "<string>", line 16, in __mashumaro_from_dict__
mashumaro.exceptions.InvalidFieldValue: Field "attributes" of type MowerAttributes in MowerData has invalid value {'system': {'name': 'AM405X', 'model': 'HUSQVARNA AUTOMOWER® 405X', 'serialNumber': 213601915}, 'battery': {'batteryPercent': 100}, 'capabilities': {'headlights': True, 'workAreas': True, 'position': True, 'stayOutZones': True}, 'mower': {'mode': 'MAIN_AREA', 'activity': 'PARKED_IN_CS', 'inactiveReason': 'NONE', 'state': 'RESTRICTED', 'workAreaId': 0, 'errorCode': 0, 'errorCodeTimestamp': 0, 'isErrorConfirmable': False}, 'calendar': {'tasks': []}, 'planner': {'nextStartTimestamp': 0, 'override': {'action': 'NOT_ACTIVE'}, 'restrictedReason': 'WEEK_SCHEDULE'}, 'metadata': {'connected': True, 'statusTimestamp': 1721502490892}, 'workAreas': [{'workAreaId': 0, 'name': '', 'cuttingHeight': 50}, {'workAreaId': 757, 'name': 'Vorgarten', 'cuttingHeight': 88}, {'workAreaId': 758, 'name': 'Hauptarten', 'cuttingHeight': 88}, {'workAreaId': 759, 'name': 'Durchgang', 'cuttingHeight': 88}], 'positions': [{'latitude': 49.4775458, 'longitude': 8.763238}, {'latitude': 49.477581, 'longitude': 8.7632211}, {'latitude': 49.4775632, 'longitude': 8.76329}, {'latitude': 49.4775549, 'longitude': 8.7633737}, {'latitude': 49.4775676, 'longitude': 8.7634216}, {'latitude': 49.477577, 'longitude': 8.7634215}, {'latitude': 49.4775807, 'longitude': 8.7634884}, {'latitude': 49.4775983, 'longitude': 8.7634715}, {'latitude': 49.4775598, 'longitude': 8.7633989}, {'latitude': 49.4775577, 'longitude': 8.7634126}, {'latitude': 49.4775894, 'longitude': 8.7634718}, {'latitude': 49.4775794, 'longitude': 8.7634693}, {'latitude': 49.4775613, 'longitude': 8.7634453}, {'latitude': 49.4775725, 'longitude': 8.7634229}, {'latitude': 49.4775587, 'longitude': 8.7634119}, {'latitude': 49.4775629, 'longitude': 8.7634561}, {'latitude': 49.4775592, 'longitude': 8.7633973}, {'latitude': 49.4775543, 'longitude': 8.7633773}, {'latitude': 49.4775563, 'longitude': 8.763367}, {'latitude': 49.4775598, 'longitude': 8.7633696}, {'latitude': 49.4775589, 'longitude': 8.7633633}, {'latitude': 49.4775836, 'longitude': 8.7634399}, {'latitude': 49.4775932, 'longitude': 8.7634913}, {'latitude': 49.477564, 'longitude': 8.7634088}, {'latitude': 49.4776002, 'longitude': 8.763499}, {'latitude': 49.4775714, 'longitude': 8.7634986}, {'latitude': 49.477588, 'longitude': 8.763475}, {'latitude': 49.477589, 'longitude': 8.7635169}, {'latitude': 49.4775842, 'longitude': 8.7634693}, {'latitude': 49.4775768, 'longitude': 8.7634881}, {'latitude': 49.4775601, 'longitude': 8.7634468}, {'latitude': 49.477582, 'longitude': 8.7634425}, {'latitude': 49.4775937, 'longitude': 8.7635088}, {'latitude': 49.4775876, 'longitude': 8.7635118}, {'latitude': 49.4775664, 'longitude': 8.7634269}, {'latitude': 49.477561, 'longitude': 8.7633902}, {'latitude': 49.4775691, 'longitude': 8.7634628}, {'latitude': 49.4775711, 'longitude': 8.7634394}, {'latitude': 49.4775975, 'longitude': 8.7634897}, {'latitude': 49.4775693, 'longitude': 8.7634892}, {'latitude': 49.4775776, 'longitude': 8.7634177}, {'latitude': 49.4775765, 'longitude': 8.7634891}, {'latitude': 49.4775818, 'longitude': 8.7635158}, {'latitude': 49.4775663, 'longitude': 8.7634493}, {'latitude': 49.4775824, 'longitude': 8.7634798}, {'latitude': 49.4775871, 'longitude': 8.7634708}, {'latitude': 49.4775762, 'longitude': 8.7634346}, {'latitude': 49.4775603, 'longitude': 8.7634011}, {'latitude': 49.477557, 'longitude': 8.7634092}, {'latitude': 49.4775992, 'longitude': 8.7634872}], 'settings': {'cuttingHeight': 5, 'headlight': {'mode': 'EVENING_AND_NIGHT'}}, 'statistics': {'cuttingBladeUsageTime': 133271, 'numberOfChargingCycles': 631, 'numberOfCollisions': 10123, 'totalChargingTime': 1567005, 'totalCuttingTime': 1955055, 'totalDriveDistance': 612788, 'totalRunningTime': 2188528, 'totalSearchingTime': 166382}, 'stayOutZones': {'zones': [], 'dirty': False}}

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 312, in _async_refresh
    self.data = await self._async_update_data()
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/husqvarna_automower/coordinator.py", line 51, in _async_update_data
    return await self.api.get_status()
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/aioautomower/session.py", line 414, in get_status
    self.data = mower_list_to_dictionary_dataclass(self._data)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/aioautomower/utils.py", line 90, in mower_list_to_dictionary_dataclass
    mowers_list = MowerList.from_dict(mower_list)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<string>", line 10, in __mashumaro_from_dict__
mashumaro.exceptions.InvalidFieldValue: Field "data" of type list[MowerData] in MowerList has invalid value [{'type': 'mower', 'id': '4937728e-f9ba-40b0-93bf-e8708099cfe7', 'attributes': {'system': {'name': 'AM405X', 'model': 'HUSQVARNA AUTOMOWER® 405X', 'serialNumber': 213601915}, 'battery': {'batteryPercent': 100}, 'capabilities': {'headlights': True, 'workAreas': True, 'position': True, 'stayOutZones': True}, 'mower': {'mode': 'MAIN_AREA', 'activity': 'PARKED_IN_CS', 'inactiveReason': 'NONE', 'state': 'RESTRICTED', 'workAreaId': 0, 'errorCode': 0, 'errorCodeTimestamp': 0, 'isErrorConfirmable': False}, 'calendar': {'tasks': []}, 'planner': {'nextStartTimestamp': 0, 'override': {'action': 'NOT_ACTIVE'}, 'restrictedReason': 'WEEK_SCHEDULE'}, 'metadata': {'connected': True, 'statusTimestamp': 1721502490892}, 'workAreas': [{'workAreaId': 0, 'name': '', 'cuttingHeight': 50}, {'workAreaId': 757, 'name': 'Vorgarten', 'cuttingHeight': 88}, {'workAreaId': 758, 'name': 'Hauptarten', 'cuttingHeight': 88}, {'workAreaId': 759, 'name': 'Durchgang', 'cuttingHeight': 88}], 'positions': [{'latitude': 49.4775458, 'longitude': 8.763238}, {'latitude': 49.477581, 'longitude': 8.7632211}, {'latitude': 49.4775632, 'longitude': 8.76329}, {'latitude': 49.4775549, 'longitude': 8.7633737}, {'latitude': 49.4775676, 'longitude': 8.7634216}, {'latitude': 49.477577, 'longitude': 8.7634215}, {'latitude': 49.4775807, 'longitude': 8.7634884}, {'latitude': 49.4775983, 'longitude': 8.7634715}, {'latitude': 49.4775598, 'longitude': 8.7633989}, {'latitude': 49.4775577, 'longitude': 8.7634126}, {'latitude': 49.4775894, 'longitude': 8.7634718}, {'latitude': 49.4775794, 'longitude': 8.7634693}, {'latitude': 49.4775613, 'longitude': 8.7634453}, {'latitude': 49.4775725, 'longitude': 8.7634229}, {'latitude': 49.4775587, 'longitude': 8.7634119}, {'latitude': 49.4775629, 'longitude': 8.7634561}, {'latitude': 49.4775592, 'longitude': 8.7633973}, {'latitude': 49.4775543, 'longitude': 8.7633773}, {'latitude': 49.4775563, 'longitude': 8.763367}, {'latitude': 49.4775598, 'longitude': 8.7633696}, {'latitude': 49.4775589, 'longitude': 8.7633633}, {'latitude': 49.4775836, 'longitude': 8.7634399}, {'latitude': 49.4775932, 'longitude': 8.7634913}, {'latitude': 49.477564, 'longitude': 8.7634088}, {'latitude': 49.4776002, 'longitude': 8.763499}, {'latitude': 49.4775714, 'longitude': 8.7634986}, {'latitude': 49.477588, 'longitude': 8.763475}, {'latitude': 49.477589, 'longitude': 8.7635169}, {'latitude': 49.4775842, 'longitude': 8.7634693}, {'latitude': 49.4775768, 'longitude': 8.7634881}, {'latitude': 49.4775601, 'longitude': 8.7634468}, {'latitude': 49.477582, 'longitude': 8.7634425}, {'latitude': 49.4775937, 'longitude': 8.7635088}, {'latitude': 49.4775876, 'longitude': 8.7635118}, {'latitude': 49.4775664, 'longitude': 8.7634269}, {'latitude': 49.477561, 'longitude': 8.7633902}, {'latitude': 49.4775691, 'longitude': 8.7634628}, {'latitude': 49.4775711, 'longitude': 8.7634394}, {'latitude': 49.4775975, 'longitude': 8.7634897}, {'latitude': 49.4775693, 'longitude': 8.7634892}, {'latitude': 49.4775776, 'longitude': 8.7634177}, {'latitude': 49.4775765, 'longitude': 8.7634891}, {'latitude': 49.4775818, 'longitude': 8.7635158}, {'latitude': 49.4775663, 'longitude': 8.7634493}, {'latitude': 49.4775824, 'longitude': 8.7634798}, {'latitude': 49.4775871, 'longitude': 8.7634708}, {'latitude': 49.4775762, 'longitude': 8.7634346}, {'latitude': 49.4775603, 'longitude': 8.7634011}, {'latitude': 49.477557, 'longitude': 8.7634092}, {'latitude': 49.4775992, 'longitude': 8.7634872}], 'settings': {'cuttingHeight': 5, 'headlight': {'mode': 'EVENING_AND_NIGHT'}}, 'statistics': {'cuttingBladeUsageTime': 133271, 'numberOfChargingCycles': 631, 'numberOfCollisions': 10123, 'totalChargingTime': 1567005, 'totalCuttingTime': 1955055, 'totalDriveDistance': 612788, 'totalRunningTime': 2188528, 'totalSearchingTime': 166382}, 'stayOutZones': {'zones': [], 'dirty': False}}}]

### Example YAML snippet

_No response_

### Anything in the logs that might be useful for us?

_No response_

### Additional information

_No response_
home-assistant[bot] commented 1 month ago

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

Code owner commands Code owners of `husqvarna_automower` 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 husqvarna_automower` 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)


husqvarna_automower documentation husqvarna_automower source (message by IssueLinks)

Thomas55555 commented 1 month ago

Hi. Do you have any mowing schedules set in the airport app?

julianrehm87 commented 1 month ago

Hi ThomasTime schedule is empty in the husquvarna app. No schedules set.ThanksJulian   Von meinem iPhone gesendetAm 20.07.2024 um 21:59 schrieb Thomas55555 @.***>: Hi. Do you have any mowing schedules set in the airport app?

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you authored the thread.Message ID: @.***>

brueni commented 1 month ago

Can confirm the behaviour. Thanks for the hint, i had the same issue. Adding a schedule resolves it. I removed the schedules temporary due some construction work on my lawn - apparently this was around the same time i‘ve updated to 2024.07.

julianrehm87 commented 1 month ago

I also just checked again. The issue does really not occur when having a schedule on "My Lawn". Thus it seems to still occur if you have just a schedule on your own lawn areas and not "My Lawn". In my case i actually had on purpose no schedules setup as we have a very small lawn and i just trigger manually on demand and weather. Would be nice if it works as before also without any schedules.

Thomas55555 commented 1 month ago

That should have never worked, actually. But I will fix it.