Skip to content

Commit f509fc1

Browse files
committed
Add state trigger for garage doors and enhance notification message formatting
Implemented a new state trigger for the garage doors to notify when they are opened. Improved the notification message to dynamically reflect the status of both garage doors, providing clearer information on their state. This enhances user awareness and control over garage access.
1 parent 8bd32d8 commit f509fc1

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

config/packages/garadget.yaml

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -330,6 +330,11 @@ automation:
330330
trigger:
331331
- platform: time_pattern
332332
minutes: '/45'
333+
- platform: state
334+
entity_id:
335+
- cover.large_garage_door
336+
- cover.small_garage_door
337+
to: 'open'
333338
- platform: state
334339
entity_id: group.family
335340
to: not_home
@@ -370,8 +375,17 @@ automation:
370375
- service: script.notify_engine
371376
data:
372377
title: 'Check Garage Doors:'
373-
value1: "Small: {{ states('cover.small_garage_door')}}"
374-
value2: "Large: {{ states('cover.large_garage_door')}}"
378+
value1: >
379+
{% set open = [] %}
380+
{% if is_state('cover.small_garage_door','open') %}{% set _ = open.append('Small garage door') %}{% endif %}
381+
{% if is_state('cover.large_garage_door','open') %}{% set _ = open.append('Large garage door') %}{% endif %}
382+
{% if open|length == 0 %}
383+
All garage doors are closed.
384+
{% elif open|length == 1 %}
385+
{{ open[0] }} is open.
386+
{% else %}
387+
{{ open|join(' and ') }} are open.
388+
{% endif %}
375389
who: "family"
376390
camera_entity: "camera.garagecam"
377391
group: 'information'

0 commit comments

Comments
 (0)