Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat: Add restart notifier blueprint #37

Merged
merged 1 commit into from
Nov 11, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
68 changes: 68 additions & 0 deletions restart-notifier.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
---
# SPDX-License-Identifier: MIT
blueprint:
name: Restart Notifier (v0.1)

description: |
Sends a notification when Home Assistant restarts

domain: automation

input:
notify_service:
name: Zulip Notify
description: |
Notify service name to send to. Should be a Zulip (or compatible)
notify service
default: "zulip"
notify_topic:
name: Notification topic
description: |
The topic that will be used in the Zulip stream
default: "{{ state_attr('zone.home', 'friendly_name') }} restart"
notify_message_prelude:
name: Notification message prelude
description: |
The flavor text to prelude schedules with
default: "{{ state_attr('zone.home', 'friendly_name') }} "

mode: single

triggers:
- event: shutdown
id: shutdown
trigger: homeassistant
- event: start
id: startup
trigger: homeassistant

variables:
# inputs
input_notify_service: !input notify_service
input_notify_topic: !input notify_topic
input_notify_message_prelude: !input notify_message_prelude

# yamllint disable-line rule:line-length
notify_target: "{{ input_notify_service | lower | replace('notify.', '') | replace(' ', '_') }}"

condition: []

actions:
- choose:
- conditions:
- condition: trigger
id: shutdown
sequence:
- data:
message: "{{ input_notify_message_prelude }} shutting down"
title: "{{ input_notify_topic }}"
action: notify.{{ notify_target }}
- conditions:
- condition: trigger
id: startup
sequence:
- data:
message: "{{ input_notify_message_prelude }} has started"
title: "{{ input_notify_topic }}"
action: notify.{{ notify_target }}
default: []
Loading