diff --git a/homeassistant/components/tplink/entity.py b/homeassistant/components/tplink/entity.py index 12abb7913c0a..02724d4ceeb0 100644 --- a/homeassistant/components/tplink/entity.py +++ b/homeassistant/components/tplink/entity.py @@ -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, ) diff --git a/tests/components/tplink/test_init.py b/tests/components/tplink/test_init.py index 0d757a3fc310..3cb8f8bf8064 100644 --- a/tests/components/tplink/test_init.py +++ b/tests/components/tplink/test_init.py @@ -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(