1
0
mirror of https://github.com/home-assistant/core.git synced 2025-12-24 21:06:19 +00:00

Add debug mode to catch unsafe thread operations using core helpers (#115390)

* adjust

* adjust

* fixes

* one more

* test

* debug

* move to config

* cover

* Update homeassistant/core.py

* set debug from RuntimeConfig

* reduce

* fix message

* raise

* Update homeassistant/core.py

* Update homeassistant/core.py

* no flood check for raise

* cover
This commit is contained in:
J. Nick Koston
2024-04-24 03:36:05 +02:00
committed by GitHub
parent 9d54aa205b
commit 53a179088f
18 changed files with 197 additions and 10 deletions

View File

@@ -971,6 +971,8 @@ class Entity(
"""Write the state to the state machine."""
if self.hass is None:
raise RuntimeError(f"Attribute hass is None for {self}")
if self.hass.config.debug:
self.hass.verify_event_loop_thread("async_write_ha_state")
# The check for self.platform guards against integrations not using an
# EntityComponent and can be removed in HA Core 2024.1