Edit esp-loungebookshelfleds.yaml
This commit is contained in:
@@ -6,6 +6,7 @@
|
|||||||
# https://home.fox.co.nz/gitea/zorruno/zorruno-homeassistant/src/branch/master/esphome/esp-loungebookshelfleds.yaml
|
# https://home.fox.co.nz/gitea/zorruno/zorruno-homeassistant/src/branch/master/esphome/esp-loungebookshelfleds.yaml
|
||||||
#:########################################################################################:#
|
#:########################################################################################:#
|
||||||
# VERSIONS:
|
# VERSIONS:
|
||||||
|
# V2.2 2026-07-20 Simplified local MQTT command and status topics to the device root
|
||||||
# V2.1 2026-03-11 Updated yaml to zorruno layout V1.1
|
# V2.1 2026-03-11 Updated yaml to zorruno layout V1.1
|
||||||
# V2.0 2025-09-15 A bunch of fixes and made it more standard across my devices
|
# V2.0 2025-09-15 A bunch of fixes and made it more standard across my devices
|
||||||
# V1.0 2025-08-17 First setup (and replacement of Tasmota)
|
# V1.0 2025-08-17 First setup (and replacement of Tasmota)
|
||||||
@@ -48,10 +49,10 @@
|
|||||||
# - Maximum ON time before automatic fade-down (1-48 h, 0 = no limit)
|
# - Maximum ON time before automatic fade-down (1-48 h, 0 = no limit)
|
||||||
#
|
#
|
||||||
# MQTT COMMANDS:
|
# MQTT COMMANDS:
|
||||||
# - ${mqtt_local_command_topic}/light/set = ON
|
# - ${mqtt_local_command_topic} = ON
|
||||||
# - ${mqtt_local_command_topic}/light/set = OFF
|
# - ${mqtt_local_command_topic} = OFF
|
||||||
# - State publishes to:
|
# - State publishes to:
|
||||||
# - ${mqtt_local_status_topic}/light/state
|
# - ${mqtt_local_status_topic}
|
||||||
#:########################################################################################:#
|
#:########################################################################################:#
|
||||||
# OFFLINE NOTES:
|
# OFFLINE NOTES:
|
||||||
# a) Home Assistant offline (network and MQTT online):
|
# a) Home Assistant offline (network and MQTT online):
|
||||||
@@ -84,7 +85,7 @@ substitutions:
|
|||||||
|
|
||||||
# Project Naming
|
# Project Naming
|
||||||
project_name: "Magichome Single Colour V1.1 LED Controller.Generic ESP8266" # Project details. Manufacturer before the dot, device after the dot.
|
project_name: "Magichome Single Colour V1.1 LED Controller.Generic ESP8266" # Project details. Manufacturer before the dot, device after the dot.
|
||||||
project_version: "v2.1" # Project version denotes release of the YAML file, allowing checking of deployed vs latest version
|
project_version: "v2.2" # Project version denotes release of the YAML file, allowing checking of deployed vs latest version
|
||||||
|
|
||||||
# Passwords & Secrets (Unfortunately, you can't use substitutions inside secret names)
|
# Passwords & Secrets (Unfortunately, you can't use substitutions inside secret names)
|
||||||
api_key: !secret esp-api_key # If using HA API
|
api_key: !secret esp-api_key # If using HA API
|
||||||
@@ -102,19 +103,19 @@ substitutions:
|
|||||||
mqtt_local_device_command_OFF: "OFF"
|
mqtt_local_device_command_OFF: "OFF"
|
||||||
|
|
||||||
# Device Specific Settings
|
# Device Specific Settings
|
||||||
log_level: "NONE" # Define logging level: NONE, ERROR, WARN, INFO, DEBUG (default), VERBOSE, VERY_VERBOSE
|
log_level: "NONE" # Define logging level: NONE, ERROR, WARN, INFO, DEBUG (default), VERBOSE, VERY_VERBOSE
|
||||||
update_interval: "20s" # Update time for general sensors, etc.
|
update_interval: "20s" # Update time for general sensors, etc.
|
||||||
led_gamma: "1.2" # Gamma from 1.2-3 is sensible to normalise the LED fading vs PWM
|
led_gamma: "1.2" # Gamma from 1.2-3 is sensible to normalise the LED fading vs PWM
|
||||||
minimum_led_output: "1" # % If at this value or below, we will switch it completely off
|
minimum_led_output: "1" # % If at this value or below, we will switch it completely off
|
||||||
maximum_led_output: "90" # % Maximum output; it is sometimes nice to limit the output for longevity or aesthetics
|
maximum_led_output: "90" # % Maximum output; it is sometimes nice to limit the output for longevity or aesthetics
|
||||||
max_on_default_hours: "24" # The maximum time the LEDs will be on, in case they get left on. 0 = no automatic turn-off
|
max_on_default_hours: "24" # The maximum time the LEDs will be on, in case they get left on. 0 = no automatic turn-off
|
||||||
pwm_frequency: "1000" # PWM output Frequency in Hz. High enough to avoid audible/visible artifacts
|
pwm_frequency: "1000" # PWM output Frequency in Hz. High enough to avoid audible/visible artifacts
|
||||||
|
|
||||||
# Device Specific GPIO (so we can easily update for other devices)
|
# Device Specific GPIO (so we can easily update for other devices)
|
||||||
device_status_led: GPIO2
|
device_status_led: GPIO2
|
||||||
device_mosfet_out: GPIO12
|
device_mosfet_out: GPIO12
|
||||||
device_usr_button: GPIO4 # if no button, this is just a fake/safeish choice so it compiles with the generic yaml
|
device_usr_button: GPIO4 # if no button, this is just a fake/safeish choice so it compiles with the generic yaml
|
||||||
device_fading_led: GPIO13 # if no LED, this is just a fake/safeish choice so it compiles with the generic yaml
|
device_fading_led: GPIO13 # if no LED, this is just a fake/safeish choice so it compiles with the generic yaml
|
||||||
|
|
||||||
#:########################################################################################:#
|
#:########################################################################################:#
|
||||||
# PACKAGES:
|
# PACKAGES:
|
||||||
@@ -132,8 +133,7 @@ packages:
|
|||||||
local_ota_pass: "${ota_pass}"
|
local_ota_pass: "${ota_pass}"
|
||||||
|
|
||||||
#### HOME ASSISTANT API (choose encryption or no encryption options) ####
|
#### HOME ASSISTANT API (choose encryption or no encryption options) ####
|
||||||
common_api: !include
|
common_api: !include #file: common/api_common.yaml
|
||||||
#file: common/api_common.yaml
|
|
||||||
file: common/api_common_noencryption.yaml
|
file: common/api_common_noencryption.yaml
|
||||||
vars:
|
vars:
|
||||||
local_api_key: "${api_key}"
|
local_api_key: "${api_key}"
|
||||||
@@ -245,12 +245,12 @@ globals:
|
|||||||
- id: min_brightness_pct
|
- id: min_brightness_pct
|
||||||
type: int
|
type: int
|
||||||
restore_value: true
|
restore_value: true
|
||||||
initial_value: "${minimum_led_output}" # start/finish at X%
|
initial_value: "${minimum_led_output}" # start/finish at X%
|
||||||
# Maximum Brightness % for LEDs (should never go beyond this)
|
# Maximum Brightness % for LEDs (should never go beyond this)
|
||||||
- id: max_brightness_pct
|
- id: max_brightness_pct
|
||||||
type: int
|
type: int
|
||||||
restore_value: false
|
restore_value: false
|
||||||
initial_value: "${maximum_led_output}" # hard cap; never exceed this
|
initial_value: "${maximum_led_output}" # hard cap; never exceed this
|
||||||
# The maximum time the lights will stay on, in hours. Just in case they are left on. 0 = forever
|
# The maximum time the lights will stay on, in hours. Just in case they are left on. 0 = forever
|
||||||
- id: max_on_hours
|
- id: max_on_hours
|
||||||
type: int
|
type: int
|
||||||
@@ -260,23 +260,23 @@ globals:
|
|||||||
- id: led_gamma_f
|
- id: led_gamma_f
|
||||||
type: float
|
type: float
|
||||||
restore_value: false
|
restore_value: false
|
||||||
initial_value: ${led_gamma} # numeric at compile time
|
initial_value: ${led_gamma} # numeric at compile time
|
||||||
|
|
||||||
# Default Fading Up Time (Selectable and will be retained)
|
# Default Fading Up Time (Selectable and will be retained)
|
||||||
- id: ramp_up_ms # fade-in when turned ON
|
- id: ramp_up_ms # fade-in when turned ON
|
||||||
type: int
|
type: int
|
||||||
restore_value: true
|
restore_value: true
|
||||||
initial_value: "5000" # 5 s
|
initial_value: "5000" # 5 s
|
||||||
# Default Fading Down Time (Selectable and will be retained)
|
# Default Fading Down Time (Selectable and will be retained)
|
||||||
- id: ramp_down_ms # fade-out when turned OFF
|
- id: ramp_down_ms # fade-out when turned OFF
|
||||||
type: int
|
type: int
|
||||||
restore_value: true
|
restore_value: true
|
||||||
initial_value: "10000" # 10 s
|
initial_value: "10000" # 10 s
|
||||||
# Action on Restart. (0=Fade full, 1=Restore brightness, 2=Remain off)
|
# Action on Restart. (0=Fade full, 1=Restore brightness, 2=Remain off)
|
||||||
- id: restart_mode
|
- id: restart_mode
|
||||||
type: int
|
type: int
|
||||||
restore_value: true
|
restore_value: true
|
||||||
initial_value: "0" # default = Fade Up to Full (so can be deployed with no other setup)
|
initial_value: "0" # default = Fade Up to Full (so can be deployed with no other setup)
|
||||||
|
|
||||||
# Determine last fade direction.
|
# Determine last fade direction.
|
||||||
# true when you asked the light to end up ON (Ramp Up)
|
# true when you asked the light to end up ON (Ramp Up)
|
||||||
@@ -332,7 +332,7 @@ globals:
|
|||||||
# Logs all log messages through the serial port and through MQTT topics.
|
# Logs all log messages through the serial port and through MQTT topics.
|
||||||
#:########################################################################################:#
|
#:########################################################################################:#
|
||||||
logger:
|
logger:
|
||||||
level: "${log_level}" # INFO Level suggested, or DEBUG for testing
|
level: "${log_level}" # INFO Level suggested, or DEBUG for testing
|
||||||
baud_rate: 0 # set to 0 for no logging via UART, needed if you are using it for other serial things (eg PZEM, Serial control)
|
baud_rate: 0 # set to 0 for no logging via UART, needed if you are using it for other serial things (eg PZEM, Serial control)
|
||||||
|
|
||||||
#:########################################################################################:#
|
#:########################################################################################:#
|
||||||
@@ -351,12 +351,12 @@ status_led:
|
|||||||
mqtt:
|
mqtt:
|
||||||
on_message:
|
on_message:
|
||||||
# Light control to ramp up
|
# Light control to ramp up
|
||||||
- topic: "${mqtt_local_command_topic}/light/set"
|
- topic: "${mqtt_local_command_topic}"
|
||||||
payload: "${mqtt_local_device_command_ON}"
|
payload: "${mqtt_local_device_command_ON}"
|
||||||
then:
|
then:
|
||||||
- switch.turn_on: mosfet_ramp_switch
|
- switch.turn_on: mosfet_ramp_switch
|
||||||
# Light control to ramp down
|
# Light control to ramp down
|
||||||
- topic: "${mqtt_local_command_topic}/light/set"
|
- topic: "${mqtt_local_command_topic}"
|
||||||
payload: "${mqtt_local_device_command_OFF}"
|
payload: "${mqtt_local_device_command_OFF}"
|
||||||
then:
|
then:
|
||||||
- switch.turn_off: mosfet_ramp_switch
|
- switch.turn_off: mosfet_ramp_switch
|
||||||
@@ -570,7 +570,7 @@ output:
|
|||||||
frequency: ${pwm_frequency}
|
frequency: ${pwm_frequency}
|
||||||
|
|
||||||
- platform: gpio
|
- platform: gpio
|
||||||
id: green_led_out # Green LED
|
id: green_led_out # Green LED
|
||||||
pin:
|
pin:
|
||||||
number: ${device_fading_led}
|
number: ${device_fading_led}
|
||||||
inverted: false
|
inverted: false
|
||||||
@@ -593,7 +593,7 @@ light:
|
|||||||
on_turn_on:
|
on_turn_on:
|
||||||
- output.turn_on: green_led_out
|
- output.turn_on: green_led_out
|
||||||
- mqtt.publish:
|
- mqtt.publish:
|
||||||
topic: "${mqtt_local_status_topic}/light/state"
|
topic: "${mqtt_local_status_topic}"
|
||||||
payload: "${mqtt_local_device_command_ON}"
|
payload: "${mqtt_local_device_command_ON}"
|
||||||
retain: true
|
retain: true
|
||||||
- lambda: |-
|
- lambda: |-
|
||||||
@@ -617,7 +617,7 @@ light:
|
|||||||
lambda: "return !id(booting);"
|
lambda: "return !id(booting);"
|
||||||
then:
|
then:
|
||||||
- mqtt.publish:
|
- mqtt.publish:
|
||||||
topic: "${mqtt_local_status_topic}/light/state"
|
topic: "${mqtt_local_status_topic}"
|
||||||
payload: "${mqtt_local_device_command_OFF}"
|
payload: "${mqtt_local_device_command_OFF}"
|
||||||
retain: true
|
retain: true
|
||||||
- lambda: "id(ramp_switch_target_on) = false;"
|
- lambda: "id(ramp_switch_target_on) = false;"
|
||||||
@@ -957,7 +957,7 @@ script:
|
|||||||
- id: deferred_restore_brightness
|
- id: deferred_restore_brightness
|
||||||
mode: restart
|
mode: restart
|
||||||
then:
|
then:
|
||||||
- delay: 5s # let preferences/globals load and light settle
|
- delay: 5s # let preferences/globals load and light settle
|
||||||
- lambda: |-
|
- lambda: |-
|
||||||
// Use ONLY the exact last saved brightness.
|
// Use ONLY the exact last saved brightness.
|
||||||
float target = id(last_brightness_pct);
|
float target = id(last_brightness_pct);
|
||||||
|
|||||||
Reference in New Issue
Block a user