Mit HomeAssistant ESPHome Dashboard neues binary erstellen
> esphome:
> name: garage-deckenleuchte
>
> esp8266:
> board: esp01_1m
>
> # Enable logging
> logger:
>
> # Enable Home Assistant API
> api:
>
> ota:
> password: !secret ota_password
>
> wifi:
> ssid: !secret wifi_ssid
> password: !secret wifi_password
>
> # Enable fallback hotspot (captive portal) in case wifi connection fails
> ap:
> ssid: "Garage-Deckenleuchte"
> password: !secret ap_password
>
> captive_portal:
>
> # Text sensors with general information.
> text_sensor:
> - platform: wifi_info
> ip_address:
> name: garage-deckenleuchte IP
>
> # Sensors with general information.
> sensor:
> # Uptime sensor.
> - platform: uptime
> name: garage-deckenleuchte Uptime
>
> # WiFi Signal sensor.
> - platform: wifi_signal
> name: garage-deckenleuchte WiFi Signal
> update_interval: 60s
>
> # Shelly 1 detached switch config with fallback in case of wifi or api fail
>
> switch:
> - platform: gpio
> name: garage-deckenleuchte
> pin: GPIO4
> id: shelly_relay
> # after reboot, keep the relay off. this prevents light turning on after a power outage
> restore_mode: ALWAYS_OFF
>
> binary_sensor:
> - platform: gpio
> name: garage-deckenleuchte Input
> pin:
> number: GPIO5
> # small delay to prevent debouncing
> filters:
> - delayed_on_off: 50ms
> # config for state change of input button
> on_state:
> then:
> - if:
> condition:
> and:
> - wifi.connected:
> - api.connected:
> - switch.is_on: shelly_relay
> # toggle smart light if wifi and api are connected and relay is on
> then:
> - homeassistant.service:
> service: light.toggle
> data:
> entity_id: light.garage-deckenleuchte
> # else, toggle relay
> else:
> - switch.toggle: shelly_relay
> id: button