birknard

Home Assistant Garage Door

Aug 14th, 2024
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
YAML 5.74 KB | Source Code | 0 0
  1.  
  2. timer:
  3.   garage_open:
  4.     name: Garage is open
  5.     duration: "00:06:00"
  6.     restore: true
  7.     icon: mdi:timer-outline
  8.  
  9. automation:
  10.   - alias: "Garage: Door open notification"
  11.     id: garage_601
  12.     description: "Notify when the garage door is open"
  13.     mode: single
  14.     trigger:
  15.       - platform: state
  16.         id: garage_open
  17.         entity_id: cover.garage_door
  18.         to: "open"
  19.     action:
  20.       - service: timer.start
  21.         target:
  22.           entity_id: timer.garage_open
  23.       - variables:
  24.           msg: "The garage door is open"
  25.       - service: notify.family_devices
  26.         data:
  27.           message: "{{ msg }}"
  28.           data:
  29.             tag: "garage-door-open-notification"
  30.             priority: high
  31.             ttl: 0
  32.             persistent: true
  33.             sticky: true
  34.             notification_icon: "mdi:garage-alert"
  35.             color: "#C0392B" #red-ish
  36.             car_ui: true
  37.             actions:
  38.               - action: action_garage_close
  39.                 title: Close
  40.               - action: action_garage_leave
  41.                 title: Leave
  42.  
  43.   - alias: "Garage: Door closed confirmation"
  44.     id: garage_604
  45.     description: "Confirmation notification when garage door is closed"
  46.     mode: single
  47.     trigger:
  48.       - platform: state
  49.         entity_id: cover.garage_door
  50.         from: "open"
  51.         to: "closed"
  52.     action:
  53.       - service: timer.cancel
  54.         target:
  55.           entity_id: timer.garage_open
  56.       - service: notify.family_devices
  57.         data:
  58.           message: "clear_notification"
  59.           data:
  60.             tag: "garage-door-open-notification"
  61.             priority: high
  62.             ttl: 0
  63.       - service: notify.family_devices
  64.         data:
  65.           message: The garage door is now closed
  66.           data:
  67.             sticky: true
  68.             timeout: 30
  69.             notification_icon: "mdi:garage"
  70.             color: "#229954" #green-ish
  71.             tag: "garage-door-closed-notification"
  72.             priority: high
  73.             ttl: 0
  74.  
  75.   - alias: "Garage: Door action handler for Close"
  76.     id: garage_606
  77.     description: "Close garage action"
  78.     mode: single
  79.     trigger:
  80.       - platform: event
  81.         event_type: mobile_app_notification_action
  82.         event_data:
  83.           action: action_garage_close
  84.     condition:
  85.       - condition: state
  86.         entity_id: cover.garage_door
  87.         state: "open"
  88.     action:
  89.       - service: timer.cancel
  90.         target:
  91.           entity_id: timer.garage_open
  92.       - service: notify.family_devices
  93.         data:
  94.           message: "clear_notification"
  95.           data:
  96.             tag: "garage-door-open-notification"
  97.             priority: high
  98.             ttl: 0
  99.       - service: cover.close_cover
  100.         target:
  101.           entity_id: cover.garage_door
  102.       - wait_template: "{{ is_state('cover.garage_door', 'closed') }}"
  103.         timeout: 60
  104.       - if:
  105.           - condition: template
  106.             value_template: "{{ not is_state('cover.garage_door', 'closed') }}"
  107.         then:
  108.           - service: notify.family_devices
  109.             data:
  110.               message: The garage door is still open or in an unknown state ({{ states('cover.garage_door')}})
  111.               data:
  112.                 sticky: true
  113.                 timeout: 60
  114.                 notification_icon: "mdi:garage"
  115.                 color: "#C0392B" #red-ish
  116.                 car_ui: true
  117.  
  118.   - alias: "Garage: Door open timeout handler"
  119.     id: garage_607
  120.     description: "Close garage after timeout"
  121.     mode: single
  122.     trigger:
  123.       - platform: event
  124.         event_type: timer.finished
  125.         event_data:
  126.           entity_id: timer.garage_open
  127.     condition:
  128.       - condition: state
  129.         entity_id: cover.garage_door
  130.         state: "open"
  131.     action:
  132.       - service: notify.family_devices
  133.         data:
  134.           message: "clear_notification"
  135.           data:
  136.             tag: "garage-door-open-notification"
  137.             priority: high
  138.             ttl: 0
  139.       - service: cover.close_cover
  140.         enabled: true
  141.         target:
  142.           entity_id: cover.garage_door
  143.       - service: notify.family_devices
  144.         data:
  145.           message: The garage door is closing
  146.           data:
  147.             tag: "garage-door-closing-notification"
  148.             priority: high
  149.             ttl: 0
  150.             sticky: true
  151.             timeout: 60
  152.             notification_icon: "mdi:garage"
  153.             color: "#F39C12" #orange-ish
  154.             car_ui: true
  155.       - wait_template: "{{ is_state('cover.garage_door', 'closed') }}"
  156.         timeout: 60
  157.       - service: notify.family_devices
  158.         data:
  159.           message: "clear_notification"
  160.           data:
  161.             tag: "garage-door-closing-notification"
  162.             priority: high
  163.             ttl: 0
  164.  
  165.   - alias: "Garage: Door action handler for Leave"
  166.     id: garage_608
  167.     description: "Leave garage in it's current state"
  168.     mode: single
  169.     trigger:
  170.       - platform: event
  171.         event_type: mobile_app_notification_action
  172.         event_data:
  173.           action: action_garage_leave
  174.     condition:
  175.       - condition: state
  176.         entity_id: cover.garage_door
  177.         state: "open"
  178.     action:
  179.       - service: timer.cancel
  180.         target:
  181.           entity_id: timer.garage_open
  182.       - service: notify.family_devices
  183.         data:
  184.           message: "clear_notification"
  185.           data:
  186.             tag: "garage-door-closing-notification"
  187.             priority: high
  188.             ttl: 0
  189.       - service: notify.family_devices
  190.         data:
  191.           message: Leaving garage as is ({{ states('cover.garage_door')}})
  192.           data:
  193.             timeout: 60
  194.             notification_icon: "mdi:garage-open"
  195.             color: "#F39C12" #orange-ish
  196.             car_ui: true
Advertisement
Add Comment
Please, Sign In to add comment