2.5k
GitHub Stars
3
Bundled Files
2 months ago
Catalog Refreshed
3 months ago
First Indexed
Readme & install
Copy the install command, review bundled files from the catalogue, and read any extended description pulled from the listing source.
Installation
Preview and clipboard use veilstrat where the catalogue uses aiagentskills.
npx veilstrat add skill openclaw/skills --skill home-assistant-bridge-python- _meta.json296 B
- README.md1.6 KB
- SKILL.md4.3 KB
Overview
This skill provides a Python-based bridge to control a Home Assistant instance through its REST API. It lets you turn devices on/off, adjust lights and climate, read sensor states and history, manage aliases, and trigger automations or scenes from the command line. It requires a running Home Assistant, a long-lived token, and network access.
How this skill works
The bridge communicates with Home Assistant via HTTPS using your URL and long-lived access token stored in a local config file. Commands are issued through ha-bridge.py which maps friendly aliases to entity IDs, calls the appropriate HA services, and can optionally verify state after a short delay. It also exposes search, state readout, history queries, and a service list for exploration.
When to use it
- Quickly toggle or verify device state from a script or SSH session
- Adjust lights (brightness, color, color temperature) without opening the UI
- Change thermostat setpoints or modes from automation scripts
- Query sensor states or fetch 24–48 hour history for debugging
- Trigger scenes or services as part of custom workflows
Best practices
- Create and maintain aliases.json to use human-friendly names instead of entity IDs
- Store HA_URL and HA_TOKEN in the local config produced by the setup script and restrict token scope
- Use --verify for critical on/off actions because HA state updates can lag 1–3 seconds
- Test commands with search and state queries before adding them to automations
- Run the setup script once and source the generated config in automation scripts or your shell
Example use cases
- Turn kitchen lights on during evening via SSH: python3 ha-bridge.py on kitchen --verify
- Set bedroom lights to a specific RGB value for movie mode: python3 ha-bridge.py light bedroom --rgb "255,200,100"
- Lower thermostat before bedtime: python3 ha-bridge.py climate thermostat --temperature 19
- Fetch last 48 hours of temperature history for a sensor: python3 ha-bridge.py history sensor.temp_sensor --hours 48
- Find an entity by name before creating an alias: python3 ha-bridge.py search temp --domain sensor
FAQ
A reachable Home Assistant instance, a long-lived access token, Python 3 with requests, and network connectivity. Run the included setup script to create the local config.
How do aliases work?
Aliases map friendly names to entity IDs in scripts/aliases.json. Use aliases in any command where an entity ID is expected; edit the JSON file to add or change mappings.
Why use --verify?
Home Assistant may take 1–3 seconds to update states after a command. --verify waits and checks the entity state to confirm the action succeeded.