Don't notify listeners on CoreState.CLOSE (#4506)

This commit is contained in:
Mike Degatano 2023-08-25 01:22:49 -04:00 committed by GitHub
parent 1eb95b4d33
commit a79fa14ee7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -70,6 +70,9 @@ class Core(CoreSysAttributes):
)
finally:
self._state = new_state
# Don't attempt to notify anyone on CLOSE as we're about to stop the event loop
if new_state != CoreState.CLOSE:
self.sys_bus.fire_event(BusEvent.SUPERVISOR_STATE_CHANGE, new_state)
# These will be received by HA after startup has completed which won't make sense