Initial Commit

This commit is contained in:
2026-06-20 18:49:03 +02:00
parent 8c14309eba
commit 5b558c1478
13 changed files with 1405 additions and 3 deletions
@@ -0,0 +1,56 @@
blueprint:
name: Motion-activated Light
description: Turn on a light when motion is detected.
domain: automation
source_url: https://github.com/home-assistant/core/blob/dev/homeassistant/components/automation/blueprints/motion_light.yaml
author: Home Assistant
input:
motion_entity:
name: Motion Sensor
selector:
entity:
filter:
device_class: motion
domain: binary_sensor
light_target:
name: Light
selector:
target:
entity:
domain: light
no_motion_wait:
name: Wait time
description: Time to leave the light on after last motion is detected.
default: 120
selector:
number:
min: 0
max: 3600
unit_of_measurement: seconds
# If motion is detected within the delay,
# we restart the script.
mode: restart
max_exceeded: silent
trigger:
platform: state
entity_id: !input motion_entity
from: "off"
to: "on"
action:
- alias: "Turn on the light"
service: light.turn_on
target: !input light_target
- alias: "Wait until there is no motion from device"
wait_for_trigger:
platform: state
entity_id: !input motion_entity
from: "on"
to: "off"
- alias: "Wait the number of seconds that has been set"
delay: !input no_motion_wait
- alias: "Turn off the light"
service: light.turn_off
target: !input light_target
@@ -0,0 +1,50 @@
blueprint:
name: Zone Notification
description: Send a notification to a device when a person leaves a specific zone.
domain: automation
source_url: https://github.com/home-assistant/core/blob/dev/homeassistant/components/automation/blueprints/notify_leaving_zone.yaml
author: Home Assistant
input:
person_entity:
name: Person
selector:
entity:
filter:
domain: person
zone_entity:
name: Zone
selector:
entity:
filter:
domain: zone
notify_device:
name: Device to notify
description: Device needs to run the official Home Assistant app to receive notifications.
selector:
device:
filter:
integration: mobile_app
trigger:
platform: state
entity_id: !input person_entity
variables:
zone_entity: !input zone_entity
# This is the state of the person when it's in this zone.
zone_state: "{{ states[zone_entity].name }}"
person_entity: !input person_entity
person_name: "{{ states[person_entity].name }}"
condition:
condition: template
# The first case handles leaving the Home zone which has a special state when zoning called 'home'.
# The second case handles leaving all other zones.
value_template: "{{ zone_entity == 'zone.home' and trigger.from_state.state == 'home' and trigger.to_state.state != 'home' or trigger.from_state.state == zone_state and trigger.to_state.state != zone_state }}"
action:
- alias: "Notify that a person has left the zone"
domain: mobile_app
type: notify
device_id: !input notify_device
message: "{{ person_name }} has left {{ zone_state }}"
@@ -0,0 +1,200 @@
blueprint:
name: Automatic Backups
description: 'Create backups each day and keep them for a configurable amount of
time, backups are stored less frequently the older they are.
By default all backups are full backups, besides the 3-hourly backups which only
include the configuration.
**Template Variables:**
- `name` — backup name configured below
- `password` — backup password configured below
- `keep_days` — days the backup is kept for based on the current backup type
- `backup_type` — current schedule being created, e.g., `daily`, `weekly`, `monthly`
**Note: requires the [Auto Backup](https://jcwillox.github.io/hass-auto-backup)
custom integration.**
'
domain: automation
input:
backup_name:
name: Name template used for backups
default: "{{ backup_type | title }}Backup: {{\n now().strftime(\n \"%A,
\"\n ~ iif(backup_type == \"hourly\", \"%-I:%M %p, \", \"\")\n ~ \"%B
%-d, %Y\"\n )\n}}\n{# HourlyBackup: Monday, 3:04 PM, January 2, 2006 #}\n{#
DailyBackup: Monday, January 2, 2006 #}\n"
selector:
template: {}
backup_time:
name: Time of day to create backups
default: 02:30:00
selector:
time: {}
backup_password:
name: Backup Password (Optional)
default: ''
selector:
text:
type: password
multiple: false
multiline: false
enable_hourly:
name: 'Enable: Hourly Backups'
description: Create a backup every 3 hours and store for 2 days
default: false
selector:
boolean: {}
enable_daily:
name: 'Enable: Daily Backups'
description: Create a backup each day and store for a week
default: true
selector:
boolean: {}
enable_weekly:
name: 'Enable: Weekly Backups'
description: Create a backup each week and store for a month
default: true
selector:
boolean: {}
enable_monthly:
name: 'Enable: Monthly Backups'
description: Create a backup each month and store for a year
default: true
selector:
boolean: {}
enable_yearly:
name: 'Enable: Yearly Backups'
description: Create a backup each year and store forever
default: true
selector:
boolean: {}
use_action_hourly:
name: Use Backup Action for Hourly Backups Only
description: Otherwise, it will be used for all backup types
default: true
selector:
boolean: {}
backup_action:
name: Backup Action (Optional)
description: 'Optionally override the built-in backup action with a custom action,
designed to allow greater control over what is included in each backup.
By default this only overrides the 3-hourly backups, so that they only include
the configuration.
'
default:
- service: auto_backup.backup
data:
name: '{{ name }}'
password: '{{ password }}'
keep_days: '{{ keep_days }}'
include_folders:
- config
selector:
action: {}
condition:
name: Condition (Optional)
description: Condition to test before any action
default: []
selector:
action: {}
source_url: https://raw.githubusercontent.com/jcwillox/home-assistant-blueprints/main/automation/automatic_backups.yaml
mode: single
variables:
password: !input backup_password
enable_hourly: !input enable_hourly
enable_daily: !input enable_daily
enable_weekly: !input enable_weekly
enable_monthly: !input enable_monthly
enable_yearly: !input enable_yearly
use_action_hourly: !input use_action_hourly
trigger:
- id: daily
platform: time
at: !input backup_time
- id: hourly
enabled: !input enable_hourly
platform: time_pattern
hours: /3
condition: !input condition
action:
- if:
condition: trigger
id: daily
then:
- choose:
- conditions:
- '{{ enable_yearly }}'
- '{{ now().day == 1 and now().month == 1 }}'
sequence:
- variables:
backup_type: yearly
keep_days:
- &id001
variables:
name: !input backup_name
backup_action: !input backup_action
- &id002
if:
- '{{ not use_action_hourly }}'
- '{{ backup_action | length > 0 }}'
then: !input backup_action
else:
- alias: Creating a full backup (default action)
service: auto_backup.backup
data:
name: '{{ name }}'
password: '{{ password }}'
keep_days: '{{ keep_days }}'
- conditions:
- '{{ enable_monthly }}'
- '{{ now().day == 1 }}'
sequence:
- variables:
backup_type: monthly
keep_days: 365
- *id001
- *id002
- conditions:
- '{{ enable_weekly }}'
- '{{ now().weekday() == 0 }}'
sequence:
- variables:
backup_type: weekly
keep_days: 30.4167
- *id001
- *id002
- conditions:
- '{{ enable_daily }}'
sequence:
- variables:
backup_type: daily
keep_days: 7
- *id001
- *id002
else:
- variables:
backup_type: hourly
keep_days: 2
- *id001
- if: '{{ backup_action | length > 0 }}'
then: !input backup_action
else:
- alias: Creating a partial backup (default action)
service: auto_backup.backup
data:
name: '{{ name }}'
password: '{{ password }}'
keep_days: '{{ keep_days }}'
include_folders:
- config
@@ -0,0 +1,143 @@
blueprint:
name: Notify - Auto Backup
description: 'Send notifications based on events created by the [Auto Backup](https://jcwillox.github.io/hass-auto-backup)
integration, such as when a backup fails.
**Note: requires the [Auto Backup](https://jcwillox.github.io/hass-auto-backup)
custom integration.**
'
domain: automation
input:
events:
name: Events
description: Which events to send notifications
default:
- auto_backup.backup_failed
selector:
select:
multiple: true
mode: dropdown
options:
- label: Backup Start
value: auto_backup.backup_start
- label: Backup Successful
value: auto_backup.backup_successful
- label: Backup Failed
value: auto_backup.backup_failed
- label: Backup Purged
value: auto_backup.purged_backups
custom_value: false
sort: false
notify_hass:
name: Send to Home Assistant
description: Send to Home Assistant as a persistent notification
default: false
selector:
boolean: {}
devices:
name: Mobile Devices
description: Send notifications to mobile devices
default: []
selector:
device:
integration: mobile_app
multiple: true
only_after:
name: Only after
description: Only send notifications to mobile devices after this time
default: 00:00:00
selector:
time: {}
only_before:
name: Only before
description: Only send notifications to mobile devices before this time
default: 00:00:00
selector:
time: {}
source_url: https://raw.githubusercontent.com/jcwillox/home-assistant-blueprints/main/automation/notify_auto_backup.yaml
mode: parallel
variables:
notify_hass: !input notify_hass
trigger:
platform: event
event_type: !input events
action:
- choose:
- conditions: '{{ trigger.event.event_type == "auto_backup.backup_start" }}'
sequence:
- variables:
notify_title: Backup Started
notify_message: '{{ trigger.event.data.name }}'
notify_data:
group: Auto Backup
url: /hassio/backups
clickAction: /hassio/backups
tag: auto-backup-{{ trigger.event.data.name }}
notification_icon: mdi:package-variant
- &id001
if: '{{ True }}'
then:
- if:
condition: time
after: !input only_after
before: !input only_before
then:
- alias: Send notifications to mobile devices
repeat:
for_each: !input devices
sequence:
- alias: Notify mobile device
service: notify.mobile_app_{{ device_attr(repeat.item, "name") | slugify
}}
data:
title: '{{ notify_title }}'
message: '{{ notify_message }}'
data: '{{ notify_data }}'
- if: '{{ notify_hass }}'
then:
- alias: Send a notification to HA
service: persistent_notification.create
data:
title: '{{ notify_title }}'
message: '{{ notify_message }}'
- conditions: '{{ trigger.event.event_type == "auto_backup.backup_successful" }}'
sequence:
- variables:
notify_title: Backup Successful
notify_message: '{{ trigger.event.data.name }}'
notify_data:
group: Auto Backup
url: /hassio/backups
clickAction: /hassio/backups
tag: auto-backup-{{ trigger.event.data.name }}
notification_icon: mdi:package-variant-closed
- *id001
- conditions: '{{ trigger.event.event_type == "auto_backup.backup_failed" }}'
sequence:
- variables:
notify_title: Backup Failed
notify_message: '{{ trigger.event.data.name }}
{{ trigger.event.data.error }}
'
notify_data:
group: Auto Backup
url: /hassio/backups
clickAction: /hassio/backups
tag: auto-backup-{{ trigger.event.data.name }}
notification_icon: mdi:package-variant-closed-remove
- *id001
- conditions: '{{ trigger.event.event_type == "auto_backup.purged_backups" }}'
sequence:
- variables:
notify_title: Backup(s) Purged
notify_message: '{{ trigger.event.data.backups | join('', '') }}'
notify_data:
group: Auto Backup
url: /hassio/backups
clickAction: /hassio/backups
notification_icon: mdi:package-variant-closed-minus
- *id001
@@ -0,0 +1,86 @@
blueprint:
name: Confirmable Notification
description: >-
A script that sends an actionable notification with a confirmation before
running the specified action.
domain: script
source_url: https://github.com/home-assistant/core/blob/master/homeassistant/components/script/blueprints/confirmable_notification.yaml
author: Home Assistant
input:
notify_device:
name: Device to notify
description: Device needs to run the official Home Assistant app to receive notifications.
selector:
device:
filter:
integration: mobile_app
title:
name: "Title"
description: "The title of the button shown in the notification."
default: ""
selector:
text:
message:
name: "Message"
description: "The message body"
selector:
text:
confirm_text:
name: "Confirmation Text"
description: "Text to show on the confirmation button"
default: "Confirm"
selector:
text:
confirm_action:
name: "Confirmation Action"
description: "Action to run when notification is confirmed"
default: []
selector:
action:
dismiss_text:
name: "Dismiss Text"
description: "Text to show on the dismiss button"
default: "Dismiss"
selector:
text:
dismiss_action:
name: "Dismiss Action"
description: "Action to run when notification is dismissed"
default: []
selector:
action:
mode: restart
sequence:
- alias: "Set up variables"
variables:
action_confirm: "{{ 'CONFIRM_' ~ context.id }}"
action_dismiss: "{{ 'DISMISS_' ~ context.id }}"
- alias: "Send notification"
domain: mobile_app
type: notify
device_id: !input notify_device
title: !input title
message: !input message
data:
actions:
- action: "{{ action_confirm }}"
title: !input confirm_text
- action: "{{ action_dismiss }}"
title: !input dismiss_text
- alias: "Awaiting response"
wait_for_trigger:
- platform: event
event_type: mobile_app_notification_action
event_data:
action: "{{ action_confirm }}"
- platform: event
event_type: mobile_app_notification_action
event_data:
action: "{{ action_dismiss }}"
- choose:
- conditions: "{{ wait.trigger.event.data.action == action_confirm }}"
sequence: !input confirm_action
- conditions: "{{ wait.trigger.event.data.action == action_dismiss }}"
sequence: !input dismiss_action
@@ -0,0 +1,129 @@
blueprint:
name: 'Sleep as Android: Trigger app actions'
description: 'Send commands to the Sleep as Android app on your selected mobile
device via Home Assistant. Requires the device to run the official Home Assistant
companion app.
'
domain: script
author: tr4nt0r
input:
notify_device:
name: Target device
description: 'The mobile device running Sleep as Android. Must have the official
Home Assistant companion app installed and connected.
'
selector:
device:
filter:
- integration: mobile_app
multiple: false
sleep_action:
name: Action
description: 'The specific Sleep as Android command to trigger
'
selector:
select:
options:
- label: Start sleep tracking
value: com.urbandroid.sleep.alarmclock.START_SLEEP_TRACK
- label: Start sleep tracking + Set an alarm for ideal sleep length
value: com.urbandroid.sleep.alarmclock.START_SLEEP_TRACK_WITH_IDEAL_ALARM_ACTION
- label: Stop sleep tracking
value: com.urbandroid.sleep.alarmclock.STOP_SLEEP_TRACK
- label: Pause sleep tracking for 5 minutes
value: com.urbandroid.sleep.ACTION_PAUSE_TRACKING
- label: Snooze alarm
value: com.urbandroid.sleep.alarmclock.ALARM_SNOOZE
- label: Dismiss alarm
value: com.urbandroid.sleep.alarmclock.ALARM_DISMISS_CAPTCHA
- label: Stop lullaby
value: com.urbandroid.sleep.ACTION_LULLABY_STOP_PLAYBACK
- label: Request backup
value: com.urbandroid.sleep.REQUEST_SYNC
- label: Change alarm state (when not currently ringing)
value: com.urbandroid.sleep.alarmclock.ALARM_STATE_CHANGE
multiple: false
sort: false
custom_value: false
section_extra_snooze_time:
name: Snooze alarm extras
icon: mdi:alarm-snooze
collapsed: true
input:
extra_snooze_time:
name: Extra snooze time (optional)
description: 'Override the snooze duration for this alarm (160 minutes). Leave
blank to use the default snooze time set in the Sleep as Android app.
'
selector:
number:
min: 1.0
max: 60.0
unit_of_measurement: minutes
mode: box
step: 1.0
default: ''
section_alarm_state_change:
name: Change alarm state extras
icon: mdi:alarm
description: These settings are required when using the "Change alarm state"
action.
collapsed: true
input:
alarm_label:
name: Alarm label
description: 'The label of the alarm to modify. Must explicitly set **in
the Sleep as Android app** for this action to work. If multiple alarms
share this label, only one will be changed (no guarantee which).
'
selector:
text: {}
default: Alarm
alarm_state:
name: Enable or disable
description: 'Select whether the specified alarm should be turned on (enabled)
or turned off (disabled).
'
selector:
boolean: {}
default: false
section_start_in_battery_saving_mode:
name: Start sleep tracking extras
icon: mdi:record-rec
collapsed: true
input:
start_in_battery_saving_mode:
name: Start in battery saving mode
description: Start sleep tracking with reduced power usage to save battery.
selector:
boolean: {}
default: false
source_url: https://community.home-assistant.io/t/sleep-as-android-trigger-app-actions/920845
mode: parallel
sequence:
- variables:
sleep_action: !input sleep_action
alarm_label: !input alarm_label
alarm_state: !input alarm_state
extra_snooze_time: !input extra_snooze_time
start_in_battery_saving_mode: !input start_in_battery_saving_mode
- alias: Send intent to Sleep as Android
domain: mobile_app
type: notify
device_id: !input notify_device
message: command_broadcast_intent
data:
intent_package_name: com.urbandroid.sleep
intent_action: !input sleep_action
intent_extras: "{% if sleep_action == 'com.urbandroid.sleep.alarmclock.ALARM_STATE_CHANGE'
and alarm_label %}\n alarm_label:{{ alarm_label }},alarm_enabled:{{ alarm_state
}}\n{% elif sleep_action == 'com.urbandroid.sleep.alarmclock.ALARM_SNOOZE' and
extra_snooze_time %}\n extra_snooze_time:{{ extra_snooze_time }}\n{% elif sleep_action
== 'com.urbandroid.sleep.alarmclock.START_SLEEP_TRACK' and start_in_battery_saving_mode
%}\n START_IN_BATTERY_SAVING_MODE:true\n{% endif %}"
@@ -0,0 +1,27 @@
blueprint:
name: Invert a binary sensor
description: Creates a binary_sensor which holds the inverted value of a reference binary_sensor
domain: template
source_url: https://github.com/home-assistant/core/blob/dev/homeassistant/components/template/blueprints/inverted_binary_sensor.yaml
input:
reference_entity:
name: Binary sensor to be inverted
description: The binary_sensor which needs to have its value inverted
selector:
entity:
domain: binary_sensor
variables:
reference_entity: !input reference_entity
binary_sensor:
state: >
{% if states(reference_entity) == 'on' %}
off
{% elif states(reference_entity) == 'off' %}
on
{% else %}
{{ states(reference_entity) }}
{% endif %}
# delay_on: not_used in this example
# delay_off: not_used in this example
# auto_off: not_used in this example
availability: "{{ states(reference_entity) not in ('unknown', 'unavailable') }}"