You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
96 lines
2.1 KiB
96 lines
2.1 KiB
4 months ago
|
substitutions:
|
||
|
touchpad1_action: sonoff_t3_toggle_relay_1
|
||
|
touchpad2_action: sonoff_t3_toggle_relay_2
|
||
|
touchpad3_action: sonoff_t3_toggle_relay_3
|
||
|
|
||
|
esphome:
|
||
|
board: esp01_1m
|
||
|
platform: ESP8266
|
||
|
name: ${hostname}
|
||
|
build_path: ./build/${hostname}
|
||
|
|
||
|
packages:
|
||
|
base: !include ../common/base.yaml
|
||
|
basicSensors: !include ../common/basicSensors.yaml
|
||
|
|
||
|
output:
|
||
|
- platform: esp8266_pwm
|
||
|
id: blue_led
|
||
|
pin: GPIO13
|
||
|
inverted: True
|
||
|
|
||
|
switch:
|
||
|
- platform: gpio
|
||
|
name: "${friendly_name} Relay 1"
|
||
|
id: relay_1
|
||
|
pin: GPIO12
|
||
|
restore_mode: RESTORE_DEFAULT_OFF
|
||
|
- platform: gpio
|
||
|
name: "${friendly_name} Relay 2"
|
||
|
id: relay_2
|
||
|
pin: GPIO5
|
||
|
restore_mode: RESTORE_DEFAULT_OFF
|
||
|
- platform: gpio
|
||
|
name: "${friendly_name} Relay 3"
|
||
|
id: relay_3
|
||
|
pin: GPIO4
|
||
|
restore_mode: RESTORE_DEFAULT_OFF
|
||
|
|
||
|
binary_sensor:
|
||
|
- platform: gpio
|
||
|
pin:
|
||
|
number: GPIO0
|
||
|
mode: INPUT_PULLUP
|
||
|
inverted: True
|
||
|
name: "${friendly_name} Touchpad 1"
|
||
|
on_press:
|
||
|
then:
|
||
|
- output.turn_on: blue_led
|
||
|
- script.execute: "${touchpad1_action}"
|
||
|
on_release:
|
||
|
then:
|
||
|
- output.turn_off: blue_led
|
||
|
|
||
|
- platform: gpio
|
||
|
pin:
|
||
|
number: GPIO9
|
||
|
mode: INPUT_PULLUP
|
||
|
inverted: True
|
||
|
name: "${friendly_name} Touchpad 2"
|
||
|
on_press:
|
||
|
then:
|
||
|
- output.turn_on: blue_led
|
||
|
- script.execute: "${touchpad2_action}"
|
||
|
on_release:
|
||
|
then:
|
||
|
- output.turn_off: blue_led
|
||
|
|
||
|
- platform: gpio
|
||
|
pin:
|
||
|
number: GPIO10
|
||
|
mode: INPUT_PULLUP
|
||
|
inverted: True
|
||
|
name: "${friendly_name} Touchpad 3"
|
||
|
on_press:
|
||
|
then:
|
||
|
- output.turn_on: blue_led
|
||
|
- script.execute: "${touchpad3_action}"
|
||
|
on_release:
|
||
|
then:
|
||
|
- output.turn_off: blue_led
|
||
|
|
||
|
script:
|
||
|
- id: sonoff_t3_toggle_relay_1
|
||
|
then:
|
||
|
- switch.toggle: relay_1
|
||
|
- id: sonoff_t3_toggle_relay_2
|
||
|
then:
|
||
|
- switch.toggle: relay_2
|
||
|
- id: sonoff_t3_toggle_relay_3
|
||
|
then:
|
||
|
- switch.toggle: relay_3
|
||
|
- id: sonoff_t3_toggle_relay_1_and_3
|
||
|
then:
|
||
|
- switch.toggle: relay_1
|
||
|
- switch.toggle: relay_3
|