Code Example

Sample of Distance Sensor

esphome:

  name: distance-sensor-00

# Sensor for Car Garage Dad

esp8266:

  board: d1_mini


# Enable logging

logger:


# Enable Home Assistant API

api:

  encryption:

    key: "vnkwWMoJRT4hBNha7p3QXZ3Ra7Uy14dvlx9P22N6yEw="


ota:

  password: "3958bf59fc484561d179d63280b71df1"


wifi:

  ssid: !secret wifi_ssid

  password: !secret wifi_password


  # Enable fallback hotspot (captive portal) in case wifi connection fails

  ap:

    ssid: "Distance-Sensor-00"

    password: "HJnWtDlHK49X"


# Distance sensor

sensor:

  - platform: wifi_signal

    name: "WiFi Signal Sensor"

    update_interval: 60s          #to display WiFi signal strength

   

  - platform: ultrasonic

    trigger_pin: D1

    echo_pin: D2

    name: "Distance_car_dad"

    update_interval: 3s  


# End ------------------------------------------------------------