Im Home Assistant wird es als 2 Relais mit Symbolen und 2 binären Sensoren (einschließlich Leistung, Strom und Sensoren) angezeigt. Wenn die „max_power
“ auf einem Kanal überschritten wird, wird dieser Kanal ausgeschaltet und eine dauerhafte Benachrichtigung wird im HA erstellt. Wenn die „max_temp
“ überschritten wird, werden die 2 Kanäle abgeschaltet und eine dauerhafte Benachrichtigung wird im HA erstellt.
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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
substitutions:
devicename: shelly_25
channel_1: Light 1
channel_2: Light 2
max_power: "2000.0"
max_temp: "70.0"
esphome:
name: ${devicename}
platform: ESP8266
board: esp01_1m
wifi:
ssid: "WIFI SSID"
password: "PW"
power_save_mode: none
output_power: 20dB
fast_connect: on
manual_ip:
static_ip: 192.168.178.77
gateway: 192.168.178.1
subnet: 255.255.255.0
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "NAME"
password: "PW"
captive_portal:
# Enable logging
logger:
level: DEBUG
# Enable Home Assistant API
api:
ota:
web_server:
port: 80
time:
- platform: sntp
id: my_time
i2c:
sda: GPIO12
scl: GPIO14
sensor:
- platform: ade7953
irq_pin: GPIO16 # Prevent overheating by setting this
voltage:
name: ${devicename} voltage
# On the Shelly 2.5 channels are mixed ch1=B ch2=A
current_a:
name: ${channel_2} current
internal: true
current_b:
name: ${channel_1} current
internal: true
active_power_a:
name: ${channel_2} power
id: power_channel_2
# active_power_a is normal, so don't multiply by -1
on_value_range:
- above: ${max_power}
then:
- light.turn_off: lightid2
- homeassistant.service:
service: persistent_notification.create
data:
title: Message from ${devicename}
data_template:
message: Switch turned off because power exceeded ${max_power}W
active_power_b:
name: ${channel_1} power
id: power_channel_1
# active_power_b is inverted, so multiply by -1
filters:
- multiply: -1
on_value_range:
- above: ${max_power}
then:
- light.turn_off: lightid1
- homeassistant.service:
service: persistent_notification.create
data:
title: Message from ${devicename}
data_template:
message: Switch turned off because power exceeded ${max_power}W
update_interval: 30s
- platform: total_daily_energy
name: ${channel_1} energy
power_id: power_channel_1
filters:
# Multiplication factor from W to kWh is 0.001
- multiply: 0.001
unit_of_measurement: kWh
- platform: total_daily_energy
name: ${channel_2} energy
power_id: power_channel_2
filters:
# Multiplication factor from W to kWh is 0.001
- multiply: 0.001
unit_of_measurement: kWh
# NTC Temperature
- platform: ntc
sensor: temp_resistance_reading
name: ${devicename} temperature
unit_of_measurement: "°C"
accuracy_decimals: 1
icon: "mdi:thermometer"
calibration:
b_constant: 3350
reference_resistance: 10kOhm
reference_temperature: 298.15K
on_value_range:
- above: ${max_temp}
then:
- light.turn_off: lightid1
- light.turn_off: lightid2
- homeassistant.service:
service: persistent_notification.create
data:
title: Message from ${devicename}
data_template:
message: Switch turned off because temperature exceeded ${max_temp}°C
- platform: resistance
id: temp_resistance_reading
sensor: temp_analog_reading
configuration: DOWNSTREAM
resistor: 32kOhm
- platform: adc
id: temp_analog_reading
pin: A0
status_led:
pin:
number: GPIO0
inverted: yes
output:
- platform: gpio
pin: GPIO4
id: shelly_25_relay_1
- platform: gpio
pin: GPIO15
id: shelly_25_relay_2
light:
- platform: binary
name: "${channel_1}"
output: shelly_25_relay_1
id: lightid1
- platform: binary
name: "${channel_2}"
output: shelly_25_relay_2
id: lightid2
binary_sensor:
- platform: gpio
pin:
number: GPIO13
name: "${channel_1} input"
on_state:
then:
- light.toggle: lightid1
- platform: gpio
pin:
number: GPIO5
name: "${channel_2} input"
on_state:
then:
- light.toggle: lightid2