@@ -188,4 +188,44 @@ binary_sensor: // [!code ++] // [!code focus]
188
188
# Use the previously defined new event type here // [!code ++] // [!code focus]
189
189
event_type: apartment_special // [!code ++] // [!code focus]
190
190
` ` `
191
+ :: :
192
+
193
+ :: : details Turn on the light when someone rings at the entrance doorbell
194
+ You can turn on the light when someone ringts the entrance doorbell.
195
+ ` ` ` yaml
196
+ <!--@include: minimal.example.yaml-->
197
+
198
+ binary_sensor: // [!code ++] // [!code focus]
199
+ - id: !extend entrance_doorbell // [!code ++] // [!code focus]
200
+ on_press: // [!code ++] // [!code focus]
201
+ - tcs_intercom.send: // [!code ++] // [!code focus]
202
+ command: !lambda "return id(turn_on_light_command);" // [!code ++] // [!code focus]
203
+ ` ` `
204
+
205
+ If you would like to take care about the sun elevation you can adjust it.
206
+ ` ` ` yaml
207
+ <!--@include: minimal.example.yaml-->
208
+
209
+ # Import the Home Assistant sun elevation sensor // [!code ++] // [!code focus]
210
+ sensor: // [!code ++] // [!code focus]
211
+ - platform: homeassistant // [!code ++] // [!code focus]
212
+ id: sun_elevation // [!code ++] // [!code focus]
213
+ entity_id: sun.sun // [!code ++] // [!code focus]
214
+ attribute: elevation // [!code ++] // [!code focus]
215
+
216
+ # Extend the entrance doorbell sensor // [!code ++] // [!code focus]
217
+ binary_sensor: // [!code ++] // [!code focus]
218
+ - id: !extend entrance_doorbell // [!code ++] // [!code focus]
219
+ on_press: // [!code ++] // [!code focus]
220
+ # Sun elevation is <= 0 (dark) // [!code ++] // [!code focus]
221
+ - if: // [!code ++] // [!code focus]
222
+ condition: // [!code ++] // [!code focus]
223
+ sensor.in_range: // [!code ++] // [!code focus]
224
+ id: sun_elevation // [!code ++] // [!code focus]
225
+ below: 1 // [!code ++] // [!code focus]
226
+ then: // [!code ++] // [!code focus]
227
+ # Turn on the light // [!code ++] // [!code focus]
228
+ - tcs_intercom.send: // [!code ++] // [!code focus]
229
+ command: !lambda "return id(turn_on_light_command);" // [!code ++] // [!code focus]
230
+ ` ` `
191
231
:::
0 commit comments