INNER CODE UNIT · Python
check_crash
dummylabs/thewatchman · custom_components/watchman/__init__.py:141
def check_crash() -> bool:
if lock_path.exists():
_LOGGER.error(
"Previous crash detected (lock file found). Watchman is starting in Safe Mode."
)
lock_path.unlink(missing_ok=True)
return True
return False
if await hass.async_add_executor_job(check_crash):
coordinator.update_status(STATE_SAFE_MODE)
hass.data[DOMAIN_DATA] = {"config_entry_id": config_entry.entry_id}
hass.data.setdefault(DOMAIN, {})[config_entry.entry_id] = coordinator
await hass.config_entries.async_forward_entry_setups(config_entry, PLATFORMS)
config_entry.async_on_unload(config_entry.add_update_listener(update_listener))
WatchmanServicesSetup(hass, config_entry)