multiple esphome device updates and new devices
This commit is contained in:
@@ -7,12 +7,15 @@
|
||||
# Controlled by a Sonoff Dual R1
|
||||
# A sonoff dual uses serial data to turn the relays on/off
|
||||
#
|
||||
# V2.4 - 2025-06-30 Tidied up MQTT direct relay control (esps can control each other via MQTT)
|
||||
# V2.3 - 2025-06-18 Added MQTT direct relay control
|
||||
#
|
||||
# NOTES:
|
||||
# Command the lights on with MQTT
|
||||
# ${mqtt_command_topic}/relay2/set ON or OFF
|
||||
# ${mqtt_command_topic}/relay2/set ON or OFF
|
||||
# ${mqtt_local_command_full_topic}/relay1/set ON or OFF
|
||||
# ${mqtt_local_command_full_topic}/relay2/set ON or OFF
|
||||
# ${mqtt_local_status_full_topic}/relay1/set ON or OFF
|
||||
# ${mqtt_local_status_full_topic}/relay2/set ON or OFF
|
||||
#
|
||||
##########################################################################################
|
||||
##########################################################################################
|
||||
@@ -32,10 +35,12 @@ substitutions:
|
||||
project_name: "Sonoff Technologies.Sonoff Dual R1" # Project Details
|
||||
project_version: "v2.3" # Project V denotes release of yaml file, allowing checking of deployed vs latest version
|
||||
|
||||
# Passwords
|
||||
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-officeduallights_ip
|
||||
# Passwords & Secrets
|
||||
api_key: !secret esp-api_key
|
||||
ota_pass: !secret esp-ota_pass
|
||||
static_ip_address: !secret esp-officeduallights_ip # unfortunately you can't use substitutions inside secrets names
|
||||
mqtt_local_command_main_topic: !secret mqtt_local_command_main_topic
|
||||
mqtt_local_status_main_topic: !secret mqtt_local_status_main_topic
|
||||
|
||||
# Device Settings
|
||||
relay_icon: "mdi:lightbulb-group"
|
||||
@@ -44,31 +49,38 @@ substitutions:
|
||||
|
||||
# MQTT Controls
|
||||
mqtt_device_name: "office-dual-lights"
|
||||
mqtt_main_command_topic: !secret mqtt_main_command_topic
|
||||
mqtt_topic: "${mqtt_main_command_topic}/${mqtt_device_name}" # Topic we will use to command stuff from external withougt HA
|
||||
#mqtt_status_topic: "${mqtt_main_status_topic}/esphome/${device_name}" # Topic we will use to read stuff from external withougt HA
|
||||
#mqtt_main_status_topic: !secret mqtt_main_status_topic
|
||||
#mqtt_remote_device1_command_topic: "${mqtt_main_command_topic}/masterbath-towelrail/operation"
|
||||
#mqtt_remote_device1_command1: "BOOST"
|
||||
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
|
||||
|
||||
# Switch Naming
|
||||
switch_1_name: "Dual L1 Relay"
|
||||
relay_1_icon: "mdi:lightbulb"
|
||||
light_1_name: "Light 1 (Right Hand Bunker Light)"
|
||||
switch_2_name: "Dual L2 Relay"
|
||||
relay_2_icon: "mdi:lightbulb"
|
||||
light_2_name: "Light 2 (Cool White Overhead Lights)"
|
||||
|
||||
##########################################################################################
|
||||
# PACKAGES: Included Common Packages
|
||||
# https://esphome.io/components/esphome.html
|
||||
# https://esphome.io/components/packages.html
|
||||
##########################################################################################
|
||||
packages:
|
||||
common_wifi: !include
|
||||
file: common/network_common.yaml
|
||||
vars:
|
||||
local_device_name: "${device_name}"
|
||||
local_static_ip_address: "${static_ip_address}"
|
||||
local_ota_pass: "${ota_pass}"
|
||||
common_api: !include
|
||||
file: common/api_common.yaml
|
||||
vars:
|
||||
local_api_key: "${api_key}"
|
||||
# common_webportal: !include
|
||||
# file: common/webportal_common.yaml
|
||||
#common_webportal: !include
|
||||
# file: common/webportal_common.yaml
|
||||
common_mqtt: !include
|
||||
file: common/mqtt_common.yaml
|
||||
vars:
|
||||
local_device_name: "${device_name}"
|
||||
common_sntp: !include
|
||||
file: common/sntp_common.yaml
|
||||
common_general_sensors: !include
|
||||
@@ -139,24 +151,24 @@ mqtt:
|
||||
# Direct MQTT control for relays via serial commands
|
||||
on_message:
|
||||
# Relay 1 control
|
||||
- topic: "${mqtt_topic}/relay1/set"
|
||||
- topic: "${mqtt_local_command_topic}/relay1/set"
|
||||
payload: "ON"
|
||||
then:
|
||||
- switch.turn_on: relay_1
|
||||
- light.turn_on: light_1
|
||||
- topic: "${mqtt_topic}/relay1/set"
|
||||
- topic: "${mqtt_local_command_topic}/relay1/set"
|
||||
payload: "OFF"
|
||||
then:
|
||||
- switch.turn_off: relay_1
|
||||
- light.turn_off: light_1
|
||||
|
||||
# Relay 2 control
|
||||
- topic: "${mqtt_topic}/relay2/set"
|
||||
- topic: "${mqtt_local_command_topic}/relay2/set"
|
||||
payload: "ON"
|
||||
then:
|
||||
- switch.turn_on: relay_2
|
||||
- light.turn_on: light_2
|
||||
- topic: "${mqtt_topic}/relay2/set"
|
||||
- topic: "${mqtt_local_command_topic}/relay2/set"
|
||||
payload: "OFF"
|
||||
then:
|
||||
- switch.turn_off: relay_2
|
||||
@@ -206,14 +218,14 @@ binary_sensor:
|
||||
#############################################
|
||||
switch:
|
||||
- platform: template
|
||||
name: "Dual L1 Relay"
|
||||
name: "${switch_1_name}"
|
||||
id: relay_1
|
||||
optimistic: true
|
||||
icon: "${relay_icon}"
|
||||
icon: "${relay_1_icon}"
|
||||
internal: true
|
||||
turn_on_action:
|
||||
- mqtt.publish:
|
||||
topic: "${mqtt_topic}/relay1/state"
|
||||
topic: "${mqtt_local_status_topic}/relay1/state"
|
||||
payload: "ON"
|
||||
- if:
|
||||
condition:
|
||||
@@ -224,7 +236,7 @@ switch:
|
||||
- uart.write: [0xA0, 0x04, 0x03, 0xA1]
|
||||
turn_off_action:
|
||||
- mqtt.publish:
|
||||
topic: "${mqtt_topic}/relay1/state"
|
||||
topic: "${mqtt_local_status_topic}/relay1/state"
|
||||
payload: "OFF"
|
||||
- if:
|
||||
condition:
|
||||
@@ -234,14 +246,14 @@ switch:
|
||||
else:
|
||||
- uart.write: [0xA0, 0x04, 0x02, 0xA1]
|
||||
- platform: template
|
||||
name: "Dual L2 Relay"
|
||||
name: "${switch_2_name}"
|
||||
id: relay_2
|
||||
optimistic: true
|
||||
icon: "${relay_icon}"
|
||||
icon: "${relay_2_icon}"
|
||||
internal: true
|
||||
turn_on_action:
|
||||
- mqtt.publish:
|
||||
topic: "${mqtt_topic}/relay2/state"
|
||||
topic: "${mqtt_local_status_topic}/relay2/state"
|
||||
payload: "ON"
|
||||
- if:
|
||||
condition:
|
||||
@@ -252,7 +264,7 @@ switch:
|
||||
- uart.write: [0xA0, 0x04, 0x03, 0xA1]
|
||||
turn_off_action:
|
||||
- mqtt.publish:
|
||||
topic: "${mqtt_topic}/relay2/state"
|
||||
topic: "${mqtt_local_status_topic}/relay2/state"
|
||||
payload: "OFF"
|
||||
- if:
|
||||
condition:
|
||||
@@ -288,7 +300,7 @@ output:
|
||||
##########################################################################################
|
||||
light:
|
||||
- platform: binary
|
||||
name: "Light 1 (Right Hand Bunker Light)"
|
||||
name: "${light_1_name}"
|
||||
id: light_1
|
||||
output: light_output_1
|
||||
|
||||
|
Reference in New Issue
Block a user