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
71k stars 29.64k forks source link

Entity availability issues after update 2024.7.1 #121587

Open Kfrard opened 1 month ago

Kfrard commented 1 month ago

The problem

After updating to 2024.7.1, the connection to the mower is interrupted. Each entity is up/down/up/down, status changes every few minutes. The arrow indicates when the HA update occurs. obraz

What version of Home Assistant Core has the issue?

core-2024.7.1/2/3

What was the last working version of Home Assistant Core?

core-2024.6.0

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

No response

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

Is is for all the entities the same? Can you share the device diagnostics from the moment the entity is not available?

Kfrard commented 1 month ago

Is is for all the entities the same? Can you share the device diagnostics from the moment the entity is not available?

Occurs for: lawn_mower.mower select.mower_headlight_mode sensor.mower_next_launch sensor.mower_restricted_reason switch.mower_enable_schedule

Sent diagnostic data when entities are unavailable. config_entry-husqvarna_automower.json

Thomas55555 commented 1 month ago

This is the config entry diagnostics. Please send the device diagnostics.

Thomas55555 commented 1 month ago

What was the screenshot above? Looked like a binary sensor.

Kfrard commented 1 month ago

This is the config entry diagnostics. Please send the device diagnostics.

Can you suggest how to do this?

What was the screenshot above? Looked like a binary sensor.

switch.mower_enable_schedule

Thomas55555 commented 1 month ago

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

Kfrard commented 1 month ago

