Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Catch InvalidAuthError in shutdown() method for Shelly gen2 devices #94563

Merged
merged 3 commits into from
Jun 14, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 4 additions & 1 deletion homeassistant/components/shelly/coordinator.py
Original file line number Diff line number Diff line change
Expand Up @@ -535,7 +535,10 @@
async def shutdown(self) -> None:
"""Shutdown the coordinator."""
if self.device.connected:
await async_stop_scanner(self.device)
try:
await async_stop_scanner(self.device)
except InvalidAuthError:
self.entry.async_start_reauth(self.hass)

Check warning on line 541 in homeassistant/components/shelly/coordinator.py

View check run for this annotation

Codecov / codecov/patch

homeassistant/components/shelly/coordinator.py#L540-L541

Added lines #L540 - L541 were not covered by tests
await self.device.shutdown()
await self._async_disconnected()

Expand Down