Shelly 1 mit ESPHome verwenden

Hier einmal ein ESPHome Code-Beispiel für einen Shelly 1

substitutions:
  device_name: "NAME"

esphome:
  name: shelly1
  platform: ESP8266
  board: esp01_1m

wifi:
  networks:
    - ssid: "SSID"
      password: "PW"
  power_save_mode: none
  output_power: 20dB
  manual_ip:
   static_ip: 192.168.178.XXX
   gateway: 192.168.178.1
   subnet: 255.255.255.0

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "AP Kennung"
    password: "PW"

captive_portal:

# Enable logging
logger:

# Enable Home Assistant API
api:

# Enable OTA updates
ota:


# Text sensors with general information.
text_sensor:
  - platform: wifi_info
    ip_address:
      name: ${device_name} IP

# Sensors with general information.
sensor:
  # Uptime sensor.
  - platform: uptime
    name: ${device_name} Uptime

  # WiFi Signal sensor.
  - platform: wifi_signal
    name: ${device_name} WiFi Signal
    update_interval: 60s

# Shelly 1 detached switch config with fallback in case of wifi or api fail

# Device Specific Config
output:
  - platform: gpio
    pin: GPIO4
    id: shelly_1_relay

light:
  - platform: binary
    name: ${device_name}
    output: shelly_1_relay
    id: ${device_name}

binary_sensor:
  - platform: gpio
    pin:
      number: GPIO5
      #mode: INPUT_PULLUP
      #inverted: True
    name: ${device_name}
    on_state:
      then:
        - light.toggle: ${device_name}
    internal: true
    id: switchid