in this topic i tried to use my sonoff T1 2ch as a garage door opener or blinders, with some modifications in order to not to have the two buttons activated simultaneously, i managed this in a yaml file flashed on the esp8266 of the sonoff by esphome (home assistant plugin).
and in a way to make sure that the door will not open if it is already opened, also when the door is fully opened the relay stops, even for opening when the door is fully open the sencond opening relay or switch stops; i made some automations combining between the sonoff T1 2ch and a xiaomi door/window sensor.
#garage.yaml
esphome:
name: garage___door
platform: ESP8266
board: esp01_1m
wifi:
ssid: "Home Assistant"
password: "no available keys"
manual_ip:
# Set this to the IP of the ESP
static_ip: 192.168.1.4
# Set this to the IP address of the router. Often ends with .1
gateway: 192.168.1.1
# The subnet of the network. 255.255.255.0 works for most home networks.
subnet: 255.255.255.0
# Enable logging
logger:
# Enable Home Assistant API
api:
ota:
switch:
- platform: gpio
pin: GPIO12
name: "Garage Door Open Switch"
icon: "mdi:garage"
id: open_switch
- platform: gpio
pin: GPIO5
name: "Garage Door Close Switch"
icon: "mdi:garage"
id: close_switch
binary_sensor:
- platform: gpio
pin:
number: GPIO0
mode: INPUT_PULLUP
inverted: True
name: "Garage Open Touchpad"
on_press:
- switch.toggle : open_switch
- switch.turn_off : close_switch
- platform: gpio
pin:
number: GPIO9
mode: INPUT_PULLUP
inverted: True
name: "Garage Close Touchpad"
on_press:
- switch.toggle: close_switch
- switch.turn_off: open_switch
output:
# Register the blue LED as a dimmable output ....
- platform: esp8266_pwm
id: blue_led
pin: GPIO13
inverted: True
light:
# ... and then make a light out of it.
- platform: monochromatic
name: "Garage Gang Blue LED"
output: blue_led
- platform: status
name: "Garage Gang Status"
web_server:
port: 80
# automations made:
- id: '1571078612877'
alias: door open
description: ''
trigger:
- entity_id: binary_sensor.door_window_sensor_158d00025822e0
from: 'off'
platform: state
to: 'on'
- entity_id: switch.garage_door_open_switch
from: 'off'
platform: state
to: 'on'
condition:
- condition: state
entity_id: binary_sensor.door_window_sensor_158d00025822e0
state: 'on'
action:
- device_id: e53f39d79d6849fca2aa86a83a5a803b
domain: switch
entity_id: switch.garage_door_open_switch
type: turn_off
- id: '1571078730573'
alias: door locked
description: ''
trigger:
- entity_id: binary_sensor.door_window_sensor_158d00025822e0
from: 'on'
platform: state
to: 'off'
- entity_id: switch.garage_door_close_switch
from: 'off'
platform: state
to: 'on'
condition:
- condition: state
entity_id: binary_sensor.door_window_sensor_158d00025822e0
state: 'off'
action:
- device_id: e53f39d79d6849fca2aa86a83a5a803b
domain: switch
entity_id: switch.garage_door_close_switch
type: turn_off
i hope this was clear and helpful, i appreciate the help given by members here so i do my best to share and help.