Skip to content

Instantly share code, notes, and snippets.

@jsnfwlr
Forked from Snipercaine/garage_v3.yaml
Created April 4, 2022 21:01
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 jsnfwlr/1993494d60c09cad994b8683cdaee2c3 to your computer and use it in GitHub Desktop.
Save jsnfwlr/1993494d60c09cad994b8683cdaee2c3 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