mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 03:07:37 +00:00
Improved debugging for "Failed to set state" (#101657)
This commit is contained in:
parent
ba3fd4dee1
commit
1b11062b27
@ -907,7 +907,9 @@ class Entity(ABC):
|
|||||||
self._state_info,
|
self._state_info,
|
||||||
)
|
)
|
||||||
except InvalidStateError:
|
except InvalidStateError:
|
||||||
_LOGGER.exception("Failed to set state, fall back to %s", STATE_UNKNOWN)
|
_LOGGER.exception(
|
||||||
|
"Failed to set state for %s, fall back to %s", entity_id, STATE_UNKNOWN
|
||||||
|
)
|
||||||
hass.states.async_set(
|
hass.states.async_set(
|
||||||
entity_id, STATE_UNKNOWN, {}, self.force_update, self._context
|
entity_id, STATE_UNKNOWN, {}, self.force_update, self._context
|
||||||
)
|
)
|
||||||
|
@ -1500,7 +1500,7 @@ async def test_invalid_state(
|
|||||||
assert (
|
assert (
|
||||||
"homeassistant.helpers.entity",
|
"homeassistant.helpers.entity",
|
||||||
logging.ERROR,
|
logging.ERROR,
|
||||||
f"Failed to set state, fall back to {STATE_UNKNOWN}",
|
f"Failed to set state for test.test, fall back to {STATE_UNKNOWN}",
|
||||||
) in caplog.record_tuples
|
) in caplog.record_tuples
|
||||||
|
|
||||||
ent._attr_state = "x" * 255
|
ent._attr_state = "x" * 255
|
||||||
|
Loading…
x
Reference in New Issue
Block a user