Edit esp-bedrm1arlecbulb.yaml
This commit is contained in:
@@ -6,6 +6,7 @@
|
||||
# https://home.fox.co.nz/gitea/zorruno/zorruno-homeassistant/src/branch/master/esphome/esp-bedrm1arlecbulb.yaml
|
||||
#:########################################################################################:#
|
||||
# VERSIONS:
|
||||
# v1.3 2026-07-20 Simplified local MQTT command and status topics to the device root
|
||||
# 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)
|
||||
@@ -42,7 +43,6 @@
|
||||
# - Accurate time is NOT needed (SNTP not needed).
|
||||
#:########################################################################################:#
|
||||
|
||||
|
||||
#:########################################################################################:#
|
||||
# SUBSTITUTIONS: Specific device variable substitutions
|
||||
# If NOT using a secrets file, just replace these with the passwords etc (in quotes)
|
||||
@@ -56,7 +56,7 @@ substitutions:
|
||||
|
||||
# Project Naming
|
||||
project_name: "Grid Connect GLD120HA RGBWW.Arlec"
|
||||
project_version: "v1.2"
|
||||
project_version: "v1.3"
|
||||
|
||||
# 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)
|
||||
@@ -156,32 +156,32 @@ esphome:
|
||||
# Mode 0: Fade up to full (obeys fade settings; forces Warm endpoint)
|
||||
- if:
|
||||
condition:
|
||||
lambda: 'return id(restart_mode) == 0;'
|
||||
lambda: "return id(restart_mode) == 0;"
|
||||
then:
|
||||
- lambda: 'id(ramp_switch_target_on) = true;'
|
||||
- lambda: "id(ramp_switch_target_on) = true;"
|
||||
- script.execute: ramp_on_script
|
||||
|
||||
# Mode 1: Restore Brightness (deferred; forces Warm endpoint)
|
||||
- if:
|
||||
condition:
|
||||
lambda: 'return id(restart_mode) == 1;'
|
||||
lambda: "return id(restart_mode) == 1;"
|
||||
then:
|
||||
- script.execute: deferred_restore_brightness
|
||||
|
||||
# Mode 2: Remain Off
|
||||
- if:
|
||||
condition:
|
||||
lambda: 'return id(restart_mode) == 2;'
|
||||
lambda: "return id(restart_mode) == 2;"
|
||||
then:
|
||||
- script.stop: ramp_on_script
|
||||
- script.stop: ramp_off_script
|
||||
- lambda: 'id(ramp_switch_target_on) = false;'
|
||||
- lambda: "id(ramp_switch_target_on) = false;"
|
||||
- light.turn_off:
|
||||
id: bulb_light
|
||||
transition_length: 0s
|
||||
|
||||
# Boot complete: allow OFF handlers again
|
||||
- lambda: 'id(booting) = false;'
|
||||
- lambda: "id(booting) = false;"
|
||||
|
||||
#:########################################################################################:#
|
||||
# ESP PLATFORM AND FRAMEWORK
|
||||
@@ -301,12 +301,12 @@ logger:
|
||||
#:########################################################################################:#
|
||||
mqtt:
|
||||
on_message:
|
||||
- topic: "${mqtt_local_command_topic}/light/set"
|
||||
- topic: "${mqtt_local_command_topic}"
|
||||
payload: "${mqtt_local_device_command_ON}"
|
||||
then:
|
||||
- switch.turn_on: bulb_ramp_switch
|
||||
|
||||
- topic: "${mqtt_local_command_topic}/light/set"
|
||||
- topic: "${mqtt_local_command_topic}"
|
||||
payload: "${mqtt_local_device_command_OFF}"
|
||||
then:
|
||||
- switch.turn_off: bulb_ramp_switch
|
||||
@@ -536,7 +536,7 @@ light:
|
||||
|
||||
on_turn_on:
|
||||
- mqtt.publish:
|
||||
topic: "${mqtt_local_status_topic}/light/state"
|
||||
topic: "${mqtt_local_status_topic}"
|
||||
payload: "${mqtt_local_device_command_ON}"
|
||||
retain: true
|
||||
- lambda: |-
|
||||
@@ -546,20 +546,20 @@ light:
|
||||
- script.stop: max_on_watchdog
|
||||
- if:
|
||||
condition:
|
||||
lambda: 'return id(max_on_hours) > 0;'
|
||||
lambda: "return id(max_on_hours) > 0;"
|
||||
then:
|
||||
- script.execute: max_on_watchdog
|
||||
|
||||
on_turn_off:
|
||||
- if:
|
||||
condition:
|
||||
lambda: 'return !id(booting);'
|
||||
lambda: "return !id(booting);"
|
||||
then:
|
||||
- mqtt.publish:
|
||||
topic: "${mqtt_local_status_topic}/light/state"
|
||||
topic: "${mqtt_local_status_topic}"
|
||||
payload: "${mqtt_local_device_command_OFF}"
|
||||
retain: true
|
||||
- lambda: 'id(ramp_switch_target_on) = false;'
|
||||
- lambda: "id(ramp_switch_target_on) = false;"
|
||||
- script.stop: max_on_watchdog
|
||||
- lambda: |-
|
||||
id(last_brightness_pct) = 0.0f;
|
||||
@@ -667,9 +667,9 @@ number:
|
||||
set_action:
|
||||
- if:
|
||||
condition:
|
||||
lambda: 'return x <= 0.0f;'
|
||||
lambda: "return x <= 0.0f;"
|
||||
then:
|
||||
- lambda: 'id(suppress_slider_sync) = true;'
|
||||
- lambda: "id(suppress_slider_sync) = true;"
|
||||
- script.stop: ramp_on_script
|
||||
- script.stop: ramp_off_script
|
||||
- light.turn_off:
|
||||
@@ -681,7 +681,7 @@ number:
|
||||
id(last_brightness_pct) = 0.0f;
|
||||
id(last_set_pos) = 0;
|
||||
- delay: 400ms
|
||||
- lambda: 'id(suppress_slider_sync) = false;'
|
||||
- lambda: "id(suppress_slider_sync) = false;"
|
||||
else:
|
||||
- lambda: |-
|
||||
id(suppress_slider_sync) = true;
|
||||
@@ -713,7 +713,7 @@ number:
|
||||
if (out_pct > maxp) out_pct = maxp;
|
||||
id(last_brightness_pct) = out_pct;
|
||||
- delay: 400ms
|
||||
- lambda: 'id(suppress_slider_sync) = false;'
|
||||
- lambda: "id(suppress_slider_sync) = false;"
|
||||
|
||||
- platform: template
|
||||
id: cfg_max_on_hours
|
||||
@@ -736,12 +736,12 @@ number:
|
||||
id(cfg_max_on_hours).publish_state((float) hrs);
|
||||
- if:
|
||||
condition:
|
||||
lambda: 'return id(bulb_light).current_values.is_on();'
|
||||
lambda: "return id(bulb_light).current_values.is_on();"
|
||||
then:
|
||||
- script.stop: max_on_watchdog
|
||||
- if:
|
||||
condition:
|
||||
lambda: 'return id(max_on_hours) > 0;'
|
||||
lambda: "return id(max_on_hours) > 0;"
|
||||
then:
|
||||
- script.execute: max_on_watchdog
|
||||
|
||||
@@ -753,7 +753,7 @@ script:
|
||||
- id: ramp_on_script
|
||||
mode: restart
|
||||
then:
|
||||
- lambda: 'id(is_ramping) = true;'
|
||||
- lambda: "id(is_ramping) = true;"
|
||||
- script.stop: ramp_off_script
|
||||
|
||||
- if:
|
||||
@@ -766,13 +766,13 @@ script:
|
||||
- light.turn_on:
|
||||
id: bulb_light
|
||||
color_temperature: "${bulb_warm_kelvin}"
|
||||
brightness: !lambda 'return id(min_brightness_pct) / 100.0f;'
|
||||
brightness: !lambda "return id(min_brightness_pct) / 100.0f;"
|
||||
transition_length: 80ms
|
||||
|
||||
- light.turn_on:
|
||||
id: bulb_light
|
||||
color_temperature: "${bulb_warm_kelvin}"
|
||||
brightness: !lambda 'return id(max_brightness_pct) / 100.0f;'
|
||||
brightness: !lambda "return id(max_brightness_pct) / 100.0f;"
|
||||
transition_length: !lambda |-
|
||||
const auto &cv = id(bulb_light).current_values;
|
||||
const float floor = id(min_brightness_pct) / 100.0f;
|
||||
@@ -795,7 +795,7 @@ script:
|
||||
id(last_ramp_ms) = (int) (id(ramp_up_ms) * frac);
|
||||
return (uint32_t) id(last_ramp_ms);
|
||||
|
||||
- delay: !lambda 'return (uint32_t) id(last_ramp_ms);'
|
||||
- delay: !lambda "return (uint32_t) id(last_ramp_ms);"
|
||||
- lambda: |-
|
||||
id(is_ramping) = false;
|
||||
const auto &cv = id(bulb_light).current_values;
|
||||
@@ -807,7 +807,7 @@ script:
|
||||
- id: ramp_to_target_script
|
||||
mode: restart
|
||||
then:
|
||||
- lambda: 'id(is_ramping) = true;'
|
||||
- lambda: "id(is_ramping) = true;"
|
||||
- script.stop: ramp_off_script
|
||||
|
||||
- if:
|
||||
@@ -820,7 +820,7 @@ script:
|
||||
- light.turn_on:
|
||||
id: bulb_light
|
||||
color_temperature: "${bulb_warm_kelvin}"
|
||||
brightness: !lambda 'return id(min_brightness_pct) / 100.0f;'
|
||||
brightness: !lambda "return id(min_brightness_pct) / 100.0f;"
|
||||
transition_length: 80ms
|
||||
|
||||
- light.turn_on:
|
||||
@@ -858,7 +858,7 @@ script:
|
||||
id(last_ramp_ms) = (int) (id(ramp_up_ms) * frac);
|
||||
return (uint32_t) id(last_ramp_ms);
|
||||
|
||||
- delay: !lambda 'return (uint32_t) id(last_ramp_ms);'
|
||||
- delay: !lambda "return (uint32_t) id(last_ramp_ms);"
|
||||
- lambda: |-
|
||||
id(is_ramping) = false;
|
||||
const auto &cv = id(bulb_light).current_values;
|
||||
@@ -878,7 +878,7 @@ script:
|
||||
- light.turn_on:
|
||||
id: bulb_light
|
||||
color_temperature: "${bulb_warm_kelvin}"
|
||||
brightness: !lambda 'return id(min_brightness_pct) / 100.0f;'
|
||||
brightness: !lambda "return id(min_brightness_pct) / 100.0f;"
|
||||
transition_length: !lambda |-
|
||||
const auto &cv = id(bulb_light).current_values;
|
||||
const float floor = id(min_brightness_pct) / 100.0f;
|
||||
@@ -895,7 +895,7 @@ script:
|
||||
id(last_ramp_ms) = (int) (id(ramp_down_ms) * frac);
|
||||
return (uint32_t) id(last_ramp_ms);
|
||||
|
||||
- delay: !lambda 'return (uint32_t) id(last_ramp_ms);'
|
||||
- delay: !lambda "return (uint32_t) id(last_ramp_ms);"
|
||||
- light.turn_off:
|
||||
id: bulb_light
|
||||
transition_length: 150ms
|
||||
@@ -913,12 +913,12 @@ script:
|
||||
then:
|
||||
- if:
|
||||
condition:
|
||||
lambda: 'return id(max_on_hours) > 0;'
|
||||
lambda: "return id(max_on_hours) > 0;"
|
||||
then:
|
||||
- delay: !lambda 'return (uint32_t) (id(max_on_hours) * 3600000UL);'
|
||||
- delay: !lambda "return (uint32_t) (id(max_on_hours) * 3600000UL);"
|
||||
- if:
|
||||
condition:
|
||||
lambda: 'return id(bulb_light).current_values.is_on();'
|
||||
lambda: "return id(bulb_light).current_values.is_on();"
|
||||
then:
|
||||
- lambda: |-
|
||||
id(ramp_switch_target_on) = false;
|
||||
@@ -942,17 +942,17 @@ script:
|
||||
|
||||
- if:
|
||||
condition:
|
||||
lambda: 'return id(restore_target_pct) > 0.5f;'
|
||||
lambda: "return id(restore_target_pct) > 0.5f;"
|
||||
then:
|
||||
- lambda: |-
|
||||
id(ramp_switch_target_on) = true;
|
||||
id(suppress_slider_sync) = true;
|
||||
- script.stop: ramp_off_script
|
||||
- script.execute: ramp_to_target_script
|
||||
- delay: !lambda 'return (uint32_t) id(last_ramp_ms);'
|
||||
- lambda: 'id(suppress_slider_sync) = false;'
|
||||
- delay: !lambda "return (uint32_t) id(last_ramp_ms);"
|
||||
- lambda: "id(suppress_slider_sync) = false;"
|
||||
else:
|
||||
- lambda: 'id(ramp_switch_target_on) = false;'
|
||||
- lambda: "id(ramp_switch_target_on) = false;"
|
||||
- light.turn_off:
|
||||
id: bulb_light
|
||||
transition_length: 0s
|
||||
@@ -1013,7 +1013,7 @@ script:
|
||||
|
||||
- if:
|
||||
condition:
|
||||
lambda: 'return id(bulb_light).current_values.is_on();'
|
||||
lambda: "return id(bulb_light).current_values.is_on();"
|
||||
then:
|
||||
- light.turn_on:
|
||||
id: bulb_light
|
||||
|
||||
Reference in New Issue
Block a user