Automations are Live: Schedules & Event Triggers
The Rule Engine I mentioned as “next steps” in the last few devlogs is now fully working. The Edge-AI Home Monitoring System can now react on its own, without me touching the dashboard.
What’s New
- New
AutomationManagerclass that manages rules independently of the Flask request lifecycle, running on its own background thread - Schedule triggers: fire any device action at a specific time of day (cron-based under the hood, e.g. “turn off all lights at 23:30”)
- Event triggers: fire actions the moment something happens in the system — currently wired up to the YOLO security pipeline, so a rule can say “when a person is detected, turn on the living room lights”
- Automations are managed straight from the dashboard: add a rule (pick a device, a command, and either a time or an event), see the active list, delete on demand — no need to touch the config files by hand
- Rules persist to disk, so they survive a server restart
Challenges
The trickiest part wasn’t the scheduling logic itself — it was making sure automation actions don’t accidentally go through the same path as normal API requests. Since every device endpoint is gated behind session-based login, having the automation thread call itself over HTTP triggered 401s (a background thread has no browser session, obviously). Fixed by having automation actions call the device classes directly instead of looping back through HTTP — cleaner and faster anyway, since it skips a full request round-trip for something that’s technically internal.
Next Steps
Energy monitoring for the Tapo smart plugs, so automations can eventually be built around actual consumption data too.
Comments 0
No comments yet. Be the first!
Sign in to join the conversation.