From 67a8ed7436a11c61c79b9d48e0215db46d74c973 Mon Sep 17 00:00:00 2001 From: ESPHome Device Builder Date: Sun, 19 Jul 2026 21:45:20 +1200 Subject: [PATCH] Edit esp-bedside-panel.yaml --- esphome/esp-bedside-panel.yaml | 82 +++++++++++++++++++++++++++++----- 1 file changed, 71 insertions(+), 11 deletions(-) diff --git a/esphome/esp-bedside-panel.yaml b/esphome/esp-bedside-panel.yaml index 0c77a69..ba21cbe 100644 --- a/esphome/esp-bedside-panel.yaml +++ b/esphome/esp-bedside-panel.yaml @@ -6,6 +6,7 @@ # https://home.fox.co.nz/gitea/zorruno/zorruno-homeassistant/src/branch/master/esphome/esp-bedside-panel.yaml #:########################################################################################:# # VERSIONS: +# V1.35 2026-07-19 Added an adjustable Blackout range below 2 lx # V1.34 2026-07-19 Added three ambient-light ranges and periodic backlight rechecking # V1.33 2026-07-19 Raised the default night lux threshold after TEMT6000 testing # V1.32 2026-07-19 Added persistent ambient-light thresholds, brightness levels and idle delays @@ -119,7 +120,7 @@ # - Sleep: 2 hrs starts a local 120-minute countdown and turns the heat pump off. # - Pressing the active Sleep button again cancels the countdown. # - TEMT6000 voltage and approximate lux are exposed for calibration. -# - Ambient light is divided into Dark, Normal and Bright ranges. +# - Ambient light is divided into Blackout, Dark, Normal and Bright ranges. # - Touch immediately restores the active brightness for the current range. # - The current page dims after a configurable idle delay. # - A second configurable delay changes to the large Clock page. @@ -143,12 +144,12 @@ substitutions: # Device Naming device_name: "esp-bedside-panel" friendly_name: "ESP Bedside Panel" - description_comment: "Guition JC1060P470C_I_W_Y ESP32-P4 bedside control panel. Three-range adaptive touch and clock brightness with periodic ambient rechecking. (Layout V1.1)" + description_comment: "Guition JC1060P470C_I_W_Y ESP32-P4 bedside control panel. Four-range adaptive brightness including an adjustable blackout level below 2 lx. (Layout V1.1)" device_area: "Bedroom" # Project Naming project_name: "Guition.JC1060P470C_I_W_Y" - project_version: "v1.34" + project_version: "v1.35" # Passwords & Secrets api_key: !secret esp-api_key @@ -185,9 +186,13 @@ substitutions: # Bright light: approximately 642-643 lx ambient_lux_multiplier_default: "200" + display_blackout_lux_threshold_default: "2" display_dark_lux_threshold_default: "20" display_bright_lux_threshold_default: "250" + # Blackout brightness is shared by touched and idle/clock modes. + display_blackout_brightness_default: "2" + display_dark_touch_brightness_default: "25" display_normal_touch_brightness_default: "80" display_bright_touch_brightness_default: "95" @@ -753,6 +758,20 @@ number: step: 5 mode: box + - platform: template + id: display_blackout_lux_threshold + name: "${friendly_name} Blackout Lux Threshold" + icon: mdi:brightness-1 + entity_category: config + optimistic: true + restore_value: true + initial_value: "${display_blackout_lux_threshold_default}" + unit_of_measurement: "lx" + min_value: 0 + max_value: 20 + step: 0.5 + mode: box + - platform: template id: display_dark_lux_threshold name: "${friendly_name} Dark Lux Threshold" @@ -781,6 +800,20 @@ number: step: 5 mode: box + - platform: template + id: display_blackout_brightness + name: "${friendly_name} Blackout Brightness" + icon: mdi:brightness-1 + entity_category: config + optimistic: true + restore_value: true + initial_value: "${display_blackout_brightness_default}" + unit_of_measurement: "%" + min_value: 1 + max_value: 20 + step: 1 + mode: slider + - platform: template id: display_dark_touch_brightness name: "${friendly_name} Dark Touch Brightness" @@ -1538,10 +1571,11 @@ script: # ADAPTIVE DISPLAY BACKLIGHT #:######################################################################################:# # - # Three ambient ranges are used: - # Dark: lux <= Dark Lux Threshold - # Normal: between the two thresholds - # Bright: lux >= Bright Lux Threshold + # Four ambient ranges are used: + # Blackout: lux < Blackout Lux Threshold + # Dark: Blackout threshold to Dark Lux Threshold + # Normal: between Dark and Bright thresholds + # Bright: lux >= Bright Lux Threshold # # The active and clock/idle brightness levels are independently adjustable # and restored after reboot. @@ -1557,12 +1591,21 @@ script: brightness: !lambda |- const float lux = id(ambient_light_illuminance).state; + float blackout_threshold = + id(display_blackout_lux_threshold).state; float dark_threshold = id(display_dark_lux_threshold).state; float bright_threshold = id(display_bright_lux_threshold).state; - if (isnan(dark_threshold)) { + if (isnan(blackout_threshold)) { + blackout_threshold = 2.0f; + } + + if ( + isnan(dark_threshold) || + dark_threshold <= blackout_threshold + ) { dark_threshold = 20.0f; } @@ -1575,7 +1618,11 @@ script: float brightness_percent; - if (isnan(lux) || lux <= dark_threshold) { + if (!isnan(lux) && lux < blackout_threshold) { + brightness_percent = + id(display_blackout_brightness).state; + id(ambient_light_band_text).publish_state("Blackout"); + } else if (isnan(lux) || lux <= dark_threshold) { brightness_percent = id(display_dark_touch_brightness).state; id(ambient_light_band_text).publish_state("Dark"); @@ -1610,12 +1657,21 @@ script: brightness: !lambda |- const float lux = id(ambient_light_illuminance).state; + float blackout_threshold = + id(display_blackout_lux_threshold).state; float dark_threshold = id(display_dark_lux_threshold).state; float bright_threshold = id(display_bright_lux_threshold).state; - if (isnan(dark_threshold)) { + if (isnan(blackout_threshold)) { + blackout_threshold = 2.0f; + } + + if ( + isnan(dark_threshold) || + dark_threshold <= blackout_threshold + ) { dark_threshold = 20.0f; } @@ -1628,7 +1684,11 @@ script: float brightness_percent; - if (isnan(lux) || lux <= dark_threshold) { + if (!isnan(lux) && lux < blackout_threshold) { + brightness_percent = + id(display_blackout_brightness).state; + id(ambient_light_band_text).publish_state("Blackout"); + } else if (isnan(lux) || lux <= dark_threshold) { brightness_percent = id(display_dark_clock_brightness).state; id(ambient_light_band_text).publish_state("Dark");