I have been trying to use some of the posts on the forums to get this working for a while now and I can’t seem to get the YAML right. I corrected some alignment issues but to be honest I am at a bit of a loss right now. ESPHome has a issue with line 56, but I don’t see the problem based on the other examples in the forum.
esphome:
name: esp55
esp32:
board: esp32dev
framework:
type: arduino
# Enable logging
logger:
# Enable Home Assistant API
api:
encryption:
key: "##########"
ota:
password: "##############"
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
# Optional manual IP
manual_ip:
static_ip: 172.16.7.11
gateway: 172.16.7.1
subnet: 255.255.255.0
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "Fallback Hotspot"
password: "XXXX"
captive_portal:
output:
- platform: gpio
id: red_led_van_sensor
pin: GPIO18
name: "Red LED"
- platform: gpio
pin: GPIO19
id: yellow_led_van_sensor
name: "Yellow LED"
sensor:
- platform: ultrasonic
name: parking_sensor
trigger_pin: GPIO27
echo_pin: GPIO26
accuracy_decimals: 3
update_interval: 1ms
timeout: 4.0m
pulse_time: 10us
on_value:
then:
- if:
# Turn On Yellow from 3m away until 0.10m away
condition:
sensor.in_range:
id: parking_sensor
above: 0.10
below: 3
then:
output.turn_on:
id: yellow_led_van_sensor
- if:
# Turn On Red for anything beleow 0.10m
condition:
sensor.in_range:
id: parking_sensor
below: 0.10
then:
output.turn_on:
id: red_led_van_sensor
# Turn off LEDs when outside range
- if:
# Turn Off Red if more than 0.1m
condition:
sensor.in_range:
id: parking_sensor
above: 0.1
then:
output.turn_off:
id: red_led_van_sensor
- if:
#Turn off Yellow if less than 1.1m
condition:
sensor.in_range:
id: parking_sensor
below: 1.1
then:
output.turn_off:
id: yellow_led_van_sensor
# Turn off LEDs when car leaves
- if:
#Turn off Yellow if more than 3m
condition:
sensor.in_range:
id: parking_sensor
above: 3
then:
output.turn_off:
id: yellow_led_van_sensor
- if:
#Turn off Red if more than 0.1m
condition:
sensor.in_range:
id: parking_sensor
above: 0.1
then:
output.turn_off:
id: red_led_van_sensor