Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@maxfarrior
Created June 14, 2020 23:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save maxfarrior/ae4e98ceb8910b6ae98e1413a6441ba7 to your computer and use it in GitHub Desktop.
Save maxfarrior/ae4e98ceb8910b6ae98e1413a6441ba7 to your computer and use it in GitHub Desktop.
ESPHome Configuration for a NodeMCU Garage Door Opener
esphome:
name: nodemcu_garage_door_opener
platform: ESP8266
board: nodemcuv2
wifi:
ssid: 'ffff'
password: 'ffff!'
domain: '.ffff'
mqtt:
broker: 'ffff'
username: 'ffff'
password: 'ffff'
topic_prefix: 'nodemcu/garage_door'
logger:
level: INFO
ota:
password: 'ffff'
status_led:
pin:
number: D4
inverted: True
binary_sensor:
- platform: gpio
pin:
number: D5
mode: INPUT_PULLUP
inverted: False
name: "Garage Door Primary Sensor"
state_topic: "nodemcu/garage_door/primary_sensor"
device_class: garage_door
filters:
- delayed_on: 20ms
- platform: gpio
pin:
number: D6
mode: INPUT_PULLUP
inverted: False
name: "Garage Door Secondary Sensor"
state_topic: "nodemcu/garage_door/secondary_sensor"
device_class: garage_door
filters:
- delayed_on: 20ms
switch:
- platform: gpio
id: relay_primary
pin:
number: D1
inverted: true
restore_mode: ALWAYS_OFF
- platform: template
name: "Garage Door Primary Switch"
icon: "mdi:garage"
state_topic: "nodemcu/garage_door/primary_switch"
lambda: |-
if (id(relay_primary).state) {
return true;
} else {
return false;
}
turn_on_action:
- switch.turn_on: relay_primary
- delay: 1s
- switch.turn_off: relay_primary
- platform: gpio
id: relay_secondary
pin:
number: D2
inverted: true
restore_mode: ALWAYS_OFF
- platform: template
name: "Garage Door Secondary Switch"
icon: "mdi:garage"
state_topic: "nodemcu/garage_door/secondary_switch"
lambda: |-
if (id(relay_secondary).state) {
return true;
} else {
return false;
}
turn_on_action:
- switch.turn_on: relay_secondary
- delay: 1s
- switch.turn_off: relay_secondary
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment