Hi
I think basically, I just want to display the state of a pin on an esp32.
the esp32 opens and closes the gate in my driveway. as these gate motors simply open when closed and close when open, i have added a momentary switch as a sort of limit switch, so i can see if the gate is shut.
i have some code that opens and closes the gate:
substitutions:
name: esphome-web-475594
friendly_name: driveway gate
esphome:
name: ${name}
friendly_name: ${friendly_name}
min_version: 2024.6.0
name_add_mac_suffix: false
project:
name: esphome.web
version: dev
esp32:
board: esp32dev
framework:
type: arduino
# Enable logging
logger:
# Enable Home Assistant API
api:
# Allow Over-The-Air updates
ota:
- platform: esphome
# Allow provisioning Wi-Fi via serial
improv_serial:
wifi:
ssid: iot
password: sh6d0wh6t
ap: {}
# In combination with the `ap` this allows the user
# to provision wifi credentials to the device via WiFi AP.
captive_portal:
dashboard_import:
package_import_url: github://esphome/example-configs/esphome-web/esp32.yaml@main
import_full_config: true
# Sets up Bluetooth LE (Only on ESP32) to allow the user
# to provision wifi credentials to the device.
esp32_improv:
authorizer: none
# To have a "next url" for improv serial
web_server:
switch:
- platform: gpio
pin: 5
name: "Garage Door Button"
id: garage_door_button
# if you DON'T have a door sensor, use the below code
cover:
- platform: template
name: "Garage Door"
device_class: garage
open_action:
- switch.turn_off: garage_door_button
- switch.turn_on: garage_door_button
- delay: 0.1s
- switch.turn_off: garage_door_button
close_action:
- switch.turn_off: garage_door_button
- switch.turn_on: garage_door_button
- delay: 0.1s
- switch.turn_off: garage_door_button
optimistic: true
this code somehow changes the colour of the switch in an attempt to show you if the door is open or closed, however as we still use remotes in the cars this state doesnt change when using them and makes this useless.
do i add the changes i need to this code, or do i make another thing to do this?
apologies if this has been covered. i did spend quite some time looking for a previous post covering this, but either i couldnt find it or did and i didnt understand enough to know i was looking at the solution.
thank you