From b314ceb79e670dc9b7948492d264cabadeee76b6 Mon Sep 17 00:00:00 2001 From: MangaValk Date: Wed, 18 Nov 2026 01:41:42 +0100 Subject: [PATCH] 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 --- README.md | 2 +- pc_monitor_mqtt.py | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index cc8f7e8..4b3bdd0 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ Makes the PC monitor's brightness controllable from Home Assistant: the monitor `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. +- "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. diff --git a/pc_monitor_mqtt.py b/pc_monitor_mqtt.py index 260ed6a..2b93f83 100644 --- a/pc_monitor_mqtt.py +++ b/pc_monitor_mqtt.py @@ -4,7 +4,8 @@ The light is announced with MQTT discovery, so Home Assistant (and Adaptive Ligh can set the brightness. Changes made on the monitor itself (OSD buttons) are polled and reported back, so Home Assistant sees them as manual changes. -"Off" in Home Assistant sets the monitor to its minimum brightness; the monitor is not +"Off" in Home Assistant sets the monitor to its minimum brightness and keeps reporting +it as on (1), so Adaptive Lighting keeps adapting it; the monitor is not switched off (power control over DDC/CI is unreliable). """ @@ -143,7 +144,10 @@ class Bridge: log.warning("ignoring non-JSON command: %r", msg.payload) return if cmd.get("state") == "OFF": - self.on = False + # The screen never really turns off, so stay "on" at the lowest brightness. + # Reporting OFF would make Adaptive Lighting stop adapting the monitor. + self.on = True + self.brightness = 1 self.apply(self.min_level) else: self.on = True