Hier einmal ein ESPHome Code-Beispiel für einen Shelly 1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
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