Files
mangavalkandClaude Opus 5.5 b314ceb79e Keep the monitor reported as on at minimum brightness when turned off
Reporting OFF made Adaptive Lighting stop adapting the monitor. The screen
never really turns off, so "off" now sets the minimum brightness and the
light stays on at brightness 1.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-18 01:41:42 +01:00

24 lines
1.3 KiB
Markdown

# ha-monitor-brightness
Makes the PC monitor's brightness controllable from Home Assistant: the monitor appears as
`light.pc_monitor` (MQTT discovery) and its brightness is set over DDC/CI.
- Home Assistant 1-255 maps onto monitor brightness `min_level`..`max_level` (default 5-100).
- "Off" sets the minimum brightness and the light stays reported as on (1%), so Adaptive Lighting keeps adapting it; the monitor itself stays on.
- Brightness changed with the monitor's own buttons is reported back every `poll_seconds` (default 30).
- When the PC is off the light shows as unavailable.
## Setup
1. In Home Assistant create a user for the service (Settings → People → Users → Add user,
e.g. `pc-monitor`, "Can only log in from the local network"). The Mosquitto add-on accepts
Home Assistant users.
2. Create the virtual environment and install the dependencies:
`py -m venv .venv` then `.venv\Scripts\pip install -r requirements.txt`
3. Copy `config.example.json` to `config.json` and put that user's name and password in it.
`config.json` is ignored by git, so the credentials stay out of the repo.
4. Run once to test: `.venv\Scripts\python.exe pc_monitor_mqtt.py` (Ctrl+C to stop).
5. Start it at login (no console window): `start.vbs` in the Startup folder or a scheduled task.
The log is written to `pc_monitor.log` next to the script.