Module-level triggers start before Home Assistant reaches the RUNNING state
modules/module.py:
@time_trigger
def module_startup():
log.info(f"Module hass state: {hass.state}")
test.py:
from module import module_startup
@time_trigger
def file_startup():
log.info(f"File hass state: {hass.state}")
Log on HA startup:
[custom_components.pyscript.modules.module.module_startup] Module hass state: NOT_RUNNING
...few seconds...
[custom_components.pyscript.file.test.file_startup] File hass state: RUNNING