I downloaded the diagnostics from here, I don't know any other method. The given page (that I saw) doesn't tell me anything else :(. obraz

Thomas55555 commented 1 month ago

You must click on the device first

Kfrard commented 1 month ago

In fact, I checked the beginning of the file earlier and it looked the same. I am attaching it. husqvarna_automower.json

Thomas55555 commented 1 month ago

As you can see in the file the state of the metadata connected is false. This value comes directly from API, so that's the reason for the non availability. The integration has no influence on that. What's your Husqvarna android/iOS app showing?

Kfrard commented 1 month ago

As you can see in the file the state of the metadata connected is false. This value comes directly from API, so that's the reason for the non availability. The integration has no influence on that. What's your Husqvarna android/iOS app showing?

[The entity was unavailable, I opened the Automower application, it took longer than usual to load and at the same moment it loaded, the entities were available in HA.] It was an isolated case. I made several attempts later and the situation did not repeat. The application works all the time, in HA only 5 entities are unavailable.

The error suggests a problem with code changes, the log indicates that it appeared immediately after the HA Core update.

Thomas55555 commented 1 month ago

The status timestamp in the file is from yesterday morning.... That's strange. Have you restarted ha since the update? And can you do it?

Kfrard commented 1 month ago

I restarted HA today, now I restarted the server. The issue still exists. Why strange?

Thomas55555 commented 1 month ago

Because it should be more recent. Can you send the current device diagnostics?

Kfrard commented 1 month ago

Strange, I restarted HA several times yesterday and today. I have now restarted the entire Proxmox. I am attaching the logs AFTER the restart, I see that due to the lack of availability, the datetime (by the way, with a typo) remained at the time of the HA update. husqvarna_automower-available.json husqvarna_automower-unavailable.json

Kfrard commented 1 month ago

Additionally, when the entities are available, the data is also correct, but when _switch.mower_enableschedule is switched, an error appears. firefox_zIhYoRz9F3 404_switch_logs.txt

Kfrard commented 1 month ago

core-2024.7.2 the problem does not occur

Kfrard commented 1 month ago

The problem is back :(

Thomas55555 commented 1 month ago

Can you run debug logging for a while ( ~20min) and post the results here?

Kfrard commented 1 month ago

I will add that during debugging, I did not make any changes or actions. I have noticed that sometimes the mower's status is incorrectly displayed as "error" (for a while).

2024-07-17 17:23:13.380 DEBUG (MainThread) [aioautomower.session] Got positions-event, data: {'id': 'REDACTED', 'type': 'positions-event', 'attributes': {'positions': [{'latitude': REDACTED, 'longitude': REDACTED}]}}
2024-07-17 17:23:13.381 DEBUG (MainThread) [aioautomower.session] Got status-event, data: {'id': 'REDACTED', 'type': 'status-event', 'attributes': {'battery': {'batteryPercent': 99}, 'mower': {'mode': 'MAIN_AREA', 'activity': 'NOT_APPLICABLE', 'state': 'OFF', 'inactiveReason': 'NONE', 'errorCode': 0, 'errorCodeTimestamp': 0}, 'planner': {'nextStartTimestamp': 0, 'override': {'action': 'NOT_ACTIVE'}, 'restrictedReason': 'NOT_APPLICABLE'}, 'metadata': {'connected': True, 'statusTimestamp': 1721229793280}}}
2024-07-17 17:23:13.381 DEBUG (MainThread) [homeassistant.components.husqvarna_automower.coordinator] Manually updated husqvarna_automower data
2024-07-17 17:23:13.383 DEBUG (MainThread) [homeassistant.components.husqvarna_automower.coordinator] Manually updated husqvarna_automower data
2024-07-17 17:23:23.212 DEBUG (MainThread) [aioautomower.session] Got status-event, data: {'id': 'REDACTED', 'type': 'status-event', 'attributes': {'battery': {'batteryPercent': 99}, 'mower': {'mode': 'MAIN_AREA', 'activity': 'NOT_APPLICABLE', 'state': 'OFF', 'inactiveReason': 'NONE', 'errorCode': 0, 'errorCodeTimestamp': 0}, 'planner': {'nextStartTimestamp': 0, 'override': {'action': 'NOT_ACTIVE'}, 'restrictedReason': 'NOT_APPLICABLE'}, 'metadata': {'connected': True, 'statusTimestamp': 1721229803055}}}
2024-07-17 17:23:23.212 DEBUG (MainThread) [aioautomower.session] Got positions-event, data: {'id': 'REDACTED', 'type': 'positions-event', 'attributes': {'positions': [{'latitude': REDACTED, 'longitude': REDACTED}]}}
2024-07-17 17:23:23.213 DEBUG (MainThread) [homeassistant.components.husqvarna_automower.coordinator] Manually updated husqvarna_automower data
2024-07-17 17:23:23.215 DEBUG (MainThread) [homeassistant.components.husqvarna_automower.coordinator] Manually updated husqvarna_automower data
2024-07-17 17:23:32.531 DEBUG (MainThread) [aioautomower.session] Got status-event, data: {'id': 'REDACTED', 'type': 'status-event', 'attributes': {'battery': {'batteryPercent': 68}, 'mower': {'mode': 'MAIN_AREA', 'activity': 'PARKED_IN_CS', 'state': 'RESTRICTED', 'inactiveReason': 'NONE', 'errorCode': 0, 'errorCodeTimestamp': 0}, 'planner': {'nextStartTimestamp': 1721286000000, 'override': {'action': 'NOT_ACTIVE'}, 'restrictedReason': 'WEEK_SCHEDULE'}, 'metadata': {'connected': True, 'statusTimestamp': 1721229812428}}}
2024-07-17 17:23:32.532 DEBUG (MainThread) [homeassistant.components.husqvarna_automower.coordinator] Manually updated husqvarna_automower data
2024-07-17 17:23:32.572 DEBUG (MainThread) [aioautomower.session] Got positions-event, data: {'id': 'REDACTED', 'type': 'positions-event', 'attributes': {'positions': [{'latitude': REDACTED, 'longitude': REDACTED}]}}
2024-07-17 17:23:32.573 DEBUG (MainThread) [homeassistant.components.husqvarna_automower.coordinator] Manually updated husqvarna_automower data
2024-07-17 17:31:32.163 DEBUG (MainThread) [aioautomower.auth] request[get]=https://api.amc.husqvarna.dev/v1/mowers/ None
2024-07-17 17:31:32.822 DEBUG (MainThread) [aioautomower.auth] response={'data': [{'type': 'mower', 'id': 'REDACTED', 'attributes': {'system': {'name': 'REDACTED', 'model': 'Husqvarna Automower', 'serialNumber': REDACTED}, 'battery': {'batteryPercent': 99}, 'capabilities': {'headlights': True, 'workAreas': False, 'position': True, 'stayOutZones': False}, 'mower': {'mode': 'MAIN_AREA', 'activity': 'NOT_APPLICABLE', 'inactiveReason': 'NONE', 'state': 'OFF', 'errorCode': 0, 'errorCodeTimestamp': 0, 'isErrorConfirmable': False}, 'calendar': {'tasks': [{'start': 360, 'duration': 900, 'monday': True, 'tuesday': True, 'wednesday': True, 'thursday': True, 'friday': True, 'saturday': True, 'sunday': True}]}, 'planner': {'nextStartTimestamp': 0, 'override': {'action': 'NOT_ACTIVE'}, 'restrictedReason': 'NOT_APPLICABLE'}, 'metadata': {'connected': False, 'statusTimestamp': 1721230251998}, 'positions': [{'latitude': REDACTED, 'longitude': REDACTED}, the deleted data is the correct statistics}}}]}
2024-07-17 17:31:32.823 DEBUG (MainThread) [homeassistant.components.husqvarna_automower.coordinator] Finished fetching husqvarna_automower data in 0.660 seconds (success: True)
2024-07-17 17:37:32.473 DEBUG (MainThread) [aioautomower.session] Got status-event, data: {'id': 'REDACTED', 'type': 'status-event', 'attributes': {'battery': {'batteryPercent': 87}, 'mower': {'mode': 'MAIN_AREA', 'activity': 'PARKED_IN_CS', 'state': 'RESTRICTED', 'inactiveReason': 'NONE', 'errorCode': 0, 'errorCodeTimestamp': 0}, 'planner': {'nextStartTimestamp': 1721286000000, 'override': {'action': 'NOT_ACTIVE'}, 'restrictedReason': 'WEEK_SCHEDULE'}, 'metadata': {'connected': True, 'statusTimestamp': 1721230652381}}}
2024-07-17 17:37:32.474 DEBUG (MainThread) [homeassistant.components.husqvarna_automower.coordinator] Manually updated husqvarna_automower data
2024-07-17 17:37:32.542 DEBUG (MainThread) [aioautomower.session] Got positions-event, data: {'id': 'REDACTED', 'type': 'positions-event', 'attributes': {'positions': [{'latitude': REDACTED, 'longitude': REDACTED}]}}
2024-07-17 17:37:32.543 DEBUG (MainThread) [homeassistant.components.husqvarna_automower.coordinator] Manually updated husqvarna_automower data
Kfrard commented 1 month ago

After updating to core-2021.7.3, I see false data. There is no error in the mower, nor in the Automower app. obraz

Kfrard commented 4 days ago

@Thomas55555 Do you have any idea why this might be happening?

Thomas55555 commented 4 days ago

I have an idea why this is happening: I think the problem is, that when polling the API, you get different results like with getting push updates from the API. But I can't explain why and I also don't have a solution. And it seems like you are the only one with the problem. Maybe you should contact Husqvarna of they can find the problem. You can find a email address in the Husqvarna developers portal. They are very helpful there.

Please let me know, what they say.