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

Don't reload integration for AuthError in Honeywell #91228

Merged
merged 5 commits into from
Apr 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions homeassistant/components/honeywell/climate.py
Original file line number Diff line number Diff line change
Expand Up @@ -419,11 +419,6 @@ async def async_update(self) -> None:
try:
await self._data.client.login()

except aiosomecomfort.AuthError:
self._attr_available = False
await self.hass.async_create_task(
self.hass.config_entries.async_reload(self._data.entry_id)
)
except (
aiosomecomfort.SomeComfortError,
ClientConnectionError,
Expand Down
34 changes: 22 additions & 12 deletions tests/components/honeywell/test_climate.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
"""Test the Whirlpool Sixth Sense climate domain."""
import datetime
from unittest.mock import MagicMock, patch
from unittest.mock import MagicMock

from aiohttp import ClientConnectionError
import aiosomecomfort
import pytest
from syrupy.assertion import SnapshotAssertion
Expand Down Expand Up @@ -1020,17 +1021,26 @@ async def test_async_update_errors(
# "reload integration" test
device.refresh.side_effect = aiosomecomfort.SomeComfortError
client.login.side_effect = aiosomecomfort.AuthError
with patch("homeassistant.config_entries.ConfigEntries.async_reload") as reload:
async_fire_time_changed(
hass,
utcnow() + SCAN_INTERVAL,
)
await hass.async_block_till_done()

entity_id = f"climate.{device.name}"
state = hass.states.get(entity_id)
assert state.state == "unavailable"
assert reload.called_once()
async_fire_time_changed(
hass,
utcnow() + SCAN_INTERVAL,
)
await hass.async_block_till_done()

entity_id = f"climate.{device.name}"
state = hass.states.get(entity_id)
assert state.state == "unavailable"

device.refresh.side_effect = ClientConnectionError
async_fire_time_changed(
hass,
utcnow() + SCAN_INTERVAL,
)
await hass.async_block_till_done()

entity_id = f"climate.{device.name}"
state = hass.states.get(entity_id)
assert state.state == "unavailable"


async def test_aux_heat_off_service_call(
Expand Down