Fix tplink crash logging device unavailable warning (#173314)

Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com>
This commit is contained in:
Evan Severson
2026-08-19 20:45:33 +02:00
committed by GitHub
co-authored by Joost Lekkerkerker
parent 0bee4c11c5
commit a7b855ed07
2 changed files with 6 additions and 4 deletions
+1 -1
View File
@@ -279,7 +279,7 @@ class CoordinatedTPLinkEntity(CoordinatorEntity[TPLinkDataUpdateCoordinator], AB
if self._attr_available:
_LOGGER.warning(
"Unable to read data for %s %s: %s",
self._device,
self._device.host,
self.entity_id,
ex,
)
+5 -3
View File
@@ -375,7 +375,8 @@ async def test_update_attrs_fails_in_init(
assert entity
state = hass.states.get(entity_id)
assert state.state == STATE_UNAVAILABLE
assert f"Unable to read data for MockLight {entity_id}:" in caplog.text
assert f"Unable to read data for {IP_ADDRESS} {entity_id}:" in caplog.text
assert "MockLight" not in caplog.text
async def test_update_attrs_fails_on_update(
@@ -418,7 +419,8 @@ async def test_update_attrs_fails_on_update(
assert entity
state = hass.states.get(entity_id)
assert state.state == STATE_UNAVAILABLE
assert f"Unable to read data for MockLight {entity_id}:" in caplog.text
assert f"Unable to read data for {IP_ADDRESS} {entity_id}:" in caplog.text
assert "MockLight" not in caplog.text
# Check only logs once
caplog.clear()
freezer.tick(5)
@@ -427,7 +429,7 @@ async def test_update_attrs_fails_on_update(
assert entity
state = hass.states.get(entity_id)
assert state.state == STATE_UNAVAILABLE
assert f"Unable to read data for MockLight {entity_id}:" not in caplog.text
assert f"Unable to read data for {IP_ADDRESS} {entity_id}:" not in caplog.text
async def test_feature_no_category(