gateway/modules/features/featuresLifecycle.py
2025-11-10 16:51:28 +01:00

44 lines
1.3 KiB
Python

import logging
from modules.interfaces.interfaceDbAppObjects import getRootInterface
logger = logging.getLogger(__name__)
async def start() -> None:
""" Start feature triggers and background managers """
# Provide Event User
rootInterface = getRootInterface()
eventUser = rootInterface.getUserByUsername("event")
# Feature Automation Events
if eventUser:
try:
from modules.interfaces.interfaceDbChatObjects import getInterface as getChatInterface
chatInterface = getChatInterface(eventUser)
await chatInterface.syncAutomationEvents()
logger.info("Automation events synced on startup")
except Exception as e:
logger.error(f"Error syncing automation events on startup: {str(e)}")
# Don't fail startup if automation sync fails
# Feature SyncDelta
from modules.features.syncDelta import mainSyncDelta
mainSyncDelta.startSyncManager(eventUser)
# Feature ChatAlthaus
from modules.features.chatAlthaus import mainChatAlthaus
mainChatAlthaus.startDataScheduler(eventUser)
await mainChatAlthaus.performDataUpdate(eventUser)
# Feature ...
return True
async def stop() -> None:
""" Stop feature triggers and background managers """
# Feature ...
return True