Initial commit
This commit is contained in:
commit
7703f5532a
10 files changed
+889
No files matched your search
+28
@@ -0,0 +1,28 @@
|
|||||||
|
### macOS template
|
||||||
|
# General
|
||||||
|
.DS_Store
|
||||||
|
.AppleDouble
|
||||||
|
.LSOverride
|
||||||
|
|
||||||
|
# Icon must end with two \r
|
||||||
|
Icon
|
||||||
|
|
||||||
|
# Thumbnails
|
||||||
|
._*
|
||||||
|
|
||||||
|
# Files that might appear in the root of a volume
|
||||||
|
.DocumentRevisions-V100
|
||||||
|
.fseventsd
|
||||||
|
.Spotlight-V100
|
||||||
|
.TemporaryItems
|
||||||
|
.Trashes
|
||||||
|
.VolumeIcon.icns
|
||||||
|
.com.apple.timemachine.donotpresent
|
||||||
|
|
||||||
|
# Directories potentially created on remote AFP share
|
||||||
|
.AppleDB
|
||||||
|
.AppleDesktop
|
||||||
|
Network Trash Folder
|
||||||
|
Temporary Items
|
||||||
|
.apdisk
|
||||||
|
|
||||||
@@ -0,0 +1,39 @@
|
|||||||
|
# Blueprints for Home-Assistant
|
||||||
|
|
||||||
|
This is our blueprint collection from our private Home Assistant instance that developed over time and have proven to be
|
||||||
|
useful.
|
||||||
|
Use at your own risk.
|
||||||
|
|
||||||
|
## Contents
|
||||||
|
|
||||||
|
<!-- TOC -->
|
||||||
|
* [Blueprints for Home-Assistant](#blueprints-for-home-assistant)
|
||||||
|
* [Contents](#contents)
|
||||||
|
* [Blueprints](#blueprints)
|
||||||
|
* [Script: Notify People](#script--notify-people)
|
||||||
|
* [Script: Notify Person](#script--notify-person)
|
||||||
|
* [Script: Smart Close Cover](#script--smart-close-cover)
|
||||||
|
* [Automation: Open Cover with Window](#automation--open-cover-with-window)
|
||||||
|
<!-- TOC -->
|
||||||
|
|
||||||
|
## Blueprints
|
||||||
|
|
||||||
|
### [Script: Notify People](./scripts/notify_people/README.md)
|
||||||
|
|
||||||
|
Helper script meant as central place for sending notifications in Home Assistant. Multiple parameters available
|
||||||
|
including selecting notified people, only notifying people at home and a way to dismiss notification.
|
||||||
|
|
||||||
|
### [Script: Notify Person](./scripts/notify_person/README.md)
|
||||||
|
|
||||||
|
Helper script to notify a single person. Used to prevent the need of changing every occurrence of a notification entity
|
||||||
|
by instead only updating this script in case of a device change. Provides convenience to dismiss messages.
|
||||||
|
|
||||||
|
### [Script: Smart Close Cover](./scripts/smart_close_cover/README.md)
|
||||||
|
|
||||||
|
Helper script to intelligently close a cover entity when the sun is below the horizon after waiting for its window to be
|
||||||
|
closed. Useful in time-based cover automations.
|
||||||
|
|
||||||
|
### [Automation: Open Cover with Window](./automations/open_cover_with_window/README.md)
|
||||||
|
|
||||||
|
This is a convenience automation that connects a `window` device with a `cover` device. If the window will be opened, it
|
||||||
|
triggers the opening of the cover and returns it to the previous state when the window is closed again.
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
# Open Cover with Window
|
||||||
|
|
||||||
|
... and resets it to its previous state when the window is closed again. This Accepts also a door instead of a window.
|
||||||
|
|
||||||
|
[](https://my.home-assistant.io/redirect/blueprint_import/?blueprint_url=https%3A%2F%2Fgitea.marquis.site%2FHomeAssistant%2Fblueprints%2Fautomations%2Fopen_cover_with_window%2Fopen_cover_with_window.yaml)
|
||||||
|
|
||||||
|
## General
|
||||||
|
|
||||||
|
This Automation uses the `cover.open_cover` to immediately open the cover when the window or door opens.
|
||||||
|
Before touching the cover state, it is preserved in a temporary scene, which is applied and removed to restore the
|
||||||
|
cover's state.
|
||||||
|
|
||||||
|
If the automation is canceled due to home assistant stopping, it will be picked up again after boot. There is a
|
||||||
|
configurable delay to ensure all integrations and devices have initialized again.
|
||||||
|
|
||||||
|
## Inputs
|
||||||
|
|
||||||
|
| Name | Description | Default |
|
||||||
|
|-------------------------|-----------------------------------------------------------------------------------------------------|-------------------------------------------------------------|
|
||||||
|
| Cover | **Required.** The cover to control | |
|
||||||
|
| Window/Door | **Required.** The window (or door) that controls the cover | |
|
||||||
|
| Close Duration (s) | The duration in seconds that the window needs to be closed before the cover is reset | `4` |
|
||||||
|
| Boot Timeout (s) | The duration in seconds how long to wait after home assistant boots to continue with the automation | `30` |
|
||||||
|
| Scene id value template | The template used for creating the scene_id used for saving and restoring the cover position | `tmp_{{ cover \| regex_replace(find='\\.', replace='_') }}` |
|
||||||
@@ -0,0 +1,149 @@
|
|||||||
|
blueprint:
|
||||||
|
name: Open cover with window
|
||||||
|
domain: automation
|
||||||
|
description: >
|
||||||
|
Link an entity of the 'cover' domain to a binary sensor representing a window or door to automatically open the
|
||||||
|
cover while the window is opened.
|
||||||
|
input:
|
||||||
|
|
||||||
|
cover:
|
||||||
|
name: Cover
|
||||||
|
description: The cover entity that should be automated
|
||||||
|
selector:
|
||||||
|
entity:
|
||||||
|
filter:
|
||||||
|
domain: cover
|
||||||
|
|
||||||
|
window:
|
||||||
|
name: Window/Door
|
||||||
|
description: The window or door state that should control the cover
|
||||||
|
selector:
|
||||||
|
entity:
|
||||||
|
filter:
|
||||||
|
domain: binary_sensor
|
||||||
|
device_class:
|
||||||
|
- window
|
||||||
|
- door
|
||||||
|
|
||||||
|
window_close_duration:
|
||||||
|
name: Close Duration (s)
|
||||||
|
description: >
|
||||||
|
The duration in seconds the window needs to be closed before the cover will be reset to its previous state
|
||||||
|
default: 4
|
||||||
|
selector:
|
||||||
|
number:
|
||||||
|
min: 0
|
||||||
|
step: 1
|
||||||
|
unit_of_measurement: s
|
||||||
|
|
||||||
|
boot_timeout:
|
||||||
|
name: Boot Timeout (s)
|
||||||
|
description: >
|
||||||
|
The duration in seconds how long to wait after home assistant boots to continue with the automation
|
||||||
|
default: 30
|
||||||
|
selector:
|
||||||
|
number:
|
||||||
|
min: 0
|
||||||
|
step: 1
|
||||||
|
unit_of_measurement: s
|
||||||
|
|
||||||
|
scene_id_template:
|
||||||
|
name: Scene id value template
|
||||||
|
description: >
|
||||||
|
The template used for creating the scene_id used for saving and restoring the cover position
|
||||||
|
default: "tmp_{{ cover | regex_replace(find='\\.', replace='_') }}"
|
||||||
|
selector:
|
||||||
|
template: {}
|
||||||
|
|
||||||
|
|
||||||
|
mode: single
|
||||||
|
|
||||||
|
|
||||||
|
trigger:
|
||||||
|
- id: window
|
||||||
|
trigger: state
|
||||||
|
entity_id: !input window
|
||||||
|
from:
|
||||||
|
- "off"
|
||||||
|
to:
|
||||||
|
- "on"
|
||||||
|
- id: boot
|
||||||
|
trigger: homeassistant
|
||||||
|
event: start
|
||||||
|
|
||||||
|
|
||||||
|
actions:
|
||||||
|
# Precheck
|
||||||
|
- alias: Do noting if triggered by window and shutter is fully open
|
||||||
|
condition: or
|
||||||
|
conditions:
|
||||||
|
- condition: numeric_state
|
||||||
|
entity_id: !input cover
|
||||||
|
attribute: current_position
|
||||||
|
below: 100
|
||||||
|
- condition: not
|
||||||
|
conditions:
|
||||||
|
- condition: trigger
|
||||||
|
id:
|
||||||
|
- window
|
||||||
|
|
||||||
|
# Initialize variables
|
||||||
|
- variables:
|
||||||
|
cover: !input cover
|
||||||
|
window: !input window
|
||||||
|
boot_timeout: !input boot_timeout
|
||||||
|
- variables:
|
||||||
|
scene_id: !nput scene_id_template
|
||||||
|
- variables:
|
||||||
|
scene_entity_id: "scene.{{ scene_id }}"
|
||||||
|
|
||||||
|
# Startup Phase
|
||||||
|
- alias: Test if we're on a normal run or resuming after boot
|
||||||
|
if:
|
||||||
|
- condition: trigger
|
||||||
|
id:
|
||||||
|
- window
|
||||||
|
then:
|
||||||
|
- wait_template: "{{ not(is_state(window, 'closing') or is_state(window, 'opening')) }}"
|
||||||
|
- condition: not
|
||||||
|
conditions:
|
||||||
|
- condition: state
|
||||||
|
entity_id: !input cover
|
||||||
|
attribute: current_position
|
||||||
|
state: 100
|
||||||
|
- alias: Create scene
|
||||||
|
action: scene.create
|
||||||
|
data:
|
||||||
|
scene_id: "{{ scene_id }}"
|
||||||
|
snapshot_entities:
|
||||||
|
- !input cover
|
||||||
|
- action: cover.open_cover
|
||||||
|
target:
|
||||||
|
entity_id: !input cover
|
||||||
|
else:
|
||||||
|
- condition: template
|
||||||
|
value_template: "{{ states(scene_entity_id) != 'undefined' }}"
|
||||||
|
- alias: Wait for all devices to come back online
|
||||||
|
delay:
|
||||||
|
seconds: >-
|
||||||
|
{{ iif(states("sensor.uptime") != "undefined",
|
||||||
|
max((states("sensor.uptime") | as_datetime + timedelta(seconds=boot_timeout) - now()).total_seconds(), 0),
|
||||||
|
boot_timeout }}
|
||||||
|
|
||||||
|
# waiting for the window to close again
|
||||||
|
- wait_for_trigger:
|
||||||
|
- trigger: state
|
||||||
|
entity_id:
|
||||||
|
- !input window
|
||||||
|
to:
|
||||||
|
- "off"
|
||||||
|
for:
|
||||||
|
seconds: !input window_close_duration
|
||||||
|
|
||||||
|
# Restore & Cleanup
|
||||||
|
- action: scene.turn_on
|
||||||
|
target:
|
||||||
|
entity_id: "{{ scene_entity_id }}"
|
||||||
|
- action: scene.delete
|
||||||
|
target:
|
||||||
|
entity_id: "{{ scene_entity_id }}"
|
||||||
@@ -0,0 +1,32 @@
|
|||||||
|
# Notify People
|
||||||
|
|
||||||
|
Helper script meant as central place for sending notifications in Home Assistant. Multiple parameters are available
|
||||||
|
including selecting notified people, only notifying people at home and a way to dismiss notification. Has options for
|
||||||
|
handling HA persistent notifications with the same message.
|
||||||
|
|
||||||
|
[](https://my.home-assistant.io/redirect/blueprint_import/?blueprint_url=https%3A%2F%2Fgitea.marquis.site%2FHomeAssistant%2Fblueprints%2Fscripts%2Fnotify_people%2Fnotify_people.yaml)
|
||||||
|
|
||||||
|
## General
|
||||||
|
|
||||||
|
Loops over the provided `people` items and calls their [notification script](../notify_person/README.md).
|
||||||
|
If `home` is true, script calls for people not at home will be skipped.
|
||||||
|
Persistent notification management can be enabled by setting `create_persistent_notification` to true. An additional
|
||||||
|
condition template can be supplied to dynamically control creation of persistent notifications with
|
||||||
|
`persistent_notification_condition`.
|
||||||
|
|
||||||
|
## Inputs
|
||||||
|
|
||||||
|
| Name | Description | Default |
|
||||||
|
|------------------------------------------|--------------------------------------------------------------------------------------------------------------|--------------|
|
||||||
|
| Title | The title of the notification | |
|
||||||
|
| Message | The message of the notification | |
|
||||||
|
| URL | Url for click action target | |
|
||||||
|
| Tag | Tag for replacing / clearing later on | |
|
||||||
|
| Group | Group name for notification grouping | |
|
||||||
|
| Clear | Removes notifications with given tag | `false` |
|
||||||
|
| Channel | Android notification Channel | |
|
||||||
|
| Actions | Actions to add to mobile app notifications | |
|
||||||
|
| People | People to notify. Defaults to everyone. | <everyone> |
|
||||||
|
| Only Home | If true, only sends notifications to people who are at home | `false` |
|
||||||
|
| Create persistent Notification | If true, creates a persistent notification in Home Assistant additionally | `false` |
|
||||||
|
| Create persistent Notification Condition | Creates a persistent notification in Home Assistant only of the given condition matches. Ignored if omitted. | `{{ true }}` |
|
||||||
@@ -0,0 +1,259 @@
|
|||||||
|
blueprint:
|
||||||
|
name: Notify People
|
||||||
|
domain: script
|
||||||
|
description: >
|
||||||
|
Helper script meant as central place for sending notifications in Home Assistant. Multiple parameters available
|
||||||
|
including selecting notified people, only notifying people at home and a way to dismiss notification.
|
||||||
|
input:
|
||||||
|
|
||||||
|
people:
|
||||||
|
name: People
|
||||||
|
description: >
|
||||||
|
List of People that can be notified. Everyone on this list will be notified per default by this script.
|
||||||
|
selector:
|
||||||
|
entity:
|
||||||
|
multiple: true
|
||||||
|
filter:
|
||||||
|
domain: person
|
||||||
|
|
||||||
|
home:
|
||||||
|
name: Home Zone
|
||||||
|
description: >
|
||||||
|
Home zone for this Home Assistant Instance.
|
||||||
|
default: zone.home
|
||||||
|
selector:
|
||||||
|
entity:
|
||||||
|
filter:
|
||||||
|
domain: zone
|
||||||
|
|
||||||
|
|
||||||
|
### --- Script Fields --- ###
|
||||||
|
fields:
|
||||||
|
|
||||||
|
title:
|
||||||
|
name: Title
|
||||||
|
description: The title of the notification
|
||||||
|
required: false
|
||||||
|
example: Notification Title
|
||||||
|
selector:
|
||||||
|
text:
|
||||||
|
multiline: false
|
||||||
|
multiple: false
|
||||||
|
|
||||||
|
message:
|
||||||
|
name: Message
|
||||||
|
description: The message of the notification
|
||||||
|
required: false
|
||||||
|
example: My notification message.
|
||||||
|
selector:
|
||||||
|
text:
|
||||||
|
multiline: true
|
||||||
|
multiple: false
|
||||||
|
|
||||||
|
url:
|
||||||
|
name: URL
|
||||||
|
description: Url for click action target
|
||||||
|
required: false
|
||||||
|
example: /lovelace-light/lighting
|
||||||
|
selector:
|
||||||
|
text:
|
||||||
|
type: url
|
||||||
|
|
||||||
|
tag:
|
||||||
|
name: Tag
|
||||||
|
description: Tag for replacing / clearing later on
|
||||||
|
required: false
|
||||||
|
example: my_notification
|
||||||
|
selector:
|
||||||
|
text:
|
||||||
|
multiple: false
|
||||||
|
multiline: false
|
||||||
|
|
||||||
|
group:
|
||||||
|
name: Group
|
||||||
|
description: Group name for notification grouping
|
||||||
|
required: false
|
||||||
|
example: climate_notification
|
||||||
|
selector:
|
||||||
|
text:
|
||||||
|
multiple: false
|
||||||
|
multiline: false
|
||||||
|
|
||||||
|
clear:
|
||||||
|
name: Clear
|
||||||
|
description: Removes notifications with given tag
|
||||||
|
required: false
|
||||||
|
example: true
|
||||||
|
selector:
|
||||||
|
boolean:
|
||||||
|
|
||||||
|
channel:
|
||||||
|
name: Channel
|
||||||
|
description: Android notification Channel
|
||||||
|
required: false
|
||||||
|
example: Important Alert
|
||||||
|
selector:
|
||||||
|
text:
|
||||||
|
multiline: false
|
||||||
|
multiple: false
|
||||||
|
|
||||||
|
actions:
|
||||||
|
name: Notification actions
|
||||||
|
description: Actions to add to mobile app notifications
|
||||||
|
required: false
|
||||||
|
example: >
|
||||||
|
[{"action": "URI", "title": "Open Url", "uri": "https://home-assistant.io"}]
|
||||||
|
selector:
|
||||||
|
object:
|
||||||
|
multiple: true
|
||||||
|
fields:
|
||||||
|
action:
|
||||||
|
label: Action
|
||||||
|
required: true
|
||||||
|
selector:
|
||||||
|
text:
|
||||||
|
title:
|
||||||
|
label: Title
|
||||||
|
required: true
|
||||||
|
selector:
|
||||||
|
text:
|
||||||
|
uri:
|
||||||
|
label: URL
|
||||||
|
selector:
|
||||||
|
text:
|
||||||
|
behavior:
|
||||||
|
label: Behavior
|
||||||
|
selector:
|
||||||
|
text:
|
||||||
|
authenticationRequired:
|
||||||
|
label: Authentication Required
|
||||||
|
selector:
|
||||||
|
boolean:
|
||||||
|
|
||||||
|
people:
|
||||||
|
name: People
|
||||||
|
description: People to notify. Defaults to everyone.
|
||||||
|
required: false
|
||||||
|
default: !input people
|
||||||
|
selector:
|
||||||
|
entity:
|
||||||
|
multiple: true
|
||||||
|
include_entities: !input people
|
||||||
|
filter:
|
||||||
|
domain: person
|
||||||
|
|
||||||
|
only_home:
|
||||||
|
name: Only Home
|
||||||
|
description: If true, only sends notifications to people who are at home
|
||||||
|
required: false
|
||||||
|
default: false
|
||||||
|
example: true
|
||||||
|
selector:
|
||||||
|
boolean:
|
||||||
|
|
||||||
|
create_persistent_notification:
|
||||||
|
name: Create persistent Notification
|
||||||
|
description: If true, creates a persistent notification in Home Assistant additionally
|
||||||
|
required: false
|
||||||
|
default: false
|
||||||
|
example: true
|
||||||
|
selector:
|
||||||
|
boolean:
|
||||||
|
|
||||||
|
persistent_notification_condition:
|
||||||
|
name: Create persistent Notification Condition
|
||||||
|
description: >
|
||||||
|
Creates a persistent notification in Home Assistant only of the given condition matches. Ignored if omitted.
|
||||||
|
required: false
|
||||||
|
selector:
|
||||||
|
template:
|
||||||
|
|
||||||
|
|
||||||
|
### --- Script Settings --- ###
|
||||||
|
mode: queued
|
||||||
|
max: 10
|
||||||
|
description: >-
|
||||||
|
Helper script for customizable notifications. Notification targets can be
|
||||||
|
chosen, defaults to notifying everyone. Option for excluding people not at
|
||||||
|
home.
|
||||||
|
|
||||||
|
|
||||||
|
### --- Global Script Variables --- ###
|
||||||
|
variables:
|
||||||
|
all_people: !input people
|
||||||
|
home_zone: !input home
|
||||||
|
# clear=(clear | default(false))
|
||||||
|
message_data: >-
|
||||||
|
{%- set message_data = [ '"clear": '~clear | default(false) | to_json ] %}
|
||||||
|
{%- if title is defined %}
|
||||||
|
{%- set message_data = message_data + [ '"title": "'~title~'"' ] %}
|
||||||
|
{%- endif %}
|
||||||
|
{%- if message is defined %}
|
||||||
|
{%- set message_data = message_data + [ '"message": "'~message~'"' ] %}
|
||||||
|
{%- endif %}
|
||||||
|
{%- if tag is defined %}
|
||||||
|
{%- set message_data = message_data + [ '"tag": "'~tag~'"' ] %}
|
||||||
|
{%- endif %}
|
||||||
|
{%- if url is defined %}
|
||||||
|
{%- set message_data = message_data + [ '"url": "'~url~'"' ] %}
|
||||||
|
{%- endif %}
|
||||||
|
{%- if group is defined %}
|
||||||
|
{%- set message_data = message_data + [ '"group": "'~group~'"' ] %}
|
||||||
|
{%- endif %}
|
||||||
|
{%- if channel is defined %}
|
||||||
|
{%- set message_data = message_data + [ '"channel": "'~channel~'"' ] %}
|
||||||
|
{%- endif %}
|
||||||
|
{{ ('{'~message_data | join(',')~'}') | from_json }}
|
||||||
|
clear: "{{ clear | default(false) }}"
|
||||||
|
home: "{{ only_home | default(false) }}"
|
||||||
|
create_persistent_notification: "{{ create_persistent_notification | default(false) }}"
|
||||||
|
notification_id: "{{ tag | default(this.context.id) }}"
|
||||||
|
persistent_notification_condition: >
|
||||||
|
{{ persistent_notification_condition | default(true) }}
|
||||||
|
|
||||||
|
|
||||||
|
### --- Script Sequence --- ###
|
||||||
|
sequence:
|
||||||
|
|
||||||
|
- alias: Run for each person
|
||||||
|
repeat:
|
||||||
|
for_each: "{{ people | default(all_people) | map('regex_replace', 'person\\.(.+)', '\\\\1') | list }}"
|
||||||
|
sequence:
|
||||||
|
|
||||||
|
- alias: Test if {{ person }} is at home
|
||||||
|
if:
|
||||||
|
- condition: template
|
||||||
|
value_template: >-
|
||||||
|
{{ not home or (home and 'person.' + repeat.item in state_attr(home_zone, 'persons')) }}
|
||||||
|
then:
|
||||||
|
# Trigger Sub-Scripts in non-blocking (async) mode
|
||||||
|
- action: script.turn_on
|
||||||
|
target:
|
||||||
|
entity_id: script.notify_{{ repeat.item }}
|
||||||
|
data:
|
||||||
|
variables: '{{ iif(actions is defined, message_data | combine(dict(actions=actions)), message_data) }}'
|
||||||
|
|
||||||
|
- alias: Persistent Notification
|
||||||
|
if:
|
||||||
|
- condition: template
|
||||||
|
value_template: '{{ create_persistent_notification }}'
|
||||||
|
alias: Test if persistent notifications are enabled
|
||||||
|
then:
|
||||||
|
- alias: Test if we are in clearing mode
|
||||||
|
if:
|
||||||
|
- condition: template
|
||||||
|
value_template: '{{ clear }}'
|
||||||
|
then:
|
||||||
|
- action: persistent_notification.dismiss
|
||||||
|
data:
|
||||||
|
notification_id: '{{ notification_id }}'
|
||||||
|
else:
|
||||||
|
- if:
|
||||||
|
- condition: template
|
||||||
|
value_template: '{{ persistent_notification_condition }}'
|
||||||
|
then:
|
||||||
|
- action: persistent_notification.create
|
||||||
|
data:
|
||||||
|
title: "{{ title }}"
|
||||||
|
message: "{{ message }}"
|
||||||
|
notification_id: "{{ notification_id }}"
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
# Notify Person
|
||||||
|
|
||||||
|
Helper script to notify a single person. Used to prevent the need of changing every occurrence of a notification
|
||||||
|
entity by instead only updating this script in case of a device change. Provides convenience to dismiss messages.
|
||||||
|
|
||||||
|
[](https://my.home-assistant.io/redirect/blueprint_import/?blueprint_url=https%3A%2F%2Fgitea.marquis.site%2FHomeAssistant%2Fblueprints%2Fscripts%2Fnotify_person%2Fnotify_person.yaml)
|
||||||
|
|
||||||
|
## General
|
||||||
|
|
||||||
|
The only action for this script is to call the handler function and wait for its completion.
|
||||||
|
|
||||||
|
## Inputs
|
||||||
|
|
||||||
|
| Name | Description | Default |
|
||||||
|
|---------|--------------------------------------------|---------|
|
||||||
|
| Title | The title of the notification | |
|
||||||
|
| Message | The message of the notification | |
|
||||||
|
| URL | Url for click action target | |
|
||||||
|
| Tag | Tag for replacing / clearing later on | |
|
||||||
|
| Group | Group name for notification grouping | |
|
||||||
|
| Clear | Removes notifications with given tag | `false` |
|
||||||
|
| Channel | Android notification Channel | |
|
||||||
|
| Actions | Actions to add to mobile app notifications | |
|
||||||
@@ -0,0 +1,161 @@
|
|||||||
|
blueprint:
|
||||||
|
name: Notify Person
|
||||||
|
domain: script
|
||||||
|
description: >
|
||||||
|
Helper script to notify a single person. Used to prevent the need of changing every occurrence of a notification
|
||||||
|
entity by instead only updating this script in case of a device change. Provides convenience to dismiss messages.
|
||||||
|
input:
|
||||||
|
|
||||||
|
handler:
|
||||||
|
name: Handler Entity
|
||||||
|
description: >
|
||||||
|
Notification handler for the person.
|
||||||
|
selector:
|
||||||
|
entity:
|
||||||
|
filter:
|
||||||
|
domain: notify
|
||||||
|
|
||||||
|
|
||||||
|
### --- Script Fields --- ###
|
||||||
|
fields:
|
||||||
|
|
||||||
|
title:
|
||||||
|
name: Title
|
||||||
|
description: The title of the notification
|
||||||
|
required: false
|
||||||
|
example: Notification Title
|
||||||
|
selector:
|
||||||
|
text:
|
||||||
|
multiline: false
|
||||||
|
multiple: false
|
||||||
|
|
||||||
|
message:
|
||||||
|
name: Message
|
||||||
|
description: The message of the notification
|
||||||
|
required: false
|
||||||
|
example: My notification message.
|
||||||
|
selector:
|
||||||
|
text:
|
||||||
|
multiline: true
|
||||||
|
multiple: false
|
||||||
|
|
||||||
|
url:
|
||||||
|
name: URL
|
||||||
|
description: Url for click action target
|
||||||
|
required: false
|
||||||
|
example: /lovelace-light/lighting
|
||||||
|
selector:
|
||||||
|
text:
|
||||||
|
type: url
|
||||||
|
|
||||||
|
tag:
|
||||||
|
name: Tag
|
||||||
|
description: Tag for replacing / clearing later on
|
||||||
|
required: false
|
||||||
|
example: my_notification
|
||||||
|
selector:
|
||||||
|
text:
|
||||||
|
multiple: false
|
||||||
|
multiline: false
|
||||||
|
|
||||||
|
group:
|
||||||
|
name: Group
|
||||||
|
description: Group name for notification grouping
|
||||||
|
required: false
|
||||||
|
example: climate_notification
|
||||||
|
selector:
|
||||||
|
text:
|
||||||
|
multiple: false
|
||||||
|
multiline: false
|
||||||
|
|
||||||
|
clear:
|
||||||
|
name: Clear
|
||||||
|
description: Removes notifications with given tag
|
||||||
|
required: false
|
||||||
|
example: true
|
||||||
|
selector:
|
||||||
|
boolean:
|
||||||
|
|
||||||
|
channel:
|
||||||
|
name: Channel
|
||||||
|
description: Android notification Channel
|
||||||
|
required: false
|
||||||
|
example: Important Alert
|
||||||
|
selector:
|
||||||
|
text:
|
||||||
|
multiline: false
|
||||||
|
multiple: false
|
||||||
|
|
||||||
|
actions:
|
||||||
|
name: Notification actions
|
||||||
|
description: Actions to add to mobile app notifications
|
||||||
|
required: false
|
||||||
|
example: >
|
||||||
|
[{"action": "URI", "title": "Open Url", "uri": "https://home-assistant.io"}]
|
||||||
|
selector:
|
||||||
|
object:
|
||||||
|
multiple: true
|
||||||
|
fields:
|
||||||
|
action:
|
||||||
|
label: Action
|
||||||
|
required: true
|
||||||
|
selector:
|
||||||
|
text:
|
||||||
|
title:
|
||||||
|
label: Title
|
||||||
|
required: true
|
||||||
|
selector:
|
||||||
|
text:
|
||||||
|
uri:
|
||||||
|
label: URL
|
||||||
|
selector:
|
||||||
|
text:
|
||||||
|
behavior:
|
||||||
|
label: Behavior
|
||||||
|
selector:
|
||||||
|
text:
|
||||||
|
authenticationRequired:
|
||||||
|
label: Authentication Required
|
||||||
|
selector:
|
||||||
|
boolean:
|
||||||
|
|
||||||
|
|
||||||
|
### --- Script Settings --- ###
|
||||||
|
mode: queued
|
||||||
|
max: 10
|
||||||
|
description: >-
|
||||||
|
Helper script for customizable notifications targeting one person.
|
||||||
|
|
||||||
|
|
||||||
|
### --- Global Script Variables --- ###
|
||||||
|
variables:
|
||||||
|
handler: !input handler
|
||||||
|
message_title: "{{ title | default('') }}"
|
||||||
|
message_content: "{{ iif(clear, 'clear_notification', message) }}"
|
||||||
|
extra_data: >-
|
||||||
|
{%- set extra_data = [] %}
|
||||||
|
{%- if tag is defined %}
|
||||||
|
{%- set extra_data = extra_data + [ '"tag": "'~tag~'"' ] %}
|
||||||
|
{%- endif %}
|
||||||
|
{%- if url is defined %}
|
||||||
|
{%- set extra_data = extra_data + [ '"url": "'~url~'"' ] %}
|
||||||
|
{%- endif %}
|
||||||
|
{%- if url is defined %}
|
||||||
|
{%- set extra_data = extra_data + [ '"clickAction": "'~url~'"' ] %}
|
||||||
|
{%- endif %}
|
||||||
|
{%- if group is defined %}
|
||||||
|
{%- set extra_data = extra_data + [ '"group": "'~group~'"' ] %}
|
||||||
|
{%- endif %}
|
||||||
|
{%- if channel is defined %}
|
||||||
|
{%- set extra_data = extra_data + [ '"channel": "'~channel~'"' ] %}
|
||||||
|
{%- endif %}
|
||||||
|
{{ ('{'~extra_data | join(',')~'}') | from_json }}
|
||||||
|
|
||||||
|
|
||||||
|
### --- Script Sequence --- ###
|
||||||
|
sequence:
|
||||||
|
- action: "{{ handler | regex_replace('notify.', 'notify.mobile_app_') }}"
|
||||||
|
data:
|
||||||
|
title: "{{ message_title }}"
|
||||||
|
message: "{{ message_content }}"
|
||||||
|
data: "{{ iif(actions is defined, extra_data | combine(dict(actions=actions)), extra_data) }}"
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
# Smart Close Cover
|
||||||
|
|
||||||
|
Helper script to intelligently close a cover entity when the sun is below the horizon after waiting for its window to be
|
||||||
|
closed. Useful in time-based cover automations.
|
||||||
|
|
||||||
|
[](https://my.home-assistant.io/redirect/blueprint_import/?blueprint_url=https%3A%2F%2Fgitea.marquis.site%2FHomeAssistant%2Fblueprints%2Fscripts%2Fsmart_close_cover%2Fsmart_close_cover.yaml)
|
||||||
|
|
||||||
|
## General
|
||||||
|
|
||||||
|
This script chains a window entity to a cover for the action of closing the cover once if the sun is down. You can
|
||||||
|
optionally specify extra actions to be executed once the cover starts closing for example to activate a scene or send a
|
||||||
|
notification. If the window hasn't been closed after a configurable period of 14 hours, the script execution is,
|
||||||
|
canceled because the sun is probably up again.
|
||||||
|
|
||||||
|
## Inputs
|
||||||
|
|
||||||
|
| Name | Description | Default |
|
||||||
|
|--------------------|--------------------------------------------------------------------------------------|---------|
|
||||||
|
| Cover Entity | **Required.** The cover entity to close | |
|
||||||
|
| Window Entity | **Required.** The window to wait for if open at the time this script is triggered | |
|
||||||
|
| Close Duration (s) | The duration in seconds that the window needs to be closed before the cover is reset | `4` |
|
||||||
|
| extra_actions | Extra Actions to run when the cover starts closing | |
|
||||||
@@ -0,0 +1,152 @@
|
|||||||
|
blueprint:
|
||||||
|
name: Smart close cover
|
||||||
|
domain: script
|
||||||
|
description: >
|
||||||
|
Helper script to intelligently close a cover entity when the sun is below the horizon after waiting for its window
|
||||||
|
to be closed. Useful in time-based cover automations.
|
||||||
|
input:
|
||||||
|
|
||||||
|
window_close_duration_default:
|
||||||
|
name: Window close duration default (s)
|
||||||
|
description: >
|
||||||
|
The default duration the window has to be cosed before triggering the cover closing.
|
||||||
|
default: 4
|
||||||
|
selector:
|
||||||
|
number:
|
||||||
|
min: 0
|
||||||
|
step: 1
|
||||||
|
|
||||||
|
window_close_wait_timeout:
|
||||||
|
name: Window close wait timeout (h)
|
||||||
|
description: >
|
||||||
|
The default duration the window has to be cosed before triggering the cover closing.
|
||||||
|
default: 14
|
||||||
|
selector:
|
||||||
|
number:
|
||||||
|
min: 0
|
||||||
|
step: 1
|
||||||
|
|
||||||
|
|
||||||
|
### --- Script Fields --- ###
|
||||||
|
fields:
|
||||||
|
|
||||||
|
cover:
|
||||||
|
name: Cover Entity
|
||||||
|
description: The cover entity to close
|
||||||
|
required: true
|
||||||
|
selector:
|
||||||
|
entity:
|
||||||
|
filter:
|
||||||
|
- domain: cover
|
||||||
|
|
||||||
|
window:
|
||||||
|
name: Window Entity
|
||||||
|
description: The window to wait for if open at the time this script is triggered
|
||||||
|
required: true
|
||||||
|
selector:
|
||||||
|
entity:
|
||||||
|
filter:
|
||||||
|
- domain: binary_sensor
|
||||||
|
device_class: window
|
||||||
|
|
||||||
|
window_close_duration_seconds:
|
||||||
|
name: Close Duration (s)
|
||||||
|
description: >-
|
||||||
|
The duration in seconds the window needs to be closed before the cover will be reset
|
||||||
|
default: !input window_close_duration_default
|
||||||
|
selector:
|
||||||
|
number:
|
||||||
|
min: 0
|
||||||
|
step: 1
|
||||||
|
|
||||||
|
extra_actions:
|
||||||
|
name: Extra Actions to run when the cover starts closing
|
||||||
|
selector:
|
||||||
|
action: {}
|
||||||
|
|
||||||
|
|
||||||
|
### --- Script Settings --- ###
|
||||||
|
mode: parallel
|
||||||
|
max: 10
|
||||||
|
icon: mdi:arrow-down-box
|
||||||
|
description: >-
|
||||||
|
Helper script to intelligently close a cover entity after waiting for its window to be closed. Useful in time-based
|
||||||
|
cover automations.
|
||||||
|
|
||||||
|
|
||||||
|
### --- Global Script Variables --- ###
|
||||||
|
variables:
|
||||||
|
window_close_duration_default: !input window_close_duration_default
|
||||||
|
|
||||||
|
|
||||||
|
### --- Script Sequence --- ###
|
||||||
|
sequence:
|
||||||
|
- if:
|
||||||
|
- condition: template
|
||||||
|
value_template: "{{ states(window) == 'on' }}"
|
||||||
|
then:
|
||||||
|
- wait_for_trigger:
|
||||||
|
- trigger: template
|
||||||
|
value_template: |
|
||||||
|
{{ states(window) == "off" }}
|
||||||
|
for:
|
||||||
|
seconds: "{{ window_close_duration_seconds | default(window_close_duration_default) | int }}"
|
||||||
|
timeout:
|
||||||
|
hours: !input window_close_wait_timeout
|
||||||
|
|
||||||
|
- condition: sun
|
||||||
|
after: sunset
|
||||||
|
before: sunrise
|
||||||
|
enabled: true
|
||||||
|
|
||||||
|
- wait_template: |
|
||||||
|
{{ states(cover) != "unavailable" }}
|
||||||
|
continue_on_timeout: false
|
||||||
|
|
||||||
|
- action: cover.close_cover
|
||||||
|
target:
|
||||||
|
entity_id:
|
||||||
|
- '{{ cover }}'
|
||||||
|
|
||||||
|
- repeat:
|
||||||
|
for_each: '{{ extra_actions }}'
|
||||||
|
sequence:
|
||||||
|
- choose:
|
||||||
|
# 1) Condition
|
||||||
|
- conditions:
|
||||||
|
- condition: template
|
||||||
|
value_template: >-
|
||||||
|
{{
|
||||||
|
repeat.item.condition is defined and
|
||||||
|
repeat.item.condition == "template" and
|
||||||
|
repeat.item.value_template is defined
|
||||||
|
}}
|
||||||
|
sequence:
|
||||||
|
- condition: template
|
||||||
|
value_template: '{{ repeat.item.value_template }}'
|
||||||
|
# 2) Action with target & data
|
||||||
|
- conditions:
|
||||||
|
- condition: template
|
||||||
|
value_template: >-
|
||||||
|
{{ repeat.item.target is defined and repeat.item.data is defined }}
|
||||||
|
sequence:
|
||||||
|
- action: '{{ repeat.item.action }}'
|
||||||
|
target: '{{ repeat.item.target }}'
|
||||||
|
data: '{{ repeat.item.data }}'
|
||||||
|
# 3) Action with target
|
||||||
|
- conditions:
|
||||||
|
- condition: template
|
||||||
|
value_template: '{{ repeat.item.target is defined }}'
|
||||||
|
sequence:
|
||||||
|
- action: '{{ repeat.item.action }}'
|
||||||
|
target: '{{ repeat.item.target }}'
|
||||||
|
# 4) Action with data
|
||||||
|
- conditions:
|
||||||
|
- condition: template
|
||||||
|
value_template: '{{ repeat.item.data is defined }}'
|
||||||
|
sequence:
|
||||||
|
- action: '{{ repeat.item.action }}'
|
||||||
|
data: '{{ repeat.item.data }}'
|
||||||
|
# 5) Only action
|
||||||
|
default:
|
||||||
|
- action: '{{ repeat.item.action }}'
|
||||||
Reference in new issue
Block a user