Add Home Assistant network control API

This commit is contained in:
ltadeu6 2026-05-11 18:54:44 -03:00
parent 0d61eb6311
commit d9e8fef376
No known key found for this signature in database
GPG key ID: FB9FDAB6B6F3418D
4 changed files with 195 additions and 1 deletions

View file

@ -33,10 +33,12 @@ Then run:
- The service loads optional environment overrides from `~/.config/music-light/env`.
- Use `make status-service`, `make logs-service`, `make restart-service`, and `make uninstall-service`.
- Keep it as a user service because `playerctl` needs access to the logged-in desktop user's MPRIS session.
- The running script exposes an HTTP control API for Home Assistant: `GET /status`, `POST /pause`, `POST /resume`, `POST /toggle`.
## Configuration
Edit constants at the top of `luz-musica.py`:
- `HA_URL`, `HA_TOKEN`, `LIGHT_ENTITY`
- control API: `CONTROL_HOST`, `CONTROL_PORT`, `CONTROL_TOKEN`
- tuning: `BRIGHTNESS_PCT`, `SATURATION_BOOST`, `MIN_SATURATION`, `MIN_VALUE`, `REQUEST_TIMEOUT`
## Expected behavior / troubleshooting