init
This commit is contained in:
4359
blueprints/automation/Blackshome/bathroom-humidity-exhaust-fan.yaml
Normal file
4359
blueprints/automation/Blackshome/bathroom-humidity-exhaust-fan.yaml
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,44 @@
|
||||
blueprint:
|
||||
name: Synchronize states
|
||||
description: Synchronize the on/off state of 2 entities
|
||||
domain: automation
|
||||
input:
|
||||
entity_1:
|
||||
name: First entity
|
||||
selector:
|
||||
entity: {}
|
||||
entity_2:
|
||||
name: Second entity
|
||||
selector:
|
||||
entity: {}
|
||||
source_url: https://community.home-assistant.io/t/synchronize-the-on-off-state-of-2-entities/259010
|
||||
mode: restart
|
||||
max_exceeded: silent
|
||||
variables:
|
||||
entity_1: !input entity_1
|
||||
entity_2: !input entity_2
|
||||
trigger:
|
||||
- platform: state
|
||||
entity_id: !input entity_1
|
||||
to:
|
||||
- 'off'
|
||||
- 'on'
|
||||
- platform: state
|
||||
entity_id: !input entity_2
|
||||
to:
|
||||
- 'off'
|
||||
- 'on'
|
||||
condition:
|
||||
- condition: template
|
||||
value_template: '{{ states(entity_1) != states(entity_2) }}'
|
||||
- condition: template
|
||||
value_template: '{{ trigger.to_state.state != trigger.from_state.state }}'
|
||||
- condition: template
|
||||
value_template: '{{ trigger.to_state.context.parent_id is none or (trigger.to_state.context.id
|
||||
!= this.context.id and trigger.to_state.context.parent_id != this.context.id)
|
||||
}}'
|
||||
action:
|
||||
- service: homeassistant.turn_{{ trigger.to_state.state }}
|
||||
data:
|
||||
entity_id: '{% if trigger.from_state.entity_id == entity_1 %} {{ entity_2 }} {%
|
||||
else %} {{ entity_1 }} {% endif %}'
|
||||
@@ -0,0 +1,156 @@
|
||||
blueprint:
|
||||
name: Unavailable entity detection & notification
|
||||
description: >
|
||||
Regularly test all entities' status to check for unavailability.
|
||||
Supports exclusion by entities, devices, areas, and labels for flexible filtering.
|
||||
domain: automation
|
||||
source_url: https://github.com/gmlupatelli/blueprints_repo/blob/master/unavailable_entities_notification/unavailable_entities_notification.yaml
|
||||
input:
|
||||
time:
|
||||
name: Time to test on
|
||||
description: Test is run at configured time
|
||||
default: '10:00:00'
|
||||
selector:
|
||||
time: {}
|
||||
monday_enabled:
|
||||
name: Monday
|
||||
default: true
|
||||
selector:
|
||||
boolean: {}
|
||||
tuesday_enabled:
|
||||
name: Tuesday
|
||||
default: true
|
||||
selector:
|
||||
boolean: {}
|
||||
wednesday_enabled:
|
||||
name: Wednesday
|
||||
default: true
|
||||
selector:
|
||||
boolean: {}
|
||||
thursday_enabled:
|
||||
name: Thursday
|
||||
default: true
|
||||
selector:
|
||||
boolean: {}
|
||||
friday_enabled:
|
||||
name: Friday
|
||||
default: true
|
||||
selector:
|
||||
boolean: {}
|
||||
saturday_enabled:
|
||||
name: Saturday
|
||||
default: true
|
||||
selector:
|
||||
boolean: {}
|
||||
sunday_enabled:
|
||||
name: Sunday
|
||||
default: true
|
||||
selector:
|
||||
boolean: {}
|
||||
exclude:
|
||||
name: Excluded Entities
|
||||
description: Entities (e.g. smartphone) to exclude. Entities, devices, areas, and labels are supported!
|
||||
default: {}
|
||||
selector:
|
||||
target: {}
|
||||
include:
|
||||
name: Included Entities
|
||||
description: Entities (e.g. smartphone) to include. Entities, devices, areas, and labels are supported!
|
||||
default: {}
|
||||
selector:
|
||||
target: {}
|
||||
actions:
|
||||
name: Actions
|
||||
description: Notifications or similar to be run. {{entities}} is replaced with a formatted list.
|
||||
default: []
|
||||
selector:
|
||||
action: {}
|
||||
|
||||
variables:
|
||||
monday_enabled: !input monday_enabled
|
||||
tuesday_enabled: !input tuesday_enabled
|
||||
wednesday_enabled: !input wednesday_enabled
|
||||
thursday_enabled: !input thursday_enabled
|
||||
friday_enabled: !input friday_enabled
|
||||
saturday_enabled: !input saturday_enabled
|
||||
sunday_enabled: !input sunday_enabled
|
||||
current_day: '{{ now().weekday() | int }}'
|
||||
exclude: !input exclude
|
||||
include: !input include
|
||||
|
||||
excluded_entities: >
|
||||
{% set excluded = [] %}
|
||||
{% if exclude.entity_id is defined %}
|
||||
{% set excluded = excluded + ( [exclude.entity_id] if exclude.entity_id is string else exclude.entity_id ) %}
|
||||
{% endif %}
|
||||
{% if exclude.device_id is defined %}
|
||||
{% for d in ([exclude.device_id] if exclude.device_id is string else exclude.device_id) %}
|
||||
{% set excluded = excluded + device_entities(d) %}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
{% if exclude.area_id is defined %}
|
||||
{% for a in ([exclude.area_id] if exclude.area_id is string else exclude.area_id) %}
|
||||
{% set excluded = excluded + area_entities(a) %}
|
||||
{% for d in area_devices(a) %}
|
||||
{% set excluded = excluded + device_entities(d) %}
|
||||
{% endfor %}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
{% if exclude.label_id is defined %}
|
||||
{% for l in ([exclude.label_id] if exclude.label_id is string else exclude.label_id) %}
|
||||
{% set excluded = excluded + label_entities(l) %}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
{{ excluded }}
|
||||
|
||||
# Build included list
|
||||
included_entities_raw: >
|
||||
{{ label_entities('monitored') }}
|
||||
|
||||
# Collect ALL unavailable entities (no filtering yet)
|
||||
unavailable_entities: >
|
||||
{% set unavail = states | selectattr('state','eq','unavailable') | map(attribute='entity_id') | list %}
|
||||
{{ unavail }}
|
||||
|
||||
# Apply include/exclude filtering only here
|
||||
final_unavailable_entities: >
|
||||
{% set ns = namespace(final=[]) %}
|
||||
{% set included_list = included_entities_raw %}
|
||||
{% set excluded_list = excluded_entities %}
|
||||
{% for entity in unavailable_entities %}
|
||||
{% set dev_id = device_id(entity) %}
|
||||
{% if entity in included_list and not entity in excluded_list and (not device_attr(dev_id,'disabled_by')) %}
|
||||
{% set ns.final = ns.final + [state_attr(entity,'friendly_name') ~ ' (' ~ entity ~ ')'] %}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{{ ns.final }}
|
||||
|
||||
|
||||
|
||||
entities: "{{ '- ' }}{{ final_unavailable_entities | join('\n- ') }}"
|
||||
|
||||
|
||||
trigger:
|
||||
- platform: time
|
||||
at: !input time
|
||||
|
||||
condition:
|
||||
- condition: template
|
||||
value_template: >
|
||||
{{
|
||||
(current_day == 0 and monday_enabled) or
|
||||
(current_day == 1 and tuesday_enabled) or
|
||||
(current_day == 2 and wednesday_enabled) or
|
||||
(current_day == 3 and thursday_enabled) or
|
||||
(current_day == 4 and friday_enabled) or
|
||||
(current_day == 5 and saturday_enabled) or
|
||||
(current_day == 6 and sunday_enabled)
|
||||
}}
|
||||
- condition: template
|
||||
value_template: '{{ final_unavailable_entities | length > 0 }}'
|
||||
|
||||
|
||||
action: !input actions
|
||||
|
||||
mode: single
|
||||
max_exceeded: silent
|
||||
58
blueprints/automation/homeassistant/motion_light.yaml
Normal file
58
blueprints/automation/homeassistant/motion_light.yaml
Normal file
@@ -0,0 +1,58 @@
|
||||
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: occupancy
|
||||
domain: binary_sensor
|
||||
- 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
|
||||
|
||||
triggers:
|
||||
trigger: state
|
||||
entity_id: !input motion_entity
|
||||
from: "off"
|
||||
to: "on"
|
||||
|
||||
actions:
|
||||
- alias: "Turn on the light"
|
||||
action: light.turn_on
|
||||
target: !input light_target
|
||||
- alias: "Wait until there is no motion from device"
|
||||
wait_for_trigger:
|
||||
trigger: 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"
|
||||
action: light.turn_off
|
||||
target: !input light_target
|
||||
50
blueprints/automation/homeassistant/notify_leaving_zone.yaml
Normal file
50
blueprints/automation/homeassistant/notify_leaving_zone.yaml
Normal file
@@ -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
|
||||
|
||||
triggers:
|
||||
trigger: 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 }}"
|
||||
|
||||
conditions:
|
||||
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 }}"
|
||||
|
||||
actions:
|
||||
- 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,75 @@
|
||||
blueprint:
|
||||
name: Low battery level detection & notification for all battery sensors
|
||||
description: Regularly test all sensors with 'battery' device-class for crossing
|
||||
a certain battery level threshold and if so execute an action.
|
||||
domain: automation
|
||||
input:
|
||||
threshold:
|
||||
name: Battery warning level threshold
|
||||
description: Battery sensors below threshold are assumed to be low-battery (as
|
||||
well as binary battery sensors with value 'on').
|
||||
default: 20
|
||||
selector:
|
||||
number:
|
||||
min: 5.0
|
||||
max: 100.0
|
||||
unit_of_measurement: '%'
|
||||
mode: slider
|
||||
step: 5.0
|
||||
time:
|
||||
name: Time to test on
|
||||
description: Test is run at configured time
|
||||
default: '10:00:00'
|
||||
selector:
|
||||
time: {}
|
||||
day:
|
||||
name: Weekday to test on
|
||||
description: 'Test is run at configured time either everyday (0) or on a given
|
||||
weekday (1: Monday ... 7: Sunday)'
|
||||
default: 0
|
||||
selector:
|
||||
number:
|
||||
min: 0.0
|
||||
max: 7.0
|
||||
mode: slider
|
||||
step: 1.0
|
||||
exclude:
|
||||
name: Excluded Sensors
|
||||
description: Battery sensors (e.g. smartphone) to exclude from detection. Only
|
||||
entities are supported, devices must be expanded!
|
||||
default:
|
||||
entity_id: []
|
||||
selector:
|
||||
target:
|
||||
entity:
|
||||
- device_class:
|
||||
- battery
|
||||
actions:
|
||||
name: Actions
|
||||
description: Notifications or similar to be run. {{sensors}} is replaced with
|
||||
the names of sensors being low on battery.
|
||||
selector:
|
||||
action: {}
|
||||
source_url: https://gist.github.com/sbyx/1f6f434f0903b872b84c4302637d0890
|
||||
variables:
|
||||
day: !input day
|
||||
threshold: !input threshold
|
||||
exclude: !input exclude
|
||||
sensors: "{% set result = namespace(sensors=[]) %} {% for state in states.sensor
|
||||
| selectattr('attributes.device_class', '==', 'battery') %}\n {% if 0 <= state.state
|
||||
| int(-1) < threshold | int and not state.entity_id in exclude.entity_id %}\n
|
||||
\ {% set result.sensors = result.sensors + [state.name ~ ' (' ~ state.state
|
||||
~ ' %)'] %}\n {% endif %}\n{% endfor %} {% for state in states.binary_sensor
|
||||
| selectattr('attributes.device_class', '==', 'battery') | selectattr('state',
|
||||
'==', 'on') %}\n {% if not state.entity_id in exclude.entity_id %}\n {% set
|
||||
result.sensors = result.sensors + [state.name] %}\n {% endif %}\n{% endfor %}
|
||||
{{result.sensors|join(', ')}}"
|
||||
trigger:
|
||||
- platform: time
|
||||
at: !input time
|
||||
condition:
|
||||
- '{{ sensors != '''' and (day | int == 0 or day | int == now().isoweekday()) }}'
|
||||
action:
|
||||
- choose: []
|
||||
default: !input actions
|
||||
mode: single
|
||||
@@ -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,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') }}"
|
||||
Reference in New Issue
Block a user