Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- esphome:
- name: diningroomlamp
- platform: ESP8266
- board: esp01_1m
- wifi:
- ssid: ""
- password: ""
- # Enable Home Assistant API
- api:
- # Enable logging
- logger:
- baud_rate: 0
- ota:
- uart:
- tx_pin: GPIO01
- rx_pin: GPIO03
- baud_rate: 19200
- binary_sensor:
- - platform: gpio
- pin:
- number: GPIO10
- mode: INPUT_PULLUP
- inverted: True
- name: "Sonoff Basic Button"
- on_press:
- - switch.toggle: relay1
- switch:
- - platform: uart
- id: relay_12_off
- data: [0xA0, 0x04, 0x00, 0xA1]
- - platform: uart
- id: relay_1_on
- data: [0xA0, 0x04, 0x01, 0xA1]
- - platform: uart
- id: relay_2_on
- data: [0xA0, 0x04, 0x02, 0xA1]
- - platform: uart
- id: relay_12_on
- data: [0xA0, 0x04, 0x03, 0xA1]
- - platform: template
- id: relay1
- name: "dining_room_lamp_relay1"
- turn_on_action:
- if:
- condition:
- switch.is_off: relay2
- then:
- - switch.turn_on: relay_1_on
- else:
- - switch.turn_on: relay_12_on
- turn_off_action:
- if:
- condition:
- switch.is_off: relay2
- then:
- - switch.turn_on: relay_12_off
- else:
- - switch.turn_on: relay_2_on
- optimistic: true
- - platform: template
- id: relay2
- name: "dining_room_lamp_relay2"
- turn_on_action:
- if:
- condition:
- switch.is_off: relay1
- then:
- - switch.turn_on: relay_2_on
- else:
- - switch.turn_on: relay_12_on
- turn_off_action:
- if:
- condition:
- switch.is_off: relay1
- then:
- - switch.turn_on: relay_12_off
- else:
- - switch.turn_on: relay_1_on
- optimistic: true
Advertisement
Add Comment
Please, Sign In to add comment