From b75af6d84a6bbdebd3aa3096021332ebfebb7eb6 Mon Sep 17 00:00:00 2001 From: Erik Montnemery Date: Mon, 30 Mar 2026 13:21:45 +0200 Subject: [PATCH] Mark Entity.async_write_ha_state as final (#166627) --- homeassistant/helpers/entity.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/homeassistant/helpers/entity.py b/homeassistant/helpers/entity.py index d9aca3669ce..63e02627f71 100644 --- a/homeassistant/helpers/entity.py +++ b/homeassistant/helpers/entity.py @@ -1040,9 +1040,14 @@ class Entity( self._async_verify_state_writable() self._async_write_ha_state() + @final @callback def async_write_ha_state(self) -> None: - """Write the state to the state machine.""" + """Write the state to the state machine. + + Note: Integrations which need to customize state write should + override _async_write_ha_state, not this method. + """ if not self.hass or not self._verified_state_writable: self._async_verify_state_writable() if self.hass.loop_thread_id != threading.get_ident():