esphome pelmet LEDs, lounge scenes and other fixes

This commit is contained in:
root
2025-10-12 19:54:03 +13:00
parent e96344e3ad
commit bcf514a041
19 changed files with 951 additions and 1542 deletions
+65 -25
View File
@@ -30,18 +30,20 @@ substitutions:
api_key: !secret esp-api_key # unfortunately you can't use substitutions inside secrets names
ota_pass: !secret esp-ota_pass # unfortunately you can't use substitutions inside secrets names
static_ip_address: !secret esp-loungesouthleftswitch_ip
#mqtt_local_command_main_topic: !secret mqtt_local_command_main_topic
#mqtt_local_status_main_topic: !secret mqtt_local_status_main_topic
mqtt_command_main_topic: !secret mqtt_command_main_topic
mqtt_status_main_topic: !secret mqtt_status_main_topic
# Device Settings
#relay_icon: "mdi:lightbulb-group"
log_level: "INFO" # Define logging level: NONE, ERROR, WARN, INFO, DEBUG (Default), VERBOSE, VERY_VERBOSE
update_interval: "60s" # update time for for general sensors etc
# MQTT LOCAL Controls
#mqtt_device_name: "bedroom2-lights"
#mqtt_local_command_topic: "${mqtt_local_command_main_topic}/${mqtt_device_name}" # Topic we will use to command this locally without HA
#mqtt_local_status_topic: "${mqtt_local_status_main_topic}/${mqtt_device_name}" # Topic we will use to view status locally without HA
# MQTT REMOTE Controls
mqtt_remote_device_name: "garage-corridor-lights"
mqtt_remote_command_topic: "${mqtt_command_main_topic}/${mqtt_remote_device_name}"
mqtt_remote_status_topic: "${mqtt_status_main_topic}/${mqtt_remote_device_name}"
mqtt_remote_device_command_ON: "ON"
mqtt_remote_device_command_OFF: "OFF"
# Switch Naming
switch_1_name: "Wall Washer Left"
@@ -98,10 +100,6 @@ esphome:
project:
name: "${project_name}"
version: "${project_version}"
#on_boot:
# priority: 200
# then:
# - switch.turn_on: Relay_2
#########################################################################################
# ESP Platform and Framework
@@ -122,6 +120,12 @@ logger:
#esp8266_store_log_strings_in_flash: false
#tx_buffer_size: 64
globals:
- id: relay2_change_origin_remote
type: bool
restore_value: no
initial_value: "false"
#########################################################################################
# STATUS LED
# https://esphome.io/components/status_led.html
@@ -154,15 +158,38 @@ binary_sensor:
on_press:
- switch.toggle: Relay_2
# KS-811-2 is a double only
# - platform: gpio
# pin:
# number: GPIO4
# mode: INPUT
# inverted: True
# name: "Button 3: ${switch_3_name}"
# on_press:
# - switch.toggle: Relay_3
text_sensor:
- platform: mqtt_subscribe
id: remote2_status
topic: "${mqtt_remote_status_topic}"
on_value:
then:
- if:
condition:
lambda: |-
return x == "${mqtt_remote_device_command_ON}";
then:
- if:
condition:
not:
switch.is_on: Relay_2
then:
- lambda: |-
id(relay2_change_origin_remote) = true;
- switch.turn_on: Relay_2
- if:
condition:
lambda: |-
return x == "${mqtt_remote_device_command_OFF}";
then:
- if:
condition:
switch.is_on: Relay_2
then:
- lambda: |-
id(relay2_change_origin_remote) = true;
- switch.turn_off: Relay_2
#########################################################################################
# SWITCH COMPONENT
@@ -178,11 +205,24 @@ switch:
name: "Relay 2: ${switch_2_name}"
pin: GPIO12
id: Relay_2
# KS-811-2 is a double only
# - platform: gpio
# name: "Relay 3: ${switch_3_name}"
# pin: GPIO14
# id: Relay_3
on_turn_on:
- if:
condition:
lambda: 'return !id(relay2_change_origin_remote);'
then:
- mqtt.publish:
topic: "${mqtt_remote_command_topic}"
payload: "${mqtt_remote_device_command_ON}"
- lambda: 'id(relay2_change_origin_remote) = false;'
on_turn_off:
- if:
condition:
lambda: 'return !id(relay2_change_origin_remote);'
then:
- mqtt.publish:
topic: "${mqtt_remote_command_topic}"
payload: "${mqtt_remote_device_command_OFF}"
- lambda: 'id(relay2_change_origin_remote) = false;'