mirror of
https://github.com/brianhanifin/esphome-config.git
synced 2026-07-27 19:55:41 +00:00
tuya plug refactoring
simplifying them by removign all extra sensors. only the switch is left.
This commit is contained in:
+18
-39
@@ -1,4 +1,4 @@
|
||||
# ZooZee brand Tuya Plug
|
||||
# Luntak brand Tuya Plug
|
||||
#
|
||||
substitutions:
|
||||
devicename: plug01
|
||||
@@ -14,11 +14,7 @@ esphome:
|
||||
priority: -10
|
||||
then:
|
||||
- light.turn_on: blue_led_light
|
||||
- delay: 500ms
|
||||
- light.turn_on: red_led_light
|
||||
- delay: 500ms
|
||||
- light.turn_off: blue_led_light
|
||||
|
||||
|
||||
wifi:
|
||||
ssid: !secret wifi_ssid
|
||||
password: !secret wifi_pass
|
||||
@@ -31,11 +27,10 @@ ota:
|
||||
|
||||
logger:
|
||||
|
||||
|
||||
binary_sensor:
|
||||
- platform: status
|
||||
name: ${upper_devicename} Status
|
||||
id: ${devicename}_status
|
||||
# - platform: status
|
||||
# name: ${upper_devicename} Status
|
||||
# id: ${devicename}_status
|
||||
|
||||
- platform: gpio
|
||||
pin:
|
||||
@@ -44,6 +39,7 @@ binary_sensor:
|
||||
inverted: True
|
||||
name: ${upper_devicename} Button
|
||||
id: ${devicename}_button
|
||||
internal: true # hide from Home Assistant
|
||||
on_press:
|
||||
- switch.toggle: relay
|
||||
filters:
|
||||
@@ -57,34 +53,21 @@ light:
|
||||
output: blue_led
|
||||
internal: true # hide from Home Assistant
|
||||
|
||||
- platform: monochromatic
|
||||
name: ${upper_devicename} Red LED
|
||||
id: red_led_light
|
||||
output: red_led
|
||||
internal: true # hide from Home Assistant
|
||||
|
||||
output:
|
||||
# Register the LEDs as a dimmable output ....
|
||||
- platform: esp8266_pwm
|
||||
id: red_led
|
||||
max_power: 0.75
|
||||
pin:
|
||||
number: GPIO0
|
||||
inverted: True
|
||||
|
||||
- platform: esp8266_pwm
|
||||
id: blue_led
|
||||
pin:
|
||||
number: GPIO2
|
||||
inverted: True
|
||||
|
||||
sensor:
|
||||
- platform: wifi_signal
|
||||
name: ${devicename}_wifi_signal
|
||||
update_interval: 30s
|
||||
# sensor:
|
||||
# - platform: wifi_signal
|
||||
# name: ${devicename}_wifi_signal
|
||||
# update_interval: 30s
|
||||
|
||||
- platform: uptime
|
||||
name: ${devicename}_uptime
|
||||
# - platform: uptime
|
||||
# name: ${devicename}_uptime
|
||||
|
||||
switch:
|
||||
- platform: gpio
|
||||
@@ -92,7 +75,7 @@ switch:
|
||||
pin: GPIO15
|
||||
|
||||
- platform: template
|
||||
name: ${devicename}
|
||||
name: ${upper_devicename}
|
||||
optimistic: no
|
||||
lambda: |-
|
||||
if (id(relay).state) {
|
||||
@@ -102,15 +85,11 @@ switch:
|
||||
}
|
||||
turn_on_action:
|
||||
- switch.turn_on: relay
|
||||
- light.turn_on: blue_led_light
|
||||
- delay: 500ms
|
||||
- light.turn_off: red_led_light
|
||||
- light.turn_off: blue_led_light
|
||||
turn_off_action:
|
||||
- switch.turn_off: relay
|
||||
- light.turn_on: red_led_light
|
||||
- delay: 500ms
|
||||
- light.turn_off: blue_led_light
|
||||
- light.turn_on: blue_led_light
|
||||
|
||||
text_sensor:
|
||||
- platform: version
|
||||
name: ${devicename}_esphome_version
|
||||
# text_sensor:
|
||||
# - platform: version
|
||||
# name: ${devicename}_esphome_version
|
||||
+18
-41
@@ -1,4 +1,4 @@
|
||||
# ZooZee brand Tuya Plug
|
||||
# Luntak brand Tuya Plug
|
||||
#
|
||||
substitutions:
|
||||
devicename: plug02
|
||||
@@ -13,13 +13,8 @@ esphome:
|
||||
on_boot:
|
||||
priority: -10
|
||||
then:
|
||||
# - light.turn_on: blue_led_light
|
||||
# - delay: 500ms
|
||||
# - light.turn_on: red_led_light
|
||||
# - delay: 500ms
|
||||
- light.turn_off: blue_led_light
|
||||
- light.turn_off: red_led_light
|
||||
|
||||
- light.turn_on: blue_led_light
|
||||
|
||||
wifi:
|
||||
ssid: !secret wifi_ssid
|
||||
password: !secret wifi_pass
|
||||
@@ -32,11 +27,10 @@ ota:
|
||||
|
||||
logger:
|
||||
|
||||
|
||||
binary_sensor:
|
||||
- platform: status
|
||||
name: ${upper_devicename} Status
|
||||
id: ${devicename}_status
|
||||
# - platform: status
|
||||
# name: ${upper_devicename} Status
|
||||
# id: ${devicename}_status
|
||||
|
||||
- platform: gpio
|
||||
pin:
|
||||
@@ -59,34 +53,21 @@ light:
|
||||
output: blue_led
|
||||
internal: true # hide from Home Assistant
|
||||
|
||||
- platform: monochromatic
|
||||
name: ${upper_devicename} Red LED
|
||||
id: red_led_light
|
||||
output: red_led
|
||||
internal: true # hide from Home Assistant
|
||||
|
||||
output:
|
||||
# Register the LEDs as a dimmable output ....
|
||||
- platform: esp8266_pwm
|
||||
id: red_led
|
||||
max_power: 0.75
|
||||
pin:
|
||||
number: GPIO0
|
||||
inverted: True
|
||||
|
||||
- platform: esp8266_pwm
|
||||
id: blue_led
|
||||
pin:
|
||||
number: GPIO2
|
||||
inverted: True
|
||||
|
||||
sensor:
|
||||
- platform: wifi_signal
|
||||
name: ${devicename}_wifi_signal
|
||||
update_interval: 30s
|
||||
# sensor:
|
||||
# - platform: wifi_signal
|
||||
# name: ${devicename}_wifi_signal
|
||||
# update_interval: 30s
|
||||
|
||||
- platform: uptime
|
||||
name: ${devicename}_uptime
|
||||
# - platform: uptime
|
||||
# name: ${devicename}_uptime
|
||||
|
||||
switch:
|
||||
- platform: gpio
|
||||
@@ -94,7 +75,7 @@ switch:
|
||||
pin: GPIO15
|
||||
|
||||
- platform: template
|
||||
name: ${devicename}
|
||||
name: ${upper_devicename}
|
||||
optimistic: no
|
||||
lambda: |-
|
||||
if (id(relay).state) {
|
||||
@@ -104,15 +85,11 @@ switch:
|
||||
}
|
||||
turn_on_action:
|
||||
- switch.turn_on: relay
|
||||
# - light.turn_on: blue_led_light
|
||||
# - delay: 500ms
|
||||
# - light.turn_off: red_led_light
|
||||
- light.turn_off: blue_led_light
|
||||
turn_off_action:
|
||||
- switch.turn_off: relay
|
||||
# - light.turn_on: red_led_light
|
||||
# - delay: 500ms
|
||||
# - light.turn_off: blue_led_light
|
||||
- light.turn_on: blue_led_light
|
||||
|
||||
text_sensor:
|
||||
- platform: version
|
||||
name: ${devicename}_esphome_version
|
||||
# text_sensor:
|
||||
# - platform: version
|
||||
# name: ${devicename}_esphome_version
|
||||
+18
-39
@@ -1,4 +1,4 @@
|
||||
# ZooZee brand Tuya Plug
|
||||
# Luntak brand Tuya Plug
|
||||
#
|
||||
substitutions:
|
||||
devicename: plug03
|
||||
@@ -14,11 +14,7 @@ esphome:
|
||||
priority: -10
|
||||
then:
|
||||
- light.turn_on: blue_led_light
|
||||
- delay: 500ms
|
||||
- light.turn_on: red_led_light
|
||||
- delay: 500ms
|
||||
- light.turn_off: blue_led_light
|
||||
|
||||
|
||||
wifi:
|
||||
ssid: !secret wifi_ssid
|
||||
password: !secret wifi_pass
|
||||
@@ -31,11 +27,10 @@ ota:
|
||||
|
||||
logger:
|
||||
|
||||
|
||||
binary_sensor:
|
||||
- platform: status
|
||||
name: ${upper_devicename} Status
|
||||
id: ${devicename}_status
|
||||
# - platform: status
|
||||
# name: ${upper_devicename} Status
|
||||
# id: ${devicename}_status
|
||||
|
||||
- platform: gpio
|
||||
pin:
|
||||
@@ -44,6 +39,7 @@ binary_sensor:
|
||||
inverted: True
|
||||
name: ${upper_devicename} Button
|
||||
id: ${devicename}_button
|
||||
internal: true # hide from Home Assistant
|
||||
on_press:
|
||||
- switch.toggle: relay
|
||||
filters:
|
||||
@@ -57,34 +53,21 @@ light:
|
||||
output: blue_led
|
||||
internal: true # hide from Home Assistant
|
||||
|
||||
- platform: monochromatic
|
||||
name: ${upper_devicename} Red LED
|
||||
id: red_led_light
|
||||
output: red_led
|
||||
internal: true # hide from Home Assistant
|
||||
|
||||
output:
|
||||
# Register the LEDs as a dimmable output ....
|
||||
- platform: esp8266_pwm
|
||||
id: red_led
|
||||
max_power: 0.75
|
||||
pin:
|
||||
number: GPIO0
|
||||
inverted: True
|
||||
|
||||
- platform: esp8266_pwm
|
||||
id: blue_led
|
||||
pin:
|
||||
number: GPIO2
|
||||
inverted: True
|
||||
|
||||
sensor:
|
||||
- platform: wifi_signal
|
||||
name: ${devicename}__wifi_signal
|
||||
update_interval: 30s
|
||||
# sensor:
|
||||
# - platform: wifi_signal
|
||||
# name: ${devicename}_wifi_signal
|
||||
# update_interval: 30s
|
||||
|
||||
- platform: uptime
|
||||
name: ${devicename}_uptime
|
||||
# - platform: uptime
|
||||
# name: ${devicename}_uptime
|
||||
|
||||
switch:
|
||||
- platform: gpio
|
||||
@@ -92,7 +75,7 @@ switch:
|
||||
pin: GPIO15
|
||||
|
||||
- platform: template
|
||||
name: ${devicename}
|
||||
name: ${upper_devicename}
|
||||
optimistic: no
|
||||
lambda: |-
|
||||
if (id(relay).state) {
|
||||
@@ -102,15 +85,11 @@ switch:
|
||||
}
|
||||
turn_on_action:
|
||||
- switch.turn_on: relay
|
||||
- light.turn_on: blue_led_light
|
||||
- delay: 500ms
|
||||
- light.turn_off: red_led_light
|
||||
- light.turn_off: blue_led_light
|
||||
turn_off_action:
|
||||
- switch.turn_off: relay
|
||||
- light.turn_on: red_led_light
|
||||
- delay: 500ms
|
||||
- light.turn_off: blue_led_light
|
||||
- light.turn_on: blue_led_light
|
||||
|
||||
text_sensor:
|
||||
- platform: version
|
||||
name: ${devicename}_esphome_version
|
||||
# text_sensor:
|
||||
# - platform: version
|
||||
# name: ${devicename}_esphome_version
|
||||
+15
-14
@@ -8,7 +8,7 @@ esphome:
|
||||
name: ${devicename}
|
||||
platform: ESP8266
|
||||
board: esp01_1m
|
||||
|
||||
|
||||
# Turn on the LED on boot
|
||||
on_boot:
|
||||
priority: -10
|
||||
@@ -28,10 +28,10 @@ ota:
|
||||
logger:
|
||||
|
||||
binary_sensor:
|
||||
- platform: status
|
||||
name: ${upper_devicename} Status
|
||||
id: ${devicename}_status
|
||||
|
||||
# - platform: status
|
||||
# name: ${upper_devicename} Status
|
||||
# id: ${devicename}_status
|
||||
|
||||
- platform: gpio
|
||||
pin:
|
||||
number: GPIO13
|
||||
@@ -39,6 +39,7 @@ binary_sensor:
|
||||
inverted: True
|
||||
name: ${upper_devicename} Button
|
||||
id: ${devicename}_button
|
||||
internal: true # hide from Home Assistant
|
||||
on_press:
|
||||
- switch.toggle: relay
|
||||
filters:
|
||||
@@ -61,18 +62,18 @@ output:
|
||||
inverted: True
|
||||
|
||||
sensor:
|
||||
- platform: wifi_signal
|
||||
name: ${devicename}__wifi_signal
|
||||
update_interval: 30s
|
||||
# - platform: wifi_signal
|
||||
# name: ${devicename}__wifi_signal
|
||||
# update_interval: 30s
|
||||
|
||||
- platform: uptime
|
||||
name: ${devicename}_uptime
|
||||
# - platform: uptime
|
||||
# name: ${devicename}_uptime
|
||||
|
||||
switch:
|
||||
- platform: gpio
|
||||
id: relay
|
||||
pin: GPIO15
|
||||
|
||||
|
||||
- platform: template
|
||||
name: ${upper_devicename}
|
||||
optimistic: no
|
||||
@@ -93,6 +94,6 @@ switch:
|
||||
- switch.turn_off: relay
|
||||
- light.turn_on: blue_led_light
|
||||
|
||||
text_sensor:
|
||||
- platform: version
|
||||
name: ${devicename}_esphome_version
|
||||
# text_sensor:
|
||||
# - platform: version
|
||||
# name: ${devicename}_esphome_version
|
||||
|
||||
+13
-12
@@ -28,9 +28,9 @@ ota:
|
||||
logger:
|
||||
|
||||
binary_sensor:
|
||||
- platform: status
|
||||
name: ${upper_devicename} Status
|
||||
id: ${devicename}_status
|
||||
# - platform: status
|
||||
# name: ${upper_devicename} Status
|
||||
# id: ${devicename}_status
|
||||
|
||||
- platform: gpio
|
||||
pin:
|
||||
@@ -39,6 +39,7 @@ binary_sensor:
|
||||
inverted: True
|
||||
name: ${upper_devicename} Button
|
||||
id: ${devicename}_button
|
||||
internal: true # hide from Home Assistant
|
||||
on_press:
|
||||
- switch.toggle: relay
|
||||
filters:
|
||||
@@ -60,13 +61,13 @@ output:
|
||||
number: GPIO2
|
||||
inverted: True
|
||||
|
||||
sensor:
|
||||
- platform: wifi_signal
|
||||
name: ${devicename}_wifi_signal
|
||||
update_interval: 30s
|
||||
# sensor:
|
||||
# - platform: wifi_signal
|
||||
# name: ${devicename}_wifi_signal
|
||||
# update_interval: 30s
|
||||
|
||||
- platform: uptime
|
||||
name: ${devicename}_uptime
|
||||
# - platform: uptime
|
||||
# name: ${devicename}_uptime
|
||||
|
||||
switch:
|
||||
- platform: gpio
|
||||
@@ -89,6 +90,6 @@ switch:
|
||||
- switch.turn_off: relay
|
||||
- light.turn_on: blue_led_light
|
||||
|
||||
text_sensor:
|
||||
- platform: version
|
||||
name: ${devicename}_esphome_version
|
||||
# text_sensor:
|
||||
# - platform: version
|
||||
# name: ${devicename}_esphome_version
|
||||
+13
-12
@@ -28,9 +28,9 @@ ota:
|
||||
logger:
|
||||
|
||||
binary_sensor:
|
||||
- platform: status
|
||||
name: ${upper_devicename} Status
|
||||
id: ${devicename}_status
|
||||
# - platform: status
|
||||
# name: ${upper_devicename} Status
|
||||
# id: ${devicename}_status
|
||||
|
||||
- platform: gpio
|
||||
pin:
|
||||
@@ -39,6 +39,7 @@ binary_sensor:
|
||||
inverted: True
|
||||
name: ${upper_devicename} Button
|
||||
id: ${devicename}_button
|
||||
internal: true # hide from Home Assistant
|
||||
on_press:
|
||||
- switch.toggle: relay
|
||||
filters:
|
||||
@@ -60,13 +61,13 @@ output:
|
||||
number: GPIO2
|
||||
inverted: True
|
||||
|
||||
sensor:
|
||||
- platform: wifi_signal
|
||||
name: ${devicename}_wifi_signal
|
||||
update_interval: 30s
|
||||
# sensor:
|
||||
# - platform: wifi_signal
|
||||
# name: ${devicename}_wifi_signal
|
||||
# update_interval: 30s
|
||||
|
||||
- platform: uptime
|
||||
name: ${devicename}_uptime
|
||||
# - platform: uptime
|
||||
# name: ${devicename}_uptime
|
||||
|
||||
switch:
|
||||
- platform: gpio
|
||||
@@ -89,6 +90,6 @@ switch:
|
||||
- switch.turn_off: relay
|
||||
- light.turn_on: blue_led_light
|
||||
|
||||
text_sensor:
|
||||
- platform: version
|
||||
name: ${devicename}_esphome_version
|
||||
# text_sensor:
|
||||
# - platform: version
|
||||
# name: ${devicename}_esphome_version
|
||||
+13
-12
@@ -28,9 +28,9 @@ ota:
|
||||
logger:
|
||||
|
||||
binary_sensor:
|
||||
- platform: status
|
||||
name: ${upper_devicename} Status
|
||||
id: ${devicename}_status
|
||||
# - platform: status
|
||||
# name: ${upper_devicename} Status
|
||||
# id: ${devicename}_status
|
||||
|
||||
- platform: gpio
|
||||
pin:
|
||||
@@ -39,6 +39,7 @@ binary_sensor:
|
||||
inverted: True
|
||||
name: ${upper_devicename} Button
|
||||
id: ${devicename}_button
|
||||
internal: true # hide from Home Assistant
|
||||
on_press:
|
||||
- switch.toggle: relay
|
||||
filters:
|
||||
@@ -60,13 +61,13 @@ output:
|
||||
number: GPIO2
|
||||
inverted: True
|
||||
|
||||
sensor:
|
||||
- platform: wifi_signal
|
||||
name: ${devicename}_wifi_signal
|
||||
update_interval: 30s
|
||||
# sensor:
|
||||
# - platform: wifi_signal
|
||||
# name: ${devicename}_wifi_signal
|
||||
# update_interval: 30s
|
||||
|
||||
- platform: uptime
|
||||
name: ${devicename}_uptime
|
||||
# - platform: uptime
|
||||
# name: ${devicename}_uptime
|
||||
|
||||
switch:
|
||||
- platform: gpio
|
||||
@@ -89,6 +90,6 @@ switch:
|
||||
- switch.turn_off: relay
|
||||
- light.turn_on: blue_led_light
|
||||
|
||||
text_sensor:
|
||||
- platform: version
|
||||
name: ${devicename}_esphome_version
|
||||
# text_sensor:
|
||||
# - platform: version
|
||||
# name: ${devicename}_esphome_version
|
||||
Reference in New Issue
Block a user