Safety-Guarded Presence Lighting CLI for Home Assistant

A Python CLI utility that programmatically generates and validates Home Assistant presence-based lighting automations with day and night branching and automated configuration safeguards.

Illustration for: Safety-Guarded Presence Lighting CLI for Home Assistant
AI-generated illustration
WorkingIntermediateFor: homelab

About this project

Configuring motion and mmWave presence automations manually in Home Assistant can lead to repetitive YAML definitions and accidental configuration errors. This project provides a standalone Python command-line utility to scaffold robust, tested presence lighting automations. The tool incorporates custom logic including immediate triggering at night, delayed triggering based on ambient light levels during the day, occupancy timeouts, and retries. Built-in safeguards protect critical entities like server power plugs from being accidentally targeted, validate device domains, verify YAML integrity before applying, and back up the configuration for instant rollback.

What you need

  • Home Assistant installation
  • Python 3 environment
  • Zigbee or Wi-Fi presence sensor
  • Smart light or switch

Highlights

  • Generates multi-condition presence rules with day/night branching and sensor timeouts.
  • Includes safeguards to reject critical infrastructure entities like server and PC plugs.
  • Automatically backs up automations.yaml and verifies deployment before committing changes.

Built with

PythonHome AssistantYAML