mirror of
https://github.com/home-assistant/core.git
synced 2026-08-21 22:01:05 +01:00
Fix tplink crash logging device unavailable warning (#173314)
Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com>
This commit is contained in:
co-authored by
Joost Lekkerkerker
parent
0bee4c11c5
commit
a7b855ed07
@@ -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,
|
||||
)
|
||||
|
||||
@@ -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(
|
||||
|
||||
Reference in New Issue
Block a user