yaml layout updates to v1.x

This commit is contained in:
root
2026-02-25 21:05:21 +13:00
parent 61b0c64a1e
commit a8d2927274
44 changed files with 6521 additions and 4689 deletions
+108 -80
View File
@@ -1,39 +1,62 @@
##########################################################################################
##########################################################################################
# MASTER BEDROOM BEDSIDE LAMP BULB
# File: esp-bedrm1arlecbulb.yaml
#
# v1.1 - 2026-02-21 Add "Jump Fade Up/Down" switch + configurable Jump Fade (%)
# v1.0 - 2026-02-21 Initial version (ported from Athom bulb YAML to Arlec GLD120HA)
#
# Hardware: Arlec Grid Connect Smart LED Globe RGB (GLD120HA) - B22
# RGB + Warm White + Cold White (RGBWW, 5x PWM channels)
#
# NOTES
# - This keeps the "preferred control" ramping / min-max / watchdog / restore logic.
#:########################################################################################:#
# TITLE: MASTER BEDROOM BEDSIDE LAMP BULB
# zorruno.com layout v1.1 2026
#:########################################################################################:#
# REPO:
# https://home.fox.co.nz/gitea/zorruno/zorruno-homeassistant/src/branch/master/esphome/esp-bedrm1arlecbulb.yaml
#:########################################################################################:#
# VERSIONS:
# v1.2 2026-02-25 Updated yaml to zorruno layout V1.1
# v1.1 2026-02-21 Add "Jump Fade Up/Down" switch + configurable Jump Fade (%)
# v1.0 2026-02-21 Initial version (ported from Athom bulb YAML to Arlec GLD120HA)
#:########################################################################################:#
# HARDWARE:
# - Arlec Grid Connect Smart LED Globe RGB (GLD120HA) - B22
# - ESP8266 (PWM, 5x channels) RGB + Warm White + Cold White (RGBWW)
# - PWM channels:
# - Red GPIO4
# - Green GPIO12
# - Blue GPIO14
# - Warm White GPIO13
# - Cold White GPIO5
#:########################################################################################:#
# OPERATION NOTES:
# - Keeps the "preferred control" ramping / min-max / watchdog / restore logic.
# - All ramping and "Output Set (0-100)" controls FORCE the bulb into Warm White endpoint
# (so everyday dimming uses the Warm White channel only, not mixed CT).
# - You can still control full RGB and CT from HA using the normal light entity.
# (everyday dimming uses Warm White channel only, not mixed CT).
# - Full RGB and CT control is still available from HA using the normal light entity.
# - Max On watchdog turns the whole bulb OFF at the time limit (all channels).
# - Jump Fade switch behavior:
# - ON: jump to (jump% of max cap), then fade up to full (normal fade-up).
# - OFF: jump down to (current - current*jump%), then fade down to OFF (normal fade-down).
##########################################################################################
##########################################################################################
#:########################################################################################:#
# OFFLINE NOTES:
# a) Home Assistant OFFLINE, but Network and MQTT ONLINE
# - Bulb continues local operation and restores per configured restart action.
# - MQTT state publishing may not be visible in HA until HA returns.
# b) MQTT OFFLINE (or broker unreachable)
# - Bulb still operates via HA API (if available) and local logic.
# - MQTT local command topics will not work while MQTT is down.
# c) Entire WiFi/Network OFFLINE
# - Bulb still operates locally (last state/restore behavior as configured).
# - Accurate time is NOT needed (SNTP not needed).
#:########################################################################################:#
##########################################################################################
# SPECIFIC DEVICE VARIABLE SUBSTITUTIONS
##########################################################################################
#:########################################################################################:#
# SUBSTITUTIONS: Specific device variable substitutions
# If NOT using a secrets file, just replace these with the passwords etc (in quotes)
#:########################################################################################:#
substitutions:
# Device Naming
device_name: "esp-bedrm1arlecbulb" # yaml file should be device_name.yaml
friendly_name: "Master Bedroom Bedside Lamp Arlec Bulb"
description_comment: "Bedside lightbulb using gridconnect Arlec RGB bulb"
description_comment: "Bedside lightbulb using gridconnect Arlec RGB bulb (Layout V1.1)"
device_area: "Master Bedroom"
# Project Naming
project_name: "Grid Connect GLD120HA RGBWW.Arlec"
project_version: "v1.1"
project_version: "v1.2"
# Passwords & Secrets (Unfortunately, you can't use substitutions inside secret names)
# Re-using your existing bulb flasher secrets (adjust if you prefer per-device secrets)
@@ -55,28 +78,29 @@ substitutions:
mqtt_local_device_command_OFF: "OFF"
# Device Specific Settings
log_level: "NONE" # NONE, ERROR, WARN, INFO, DEBUG, VERBOSE, VERY_VERBOSE
update_interval: "20s"
led_gamma: "2.8"
minimum_led_output: "1" # % If at this value or below, we'll switch it completely off
maximum_led_output: "80" # % Hard cap
max_on_default_hours: "24" # 0 = no automatic turn-off
pwm_frequency: "1000" # Hz
log_level: "NONE" # NONE, ERROR, WARN, INFO, DEBUG, VERBOSE, VERY_VERBOSE
update_interval: "20s"
led_gamma: "2.8"
minimum_led_output: "1" # % If at this value or below, we'll switch it completely off
maximum_led_output: "80" # % Hard cap
max_on_default_hours: "24" # 0 = no automatic turn-off
pwm_frequency: "1000" # Hz
# Warm/cold endpoints (reported range around 3000K-5700K)
bulb_warm_kelvin: "3000 K"
bulb_cold_kelvin: "5700 K"
bulb_warm_kelvin: "3000 K"
bulb_cold_kelvin: "5700 K"
# Arlec GLD120HA GPIO mapping (PWM)
bulb_red_pin: GPIO4
bulb_green_pin: GPIO12
bulb_blue_pin: GPIO14
bulb_warm_white_pin: GPIO13
bulb_cold_white_pin: GPIO5
bulb_red_pin: GPIO4
bulb_green_pin: GPIO12
bulb_blue_pin: GPIO14
bulb_warm_white_pin: GPIO13
bulb_cold_white_pin: GPIO5
##########################################################################################
#:########################################################################################:#
# PACKAGES: Included Common Packages
##########################################################################################
# https://esphome.io/components/packages.html
#:########################################################################################:#
packages:
#### WIFI, Network (Static/DHCP/IPV6 etc), Fallback AP, Safemode ####
common_wifi: !include
@@ -100,13 +124,14 @@ packages:
local_device_name: "${device_name}"
#### DIAGNOSTICS Sensors ####
diag_basic: !include common/include_basic_diag_sensors.yaml
diag_more: !include common/include_more_diag_sensors.yaml
#diag_debug: !include common/include_debug_diag_sensors.yaml
diag_basic: !include common/include_basic_diag_sensors.yaml
diag_more: !include common/include_more_diag_sensors.yaml
#diag_debug: !include common/include_debug_diag_sensors.yaml
##########################################################################################
# ESPHome CORE CONFIGURATION
##########################################################################################
#:########################################################################################:#
# ESPHOME CORE CONFIGURATION
# https://esphome.io/components/esphome.html
#:########################################################################################:#
esphome:
name: "${device_name}"
friendly_name: "${friendly_name}"
@@ -158,9 +183,10 @@ esphome:
# Boot complete: allow OFF handlers again
- lambda: 'id(booting) = false;'
##########################################################################################
#:########################################################################################:#
# ESP PLATFORM AND FRAMEWORK
##########################################################################################
# https://esphome.io/components/esp8266.html
#:########################################################################################:#
esp8266:
board: esp01_1m
restore_from_flash: true
@@ -171,9 +197,10 @@ mdns:
preferences:
flash_write_interval: 1min
##########################################################################################
#:########################################################################################:#
# GLOBAL VARIABLES
##########################################################################################
# https://esphome.io/components/globals.html
#:########################################################################################:#
globals:
- id: min_brightness_pct
type: int
@@ -255,22 +282,23 @@ globals:
restore_value: false
initial_value: "false"
# Jump Fade percentage (default 25%)
# Jump Fade percentage
- id: jump_fade_pct
type: int
restore_value: true
initial_value: "15"
##########################################################################################
# LOGGER
##########################################################################################
#:########################################################################################:#
# LOGGING
# https://esphome.io/components/logger.html
#:########################################################################################:#
logger:
level: "${log_level}"
baud_rate: 0
##########################################################################################
#:########################################################################################:#
# MQTT COMMANDS (adds device-specific triggers to common MQTT)
##########################################################################################
#:########################################################################################:#
mqtt:
on_message:
- topic: "${mqtt_local_command_topic}/light/set"
@@ -283,9 +311,10 @@ mqtt:
then:
- switch.turn_off: bulb_ramp_switch
##########################################################################################
#:########################################################################################:#
# SWITCH
##########################################################################################
# https://esphome.io/components/switch/
#:########################################################################################:#
switch:
- platform: template
id: bulb_ramp_switch
@@ -319,9 +348,10 @@ switch:
id(ramp_switch_target_on) = false;
- script.execute: jump_ramp_off_script
##########################################################################################
#:########################################################################################:#
# BUTTON
##########################################################################################
# https://esphome.io/components/button/index.html
#:########################################################################################:#
button:
- platform: template
id: fade_up_button
@@ -370,9 +400,10 @@ button:
id(last_brightness_pct) = pct;
}
##########################################################################################
#:########################################################################################:#
# SELECT
##########################################################################################
# https://esphome.io/components/select/index.html
#:########################################################################################:#
select:
- platform: template
id: restart_action
@@ -394,9 +425,10 @@ select:
id(restart_mode) = 2;
}
##########################################################################################
#:########################################################################################:#
# SENSORS
##########################################################################################
# https://esphome.io/components/sensor/
#:########################################################################################:#
sensor:
- platform: template
id: bulb_output_pct
@@ -445,9 +477,10 @@ sensor:
if (pwm > 1.0f) pwm = 1.0f;
return pwm * 100.0f;
##########################################################################################
#:########################################################################################:#
# OUTPUTS: 5 x PWM channels for the Arlec GLD120HA RGBWW bulb
##########################################################################################
# https://esphome.io/components/output/
#:########################################################################################:#
output:
- platform: esp8266_pwm
id: output_red
@@ -474,9 +507,10 @@ output:
pin: ${bulb_cold_white_pin}
frequency: ${pwm_frequency}
##########################################################################################
#:########################################################################################:#
# LIGHT: RGBWW (correct for this bulb)
##########################################################################################
# https://esphome.io/components/light/
#:########################################################################################:#
light:
- platform: rgbww
id: bulb_light
@@ -492,10 +526,9 @@ light:
warm_white_color_temperature: ${bulb_warm_kelvin}
cold_white_color_temperature: ${bulb_cold_kelvin}
# Safety: do not allow RGB and whites simultaneously
color_interlock: true
# Important: keep OFF at boot to avoid instant restore flashes; boot script handles behavior.
# Keep OFF at boot to avoid instant restore flashes; boot script handles behavior.
restore_mode: ALWAYS_OFF
default_transition_length: 2s
@@ -533,7 +566,6 @@ light:
id(last_set_pos) = 0;
id(led_output_set_pct).publish_state(0);
# Cap brightness to max_brightness_pct without a visible step
on_state:
- lambda: |-
const float cap = id(max_brightness_pct) / 100.0f;
@@ -548,9 +580,10 @@ light:
call.set_transition_length(0);
call.perform();
##########################################################################################
#:########################################################################################:#
# NUMBER
##########################################################################################
# https://esphome.io/components/number/
#:########################################################################################:#
number:
- platform: template
id: cfg_ramp_up_s
@@ -612,7 +645,6 @@ number:
id(jump_fade_pct) = v;
id(cfg_jump_fade_pct).publish_state((float) v);
# This is the preferred everyday dimmer slider (FORCES Warm endpoint)
- platform: template
id: led_output_set_pct
name: "${friendly_name} Output Set (0-100)"
@@ -713,9 +745,10 @@ number:
then:
- script.execute: max_on_watchdog
##########################################################################################
#:########################################################################################:#
# SCRIPTS
##########################################################################################
# https://esphome.io/components/script.html
#:########################################################################################:#
script:
- id: ramp_on_script
mode: restart
@@ -930,7 +963,6 @@ script:
then:
- script.stop: ramp_off_script
# Jump UP to (jump_pct% of max cap), only if we are below it.
- if:
condition:
lambda: |-
@@ -971,7 +1003,6 @@ script:
return target_pct / 100.0f;
transition_length: 0s
# Then fade up to full using your normal fade logic
- script.execute: ramp_on_script
# Jump Fade: OFF = jump down to (current - current*jump%) then normal fade down to OFF
@@ -980,12 +1011,10 @@ script:
then:
- script.stop: ramp_on_script
# If the light is off already, do nothing fancy (avoids a flash from ramp_off_script).
- if:
condition:
lambda: 'return id(bulb_light).current_values.is_on();'
then:
# Jump DOWN to (100 - jump)% of current brightness (25 -> 75%), clamp to min.
- light.turn_on:
id: bulb_light
color_temperature: "${bulb_warm_kelvin}"
@@ -997,7 +1026,7 @@ script:
if (jp < 0.0f) jp = 0.0f;
if (jp > 100.0f) jp = 100.0f;
float factor = (100.0f - jp) / 100.0f; // 25 -> 0.75
float factor = (100.0f - jp) / 100.0f;
float target_pct = curr_pct * factor;
float minp = (float) id(min_brightness_pct);
@@ -1010,7 +1039,6 @@ script:
return target_pct / 100.0f;
transition_length: 0s
# Then fade down to off using your normal fade logic
- script.execute: ramp_off_script
else:
- light.turn_off: