82cd5a8f2c359d188509f82941ab8c1b5c3605c7
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; 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
- 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. - Create the virtual environment and install the dependencies:
py -m venv .venvthen.venv\Scripts\pip install -r requirements.txt - Copy
config.example.jsontoconfig.jsonand put that user's name and password in it.config.jsonis ignored by git, so the credentials stay out of the repo. - Run once to test:
.venv\Scripts\python.exe pc_monitor_mqtt.py(Ctrl+C to stop). - Start it at login (no console window):
start.vbsin the Startup folder or a scheduled task.
The log is written to pc_monitor.log next to the script.
Languages
Python
96.4%
VBScript
3.6%