Hier einmal ein ESPHome Code-Beispiel für einen Shelly 1
configuration.yaml
1substitutions:
2 device_name: "NAME"
3
4esphome:
5 name: shelly1
6 platform: ESP8266
7 board: esp01_1m
8
9wifi:
10 networks:
11 - ssid: "SSID"
12 password: "PW"
13 power_save_mode: none
14 output_power: 20dB
15 manual_ip:
16 static_ip: 192.168.178.XXX
17 gateway: 192.168.178.1
18 subnet: 255.255.255.0
19
20 # Enable fallback hotspot (captive portal) in case wifi connection fails
21 ap:
22 ssid: "AP Kennung"
23 password: "PW"
24
25captive_portal:
26
27# Enable logging
28logger:
29
30# Enable Home Assistant API
31api:
32
33# Enable OTA updates
34ota:
35
36
37# Text sensors with general information.
38text_sensor:
39 - platform: wifi_info
40 ip_address:
41 name: ${device_name} IP
42
43# Sensors with general information.
44sensor:
45 # Uptime sensor.
46 - platform: uptime
47 name: ${device_name} Uptime
48
49 # WiFi Signal sensor.
50 - platform: wifi_signal
51 name: ${device_name} WiFi Signal
52 update_interval: 60s
53
54# Shelly 1 detached switch config with fallback in case of wifi or api fail
55
56# Device Specific Config
57output:
58 - platform: gpio
59 pin: GPIO4
60 id: shelly_1_relay
61
62light:
63 - platform: binary
64 name: ${device_name}
65 output: shelly_1_relay
66 id: ${device_name}
67
68binary_sensor:
69 - platform: gpio
70 pin:
71 number: GPIO5
72 #mode: INPUT_PULLUP
73 #inverted: True
74 name: ${device_name}
75 on_state:
76 then:
77 - light.toggle: ${device_name}
78 internal: true
79 id: switchid
