Skip to content

Instantly share code, notes, and snippets.

@Snipercaine
Created May 20, 2019 01:01
Show Gist options
  • Star 20 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save Snipercaine/f3908a051fd79e6d7d7b765152666c2a to your computer and use it in GitHub Desktop.
Save Snipercaine/f3908a051fd79e6d7d7b765152666c2a to your computer and use it in GitHub Desktop.
esphome:
name: garage
platform: ESP8266
board: esp01_1m
wifi:
ssid: !secret wifi
password: !secret wifi_pw
# Enable logging
logger:
# Enable Home Assistant API
api:
ota:
binary_sensor:
- platform: gpio
pin:
number: GPIO14
mode: INPUT_PULLUP
inverted: True
name: "Janis Garage Door"
device_class: garage_door
- platform: template
name: "Janis Car"
device_class: presence
lambda: |-
if (id(ultrasonic_sensor1).state < 1.5) {
// car is in the garage
return true;
} else {
// no car
return false;
}
switch:
- platform: gpio
pin: GPIO12
id: relay
- platform: template
icon: "mdi:arrow-up-down-bold-outline"
name: "Janis Garage Control"
turn_on_action:
- switch.turn_on: relay
- delay: 500ms
- switch.turn_off: relay
sensor:
- platform: ultrasonic
id: ultrasonic_sensor1
trigger_pin: GPIO05
echo_pin: GPIO04
name: "Janis US Car"
update_interval: 60s
filters:
filter_out: nan
timeout: 9m
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment