chore: initial baseline before refactoring

Initial snapshot of Home Assistant config (HAOS 2026.4.4)
prior to dashboard restructuring and helper YAML migration.

Pre-commit cleanup applied:
- Removed blueprints/switch_manager/ (9.4 MB stale, component already gone)
- Removed .storage/switch_manager
- Removed home-assistant.log.{1,old,fault}
- Removed zigbee2mqtt/configuration_backup_v{1..4}.yaml
- Removed zigbee2mqtt/database.db.tmp.2024-09-27 (1.5y old)
- Created empty themes/ to satisfy configuration.yaml include

.gitignore uses allowlist strategy for .storage/ to keep
all tokens, keys, and PINs out of version control.
This commit is contained in:
2026-05-02 14:24:53 +02:00
commit 5f01411780
149 changed files with 47886 additions and 0 deletions
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,601 @@
blueprint:
name: Notifications & Announcements
description: "# \U0001F4E2 Notifications & Announcements\n**Version: 1.2**\n\nState
your trigger and spread the word \U0001F4AC\U0001F509\n\n**If you like my blueprints,
and would like to show your support or just say thank you?** [Click Here](https://www.paypal.com/donate/?hosted_button_id=WAZS3QSDTPGA8)
\U0001F642\n<details> <summary><b>The Automation Process:</b> - Click here to
expand</summary>\n\n\n - **Trigger Options:**\n\n - Specify the state change
of one or more entities that will initiate the automation from a dropdown list.
You can also specify your own custom state if it is not available from the dropdown
list.\n - State Change Options: The available state changes include:\n -
**General States:** Button or any state, ON, OFF, Unavailable or Unknown\n -
**Location-Based States:** Home or Not Home\n - **Numeric States:** Numeric
state above, Numeric state below or Numeric state above & below\n\n - **Notification
Options:**\n\n - Opt to send messages to one or multiple devices. Compatible
with Apple iOS and Android devices.\n - Opt to display your notifications directly
within the Home Assistant user interface (UI).\n - Opt to send Text-to-Speech
Announcement to your selected media players.\n\n - **Time-Based Automation:**\n\n
\ - Specify precise start and end times along with weekday selections to define
when the automation can run.\n\n - **Custom Conditions:**\n\n - Enter any
custom conditions to further customize the automation process.\n\n</details>\n\nNeed
help? See our FAQ: [Click Here](https://community.home-assistant.io/t/notifications-announcements/728100/2?u=blacky)\nLet
us know what you think of this blueprint and for community support including updates:
[Click Here](https://community.home-assistant.io/t/notifications-announcements/728100?u=blacky)\n\nRequired
= *\n"
domain: automation
input:
trigger_settings:
name: Triggers *
icon: mdi:cog-outline
collapsed: true
input:
trigger_state:
name: Trigger - State *
description: 'Please select what state you would like for your trigger.
You can choose from ten options available in the dropdown menu. If your
option is not in the dropdown menu then just type the state you would
like to use in and click the save button.
1 - Button Or Any State
2 - ON
3 - OFF
4 - Unavailable
5 - Unknown
6 - Home
7 - Not Home
8 - Numeric State - Above
9 - Numeric State - Below
10 - Numeric State - Above & Below
A numbering system has been implemented to facilitate navigation within
the dropdown selections. Each number corresponds to a specific configuration,
aiding users in identifying and adjusting the settings used within each
selection. For instance, when selecting "8 - Numeric State - Above" as
a dropdown option, settings marked "Used in options 8, 9 or 10" are required
for that respective selection because number 8 is included in those options.
'
default: button_any_state
selector:
select:
custom_value: true
mode: dropdown
options:
- label: 1 - Button Or Any State
value: button_any_state
- label: 2 - ON
value: 'on'
- label: 3 - OFF
value: 'off'
- label: 4 - Unavailable
value: unavailable
- label: 5 - Unknown
value: unknown
- label: 6 - Home
value: home
- label: 7 - Not Home
value: not_home
- label: 8 - Numeric State - Above
value: numeric_state_above
- label: 9 - Numeric State - Below
value: numeric_state_below
- label: 10 - Numeric State - Above & Below
value: numeric_state_above_below
sort: false
multiple: false
trigger_state_entity:
name: State Entities
description: '**Used in options 1, 2, 3, 4, 5, 6 or 7**. Enter the entities
that will trigger the automation on state change.
'
default: []
selector:
entity:
multiple: true
trigger_numeric_entity:
name: Numeric State Entities
description: '**Used in options 8, 9 or 10**. Enter the entities that will
trigger the automation numeric state change.
'
default: []
selector:
entity:
multiple: true
above_state:
name: Numeric State Above Option
description: '**Used in options 8, or 10**. Set the above value. The numeric
state trigger will be when the value crosses over to above the set value.
'
default: 0
selector:
number:
min: -20.0
max: 100.0
step: 1.0
unit_of_measurement: value
mode: slider
below_state:
name: Numeric State Below Option
description: '**Used in options 9 or 10**. Set the below value. The numeric
state trigger will be when the value crosses over to below the set value.
'
default: 0
selector:
number:
min: -20.0
max: 100.0
step: 1.0
unit_of_measurement: value
mode: slider
time_delay_state:
name: Time Delay
description: '**Used in options 1, 2, 3, 4, 5, 6, 7, 8, 9 or 10** Specifies
the duration that the trigger must maintain its state before the automation
is executed. The automation will only proceed if the trigger condition
is met continuously for this entire time delay.
'
default:
hours: 0
minutes: 0
seconds: 0
selector:
duration: {}
device_notify_settings:
name: Mobile App Notify
icon: mdi:devices
collapsed: true
input:
include_notify:
name: Use The Mobile App Notify Option (Optional)
description: "Enabling this option will send notifications to the selected
devices below. \n"
default: disable_mobile_app_notify
selector:
select:
options:
- label: Enable Mobile App Notify Options
value: enable_mobile_app_notify
- label: Disable Mobile App Notify Options
value: disable_mobile_app_notify
custom_value: false
sort: false
multiple: false
notify_device:
name: Devices Notified
description: 'Select the devices to be notified when the automation is triggered.
'
default: []
selector:
device:
filter:
- integration: mobile_app
multiple: true
notify_title:
name: Title
description: 'Enter in the title of your notification.
'
default: "\U0001F4E2 Enter Notify Title Here"
selector:
text: {}
notify_message:
name: Message
description: 'Enter in the message of your notification.
'
default: "Enter Notify Message Here \U0001F642"
selector:
text: {}
notify_interruption_level:
name: Interruption Level - iOS Only
description: 'On devices running iOS 15 and later, you can configure the
interruption level for your notifications to ensure they are delivered
according to your preferences. Choose the desired interruption level from
the dropdown list. Critical and time-sensitive notifications must be turned
ON within the Home Assistant App, and time-sensitive notifications must
be allowed in your Focus settings.
For more information on interruption levels [Click Here](https://community.home-assistant.io/t/728100/13)
'
default: active
selector:
select:
mode: dropdown
options:
- label: Default
value: active
- label: Critical Notifications
value: critical
- label: Time Sensitive Notifications
value: time-sensitive
- label: Quiet Notifications Without Waking Screen
value: passive
custom_value: false
sort: false
multiple: false
notify_data:
name: Android Only Options (Optional)
description: '**High Priority** notifications ensure that you receive important
alerts immediately. These notifications bypass normal delivery delays
and are delivered instantly to your device.
**Sticky Notification** ensure that important alerts are not dismissed
when selected. They remain on your notification screen until you actively
clear or swipe them away, ensuring that critical information stays visible
until addressed.
**Notification Channel** allow you to easily organize different notification
settings, including notification sounds, vibrations, and other device-specific
features. If you choose this option, please enter your desired channel
name below.
'
default: []
selector:
select:
multiple: true
options:
- label: High Priority
value: high_priority
- label: Sticky Notification
value: sticky
- label: Notification Channel
value: channel
custom_value: false
sort: false
notify_channel:
name: Notification Channel - Android Only
description: 'If you have chosen to use a notification channel, simply enter
the name of an existing channel to apply its pre-configured settings.
If you don''t have a channel yet, you can create a new one by entering
a name here. When your automation sends the first notification, it will
create the channel on your device. After the channel is created, you can
customize its notification settings to your preference directly on your
device.
For more information on notification channels [Click Here](https://community.home-assistant.io/t/728100/13)
'
default: []
selector:
text: {}
persistent_notify_settings:
name: Notifications
icon: mdi:bell-outline
collapsed: true
input:
include_persistent_notification:
name: Use The UI Notification Option (Optional)
description: "Enabling this option will display notifications directly within
the Home Assistant user interface (UI). \n"
default: disabled_persistent_notification
selector:
select:
options:
- label: Enable UI Notifications
value: enable_persistent_notification
- label: Disable UI Notifications
value: disabled_persistent_notification
custom_value: false
sort: false
multiple: false
persistent_title:
name: Title
description: 'Enter in the title of your UI notification.
'
default: "\U0001F4E2 Enter UI Title Here"
selector:
text: {}
persistent_message:
name: Message
description: 'Enter in the message of your UI notification.
'
default: "Enter UI Message Here \U0001F642"
selector:
text: {}
tts_notify_settings:
name: Text-to-Speech Announcement
icon: mdi:bullhorn-outline
collapsed: true
input:
include_tts_announcement:
name: Use The Text-to-Speech Announcement Option (Optional)
description: 'Enabling this option will send a Text-to-Speech notification
to the selected Media Players below.
'
default: disable_tts_announcement
selector:
select:
options:
- label: Enable Text-to-Speech Announcements
value: enable_tts_announcement
- label: Disable Text-to-Speech Announcements
value: disable_tts_announcement
custom_value: false
sort: false
multiple: false
text_to_speech_engine:
name: Text-to-Speech Service Provider
description: 'Select the Text-to-Speech service provider.
'
default: []
selector:
entity:
domain:
- tts
multiple: false
media_player:
name: Media Player
description: 'Select the Media Player/s that will play your Text-to-Speech
announcement message.
'
default: []
selector:
entity:
domain:
- media_player
multiple: true
notify_tts_message:
name: Announcement Message
description: 'Enter in the message of your Text-to-Speech announcement.
'
default: Enter TTS Message Here
selector:
text:
multiline: true
multiple: false
time_settings:
name: Time
icon: mdi:clock-outline
collapsed: true
input:
include_time:
name: Use The Time Options (Optional)
description: 'Use the "Start Time", **End Time** and the **Weekdays** values
to only run the automation between the time periods. This option allows
you to disable the automation during sleeping hours to avoid disturbing
anyone. Another example is setting the time between 5pm and 9pm for the
''Dinner is Ready'' call. This way, if you accidentally activate the trigger
outside these hours, the automation will not run.
'
default: time_disabled
selector:
select:
options:
- label: Enable the time options
value: time_enabled
- label: Disable the time options
value: time_disabled
custom_value: false
sort: false
multiple: false
after_time:
name: Start Time
description: 'Set the start time.
'
default: 00:00:00
selector:
time: {}
before_time:
name: End Time
description: 'Set the end time.
'
default: 00:00:00
selector:
time: {}
weekday_options:
name: Weekdays
description: 'Select the days of the week you would like the automation
to run. You must select "Enable the time options" above for the weekdays
selections to work.
'
default:
- mon
- tue
- wed
- thu
- fri
- sat
- sun
selector:
select:
multiple: true
mode: list
options:
- label: Monday
value: mon
- label: Tuesday
value: tue
- label: Wednesday
value: wed
- label: Thursday
value: thu
- label: Friday
value: fri
- label: Saturday
value: sat
- label: Sunday
value: sun
custom_value: false
sort: false
global_conditions_settings:
name: Global Conditions
icon: mdi:earth
collapsed: true
input:
global_conditions:
name: Global Conditions
description: 'Enter any global conditions you would like to apply to the
automation.
'
default: []
selector:
condition: {}
source_url: https://gist.github.com/Blackshome/180ca4a24af81cd5d843acfc039039bc
mode: single
max_exceeded: silent
variables:
trigger_state: !input trigger_state
trigger_state_entity: !input trigger_state_entity
trigger_numeric_entity: !input trigger_numeric_entity
above_state: !input above_state
below_state: !input below_state
time_delay_state: !input time_delay_state
include_notify: !input include_notify
notify_device: !input notify_device
notify_title: !input notify_title
notify_message: !input notify_message
notify_interruption_level: !input notify_interruption_level
notify_data: !input notify_data
notify_channel: !input notify_channel
include_persistent_notification: !input include_persistent_notification
persistent_title: !input persistent_title
persistent_message: !input persistent_message
include_tts_announcement: !input include_tts_announcement
text_to_speech_engine: !input text_to_speech_engine
media_player: !input media_player
notify_tts_message: !input notify_tts_message
include_time: !input include_time
after_time: !input after_time
before_time: !input before_time
weekday_options: !input weekday_options
global_conditions: !input global_conditions
device_message_data: "{% set message = namespace(data={}) %} {% if notify_interruption_level
in ['active', 'critical', 'time-sensitive', 'passive'] %}\n {% set message.data
= dict(message.data, **{ 'push': {'interruption-level': notify_interruption_level
}}) %}\n{% endif %} {% if 'high_priority' in notify_data %}\n {% set message.data
= dict(message.data, **{ 'ttl': 0, 'priority': 'high' }) %}\n{% endif %} {% if
'channel' in notify_data %}\n {% set message.data = dict(message.data, **{ 'channel':
notify_channel }) %}\n{% endif %} {% if 'sticky' in notify_data %}\n {% set message.data
= dict(message.data, **{ 'sticky': \"true\" }) %}\n{% endif %} {{ message.data
}}"
trigger:
- platform: state
id: t0
entity_id: !input trigger_state_entity
for: !input time_delay_state
- platform: state
id: t1
entity_id: !input trigger_state_entity
to: !input trigger_state
for: !input time_delay_state
- platform: numeric_state
id: t2
entity_id: !input trigger_numeric_entity
above: !input above_state
for: !input time_delay_state
- platform: numeric_state
id: t3
entity_id: !input trigger_numeric_entity
below: !input below_state
for: !input time_delay_state
condition:
- condition: or
conditions:
- condition: and
conditions:
- condition: trigger
id: t0
- '{{ trigger_state == ''button_any_state'' }}'
- condition: and
conditions:
- condition: trigger
id: t1
- '{{ (trigger_state != ''button_any_state'') or (trigger_state != ''numeric_state_above'')
or (trigger_state != ''numeric_state_below'') or (trigger_state != ''numeric_state_above_below'')
}}'
- condition: and
conditions:
- condition: trigger
id: t2
- '{{ (trigger_state == ''numeric_state_above'') or (trigger_state == ''numeric_state_above_below'')
}}'
- condition: and
conditions:
- condition: trigger
id: t3
- '{{ (trigger_state == ''numeric_state_below'') or (trigger_state == ''numeric_state_above_below'')
}}'
- condition: or
conditions:
- '{{ include_time == ''time_disabled'' }}'
- condition: and
conditions:
- condition: time
after: !input after_time
before: !input before_time
weekday: !input weekday_options
- '{{ include_time == ''time_enabled'' }}'
- condition: and
conditions: !input global_conditions
action:
- choose:
- alias: Check if notification is enabled
conditions:
- '{{ include_notify == ''enable_mobile_app_notify'' }}'
sequence:
- alias: Send a notification to each device
repeat:
for_each: !input notify_device
sequence:
- service: notify.mobile_app_{{ device_attr(repeat.item, 'name') | slugify
}}
data:
title: !input notify_title
message: !input notify_message
data: '{{ device_message_data }}'
- choose:
- alias: Use the persistent notification is enabled
conditions:
- condition: template
value_template: '{{ include_persistent_notification == ''enable_persistent_notification''
}}'
sequence:
- service: persistent_notification.create
data:
title: !input persistent_title
message: !input persistent_message
- choose:
- alias: Check if tts announcement is enabled
conditions:
- '{{ include_tts_announcement == ''enable_tts_announcement'' }}'
sequence:
- service: tts.speak
target:
entity_id: !input text_to_speech_engine
data:
media_player_entity_id: !input media_player
message: !input notify_tts_message
@@ -0,0 +1,103 @@
blueprint:
name: Press Button - Turn ON & OFF Entities
description: "# \U0001F9FF Press Button - Turn ON & OFF Entities\n**Version: 1.0**\n\nLet
us know what you think of this blueprint and for community support including updates:
[Click Here](https://community.home-assistant.io/t/press-button-turn-on-off-entities/634488)\n\n**The
Automation Process:**\n - When you press the button it will turn ON the main
entity input.\n - When you press the button again it will turn OFF the main entity
input.\n - You have the option to input an alternating entity that will be the
opposite state to the main entity.\n\n**NOTE** - The button must have no state,
like a button helper.\n\nRequired = *\n\nNeed help? See our FAQ: [Click Here](https://community.home-assistant.io/t/press-button-turn-on-off-entities/634488/2?u=blacky)\n\n**If
you like my blueprints, and would like to show your support or just say thank
you?** [Click Here](https://www.paypal.com/donate/?hosted_button_id=WAZS3QSDTPGA8)
\U0001F642\n"
domain: automation
input:
press_button:
name: Press Button *
description: The press button that controls the entities.
selector:
entity: {}
main_entity:
name: Main Entity *
description: The main entity that will be turned ON when the button is pressed.
selector:
entity:
multiple: true
alternating_entity:
name: Alternating Entity (optional)
description: The alternating entity that will be the opposite state to the main
entity when the button is pressed.
default: []
selector:
entity:
multiple: true
source_url: https://gist.github.com/Blackshome/ca6be121c8d3e4404e33114fc88b599a
variables:
press_button: !input press_button
main_entity: !input main_entity
alternating_entity: !input alternating_entity
trigger:
- platform: state
entity_id: !input press_button
action:
- choose:
- alias: Check if any alternating entity are enter in
conditions:
- '{{ alternating_entity == [] }}'
sequence:
- choose:
- alias: Check any main entities are on
conditions:
- condition: state
entity_id: !input main_entity
match: any
state: 'on'
sequence:
- alias: Turn OFF the main entities
service: homeassistant.turn_off
target:
entity_id: !input main_entity
- alias: Check all main entities are off
conditions:
- condition: state
entity_id: !input main_entity
match: all
state: 'off'
sequence:
- alias: Turn ON the main entities
service: homeassistant.turn_on
target:
entity_id: !input main_entity
default:
- choose:
- alias: Check any main entities are on
conditions:
- condition: state
entity_id: !input main_entity
match: any
state: 'on'
sequence:
- alias: Turn ON the main entities
service: homeassistant.turn_off
target:
entity_id: !input main_entity
- alias: Turn ON the alternating entity entities
service: homeassistant.turn_on
target:
entity_id: !input alternating_entity
- alias: Check all main entities are off
conditions:
- condition: state
entity_id: !input main_entity
match: all
state: 'off'
sequence:
- alias: Turn OFF the main entities
service: homeassistant.turn_on
target:
entity_id: !input main_entity
- alias: Turn OFF the alternating entity entities
service: homeassistant.turn_off
target:
entity_id: !input alternating_entity
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+307
View File
@@ -0,0 +1,307 @@
blueprint:
name: Timer
description: "# ⏲️ Timer\n**Version: 1.2**\n\nEffortless Control: Schedule \U0001F4C5,
Trigger ⚡, and Automate Your Home \U0001F3E0 with Precision \U0001F3AF!\n\n**If
you like my blueprints, and would like to show your support or just say thank
you?** [Click Here](https://www.paypal.com/donate/?hosted_button_id=WAZS3QSDTPGA8)
\U0001F642\n\n<details> <summary><b>The Automation Process:</b> \U0001F448</summary>\n\n
\ - **Automation:**\n - Turn ON and OFF any entity you like on a set time.\n
\ - You must use a timer helper for this automation to work.\n\n - **Multiple
Timers:**\n - You can set up to 4 different time triggers, each with its own
time period.\n\n - **Weekdays Condition Option:**\n - Specify the weekdays
to define when the automation can run.\n</details>\n\nNeed help? \n- FAQ: [Click
Here](https://community.home-assistant.io/t/time-clock/651151/2)\n- Community
Support Including Updates: [Click Here](https://community.home-assistant.io/t/time-clock/651151)\n\nRequired
= *\n"
domain: automation
input:
settings:
name: Settings *
icon: mdi:cog-outline
collapsed: true
input:
timer_helper:
name: Timer - Timer Helper *
description: 'Select the timer helper to be used for all timers. Using a
timer helper provides flexibility to start, pause, and cancel timers,
persistence across reboots, and real-time monitoring, making your automations
more robust and adaptable.
For more information on how to create a timer helper [Click Here](https://community.home-assistant.io/t/651151/4?u=blacky)'
default: []
selector:
entity:
filter:
- domain:
- timer
multiple: false
entity_input:
name: Entities To Turn ON *
description: Specify the entities that will be turned ON by a start time
and OFF after the set duration.
default: []
selector:
target: {}
triggers:
name: Triggers
icon: mdi:clock-outline
collapsed: true
input:
trigger_one_time:
name: Timer One - Start Time
description: Set the start time.
default: 00:00:00
selector:
time: {}
trigger_one_duration:
name: Timer One - Duration
description: Set the duration for Timer One.
default: 00:00:00
selector:
duration: {}
include_extra_triggers:
name: Use The Extra Timers (Optional)
description: Select any additional timers you want to include.
default: []
selector:
select:
multiple: true
options:
- label: Use timer two
value: use_trigger_two
- label: Use timer three
value: use_trigger_three
- label: Use timer four
value: use_trigger_four
sort: false
custom_value: false
trigger_two_time:
name: Timer Two - Start Time
description: Set the start time.
default: 00:00:00
selector:
time: {}
trigger_two_duration:
name: Timer Two - Duration
description: Set the duration for Timer Two.
default: 00:00:00
selector:
duration: {}
trigger_three_time:
name: Timer Three - Start Time
description: Set the start time.
default: 00:00:00
selector:
time: {}
trigger_three_duration:
name: Timer Three - Duration
description: Set the duration for Timer Three.
default: 00:00:00
selector:
duration: {}
trigger_four_time:
name: Timer Four - Start Time
description: Set the start time.
default: 00:00:00
selector:
time: {}
trigger_four_duration:
name: Timer Four - Duration
description: Set the duration for Timer Four.
default: 00:00:00
selector:
duration: {}
weekdays:
name: Weekdays
icon: mdi:calendar-week
collapsed: true
input:
include_weekdays:
name: Use The Weekdays Option (Optional)
description: This option adds a condition to operate only on specified weekdays.
It applies globally to all start times.
default: weekday_disabled
selector:
select:
options:
- label: Enable the weekday option
value: weekday_enabled
- label: Disable the weekday option
value: weekday_disabled
sort: false
custom_value: false
multiple: false
weekday_options:
name: Weekdays
description: Select the days of the week on which you want the automation
to run.
default:
- mon
- tue
- wed
- thu
- fri
- sat
- sun
selector:
select:
multiple: true
mode: list
options:
- label: Monday
value: mon
- label: Tuesday
value: tue
- label: Wednesday
value: wed
- label: Thursday
value: thu
- label: Friday
value: fri
- label: Saturday
value: sat
- label: Sunday
value: sun
sort: false
custom_value: false
source_url: https://gist.github.com/Blackshome/ec0afd31dce7fc6b106e378d06b01940
mode: restart
max_exceeded: silent
variables:
trigger_one_duration: !input trigger_one_duration
entity_input: !input entity_input
timer_helper: !input timer_helper
trigger_one_time: !input trigger_one_time
include_extra_triggers: !input include_extra_triggers
trigger_two_time: !input trigger_two_time
trigger_two_duration: !input trigger_two_duration
trigger_three_time: !input trigger_three_time
trigger_three_duration: !input trigger_three_duration
trigger_four_time: !input trigger_four_time
trigger_four_duration: !input trigger_four_duration
include_weekdays: !input include_weekdays
weekday_options: !input weekday_options
trigger:
- platform: time
at: !input trigger_one_time
id: t1
- platform: time
at: !input trigger_two_time
id: t2
- platform: time
at: !input trigger_three_time
id: t3
- platform: time
at: !input trigger_four_time
id: t4
- platform: state
entity_id: !input timer_helper
to: idle
id: t5
condition:
- condition: or
conditions:
- condition: and
conditions:
- condition: trigger
id:
- t1
- condition: and
conditions:
- condition: trigger
id: t2
- '{{ ''use_trigger_two'' in include_extra_triggers }}'
- condition: and
conditions:
- condition: trigger
id: t3
- '{{ ''use_trigger_three'' in include_extra_triggers }}'
- condition: and
conditions:
- condition: trigger
id: t4
- '{{ ''use_trigger_four'' in include_extra_triggers }}'
- condition: and
conditions:
- condition: trigger
id: t5
- condition: or
conditions:
- '{{ include_weekdays == ''weekday_disabled'' }}'
- condition: and
conditions:
- condition: time
weekday: !input weekday_options
- '{{ include_weekdays == ''weekday_enabled'' }}'
- condition: trigger
id:
- t5
action:
- choose:
- alias: Check if the time helper is enabled
conditions:
- condition: trigger
id:
- t1
- t2
- t3
- t4
sequence:
- alias: Turn ON the entities
service: homeassistant.turn_on
target: !input entity_input
- choose:
- alias: By-pass is turned on & check by-pass option - turn lights off
conditions:
- condition: trigger
id:
- t1
sequence:
- alias: Turn ON the timer helper
service: timer.start
entity_id: !input timer_helper
data:
duration: !input trigger_one_duration
- alias: By-pass is turned on & check by-pass option - turn lights off
conditions:
- condition: trigger
id:
- t2
sequence:
- alias: Turn ON the timer helper
service: timer.start
entity_id: !input timer_helper
data:
duration: !input trigger_two_duration
- alias: By-pass is turned on & check by-pass option - turn lights off
conditions:
- condition: trigger
id:
- t3
sequence:
- alias: Turn ON the timer helper
service: timer.start
entity_id: !input timer_helper
data:
duration: !input trigger_three_duration
- alias: By-pass is turned on & check by-pass option - turn lights off
conditions:
- condition: trigger
id:
- t4
sequence:
- alias: Turn ON the timer helper
service: timer.start
entity_id: !input timer_helper
data:
duration: !input trigger_four_duration
- alias: Turn OFF entities after the timer helper is finished
conditions:
- condition: trigger
id:
- t5
sequence:
- alias: Turn OFF the entities
service: homeassistant.turn_off
target: !input entity_input
@@ -0,0 +1,251 @@
blueprint:
name: Aqara Buttons All-In-One [Zigbee2MQTT]
description: 'All-In-One package for Aqara Switches.
Supports: WXKG11LM, WXKG12LM, WXKG03LM, WXKG06LM, WXKG07LM, WXKG02LM, QBKG03LM,
QBKG04LM, QBKG11LM, QBKG12LM, QBKG21LM, QBKG22LM, QBKG25LM, etc..).
Does not supports Opple.
Some actions may be unsupported by your switch. Check the available actions of
your device on zigbee2mqtt.io.
'
domain: automation
input:
action_sensor:
name: Action Sensor
description: Zigbee2mqtt action sensor
selector:
entity:
integration: mqtt
domain:
- sensor
multiple: false
single_action:
name: Single Click
description: Single click for devices with one button
default: []
selector:
action: {}
double_action:
name: Double Click
description: Double click for devices with one button
default: []
selector:
action: {}
triple_action:
name: Triple Click
description: Triple click for devices with one button
default: []
selector:
action: {}
quadruple_action:
name: Quadruple Click
description: Triple click for devices with one button
default: []
selector:
action: {}
hold_action:
name: Hold Action
description: Hold action for devices with one button
default: []
selector:
action: {}
release_action:
name: Release Action
description: Release action for devices with one button
default: []
selector:
action: {}
shake_action:
name: Shake Action
description: Shake action for devices with one button
default: []
selector:
action: {}
single_left_action:
name: Single Left Click
description: Left click for devices with multiple buttons
default: []
selector:
action: {}
double_left_action:
name: Double Left Click
description: Double left click for devices with multiple buttons
default: []
selector:
action: {}
triple_left_action:
name: Triple Left Click
description: Triple left click for devices with multiple buttons
default: []
selector:
action: {}
hold_left_action:
name: Hold Left Action
description: Hold left action for devices with multiple buttons
default: []
selector:
action: {}
release_left_action:
name: Release Left Action
description: Release left action for devices with multiple buttons
default: []
selector:
action: {}
single_center_action:
name: Single Center Click
description: Center click for devices with three buttons
default: []
selector:
action: {}
double_center_action:
name: Double Center Click
description: Double center click for devices with three buttons
default: []
selector:
action: {}
triple_center_action:
name: Triple Center Click
description: Triple center click for devices with three buttons
default: []
selector:
action: {}
hold_center_action:
name: Hold Center Action
description: Hold center action for devices with three buttons
default: []
selector:
action: {}
release_center_action:
name: Release Center Action
description: Release center action for devices with three buttons
default: []
selector:
action: {}
single_right_action:
name: Single Right Click
description: Right click for devices with multiple buttons
default: []
selector:
action: {}
double_right_action:
name: Double Right Click
description: Double right click for devices with multiple buttons
default: []
selector:
action: {}
triple_right_action:
name: Triple Right Click
description: Triple right click for devices with multiple buttons
default: []
selector:
action: {}
hold_right_action:
name: Hold Right Action
description: Hold right action for devices with multiple buttons
default: []
selector:
action: {}
release_right_action:
name: Release Right Action
description: Release right action for devices with multiple buttons
default: []
selector:
action: {}
single_both_action:
name: Single Both Click
description: Both click for devices with multiple buttons
default: []
selector:
action: {}
double_both_action:
name: Double Both Click
description: Double both click for devices with multiple buttons
default: []
selector:
action: {}
triple_both_action:
name: Triple Both Click
description: Triple both click for devices with multiple buttons
default: []
selector:
action: {}
hold_both_action:
name: Hold Both Action
description: Hold both action for devices with multiple buttons
default: []
selector:
action: {}
release_both_action:
name: Release Both Action
description: Release both action for devices with multiple buttons
default: []
selector:
action: {}
source_url: https://community.home-assistant.io/t/aqara-buttons-all-in-one-zigbee2mqtt/268717
mode: parallel
max_exceeded: silent
trigger:
platform: state
entity_id: !input action_sensor
action:
- variables:
command: '{{ trigger.to_state.attributes.action if trigger.to_state.state == ""
else trigger.to_state.state }}'
- choose:
- conditions: '{{ command == ''single'' }}'
sequence: !input single_action
- conditions: '{{ command == ''double'' }}'
sequence: !input double_action
- conditions: '{{ command == ''triple'' }}'
sequence: !input triple_action
- conditions: '{{ command == ''quadruple'' }}'
sequence: !input quadruple_action
- conditions: '{{ command == ''hold'' }}'
sequence: !input hold_action
- conditions: '{{ command == ''release'' }}'
sequence: !input release_action
- conditions: '{{ command == ''shake'' }}'
sequence: !input shake_action
- conditions: '{{ command == ''single_left'' }}'
sequence: !input single_left_action
- conditions: '{{ command == ''double_left'' }}'
sequence: !input double_left_action
- conditions: '{{ command == ''triple_left'' }}'
sequence: !input triple_left_action
- conditions: '{{ command == ''hold_left'' }}'
sequence: !input hold_left_action
- conditions: '{{ command == ''release_left'' }}'
sequence: !input release_left_action
- conditions: '{{ command == ''single_center'' }}'
sequence: !input single_center_action
- conditions: '{{ command == ''double_center'' }}'
sequence: !input double_center_action
- conditions: '{{ command == ''triple_center'' }}'
sequence: !input triple_center_action
- conditions: '{{ command == ''hold_center'' }}'
sequence: !input hold_center_action
- conditions: '{{ command == ''release_center'' }}'
sequence: !input release_center_action
- conditions: '{{ command == ''single_right'' }}'
sequence: !input single_right_action
- conditions: '{{ command == ''double_right'' }}'
sequence: !input double_right_action
- conditions: '{{ command == ''triple_right'' }}'
sequence: !input triple_right_action
- conditions: '{{ command == ''hold_right'' }}'
sequence: !input hold_right_action
- conditions: '{{ command == ''release_right'' }}'
sequence: !input release_right_action
- conditions: '{{ command == ''single_both'' }}'
sequence: !input single_both_action
- conditions: '{{ command == ''double_both'' }}'
sequence: !input double_both_action
- conditions: '{{ command == ''triple_both'' }}'
sequence: !input triple_both_action
- conditions: '{{ command == ''hold_both'' }}'
sequence: !input hold_both_action
- conditions: '{{ command == ''release_both'' }}'
sequence: !input release_both_action
+628
View File
@@ -0,0 +1,628 @@
blueprint:
name: Hook - Light
description: "# Hook - Light\n\nHook automation which allows to control a light.
Supports brightness and color control both for white temperature and rgb lights.
Features may vary depending on the selected Controller.\n\nAn automation created
with this blueprint must be linked to a [Controller](https://epmatt.github.io/awesome-ha-blueprints/blueprints/controllers)
automation.\nControllers are blueprints which allow to easily integrate a wide
range of controllers (wall switches, remotes, dimmers, etc.) and use them to run
a set of actions when interacting with them.\nThey expose an abstract interface
used by Hooks to create controller-based automations.\n\nA list of controllers
supported by this hook is available [here](https://epmatt.github.io/awesome-ha-blueprints/docs/blueprints/hooks/light#supported-controllers).\n\n\U0001F4D5
Full documentation regarding this blueprint is available [here](https://epmatt.github.io/awesome-ha-blueprints/docs/blueprints/hooks/light).\n\n\U0001F680
This blueprint is part of the **[Awesome HA Blueprints](https://epmatt.github.io/awesome-ha-blueprints)
project**.\n\n️ Version 2022.07.30\n"
source_url: https://raw.githubusercontent.com/EPMatt/awesome-ha-blueprints/main/blueprints/hooks/light/light.yaml
domain: automation
input:
controller_device:
name: (Required) Controller Device
description: The controller device which will control the Light. Choose a value
only if the integration used to connect the controller to Home Assistant exposes
it as a Device. This value should match the one specified in the corresponding
Controller automation.
default: ''
selector:
device: {}
controller_entity:
name: (Required) Controller Entity
description: The controller entity which will control the Light. Choose a value
only if the integration used to connect the controller to Home Assistant exposes
it as an Entity. This value should match the one specified in the corresponding
Controller automation.
default: ''
selector:
entity:
domain:
- sensor
multiple: false
controller_model:
name: (Required) Controller model
description: The model for the controller used in this automation. Choose a
value from the list of supported controllers.
selector:
select:
options:
- IKEA E1524/E1810 TRÅDFRI Wireless 5-Button Remote
- IKEA E1743 TRÅDFRI On/Off Switch & Dimmer
- IKEA E1743 TRÅDFRI On/Off Switch & Dimmer (#2)
- IKEA E1744 SYMFONISK Rotary Remote
- IKEA E1766 TRÅDFRI Open/Close Remote
- IKEA E1766 TRÅDFRI Open/Close Remote (#2)
- IKEA E1812 TRÅDFRI Shortcut button
- IKEA E2001/E2002 STYRBAR Remote control
- IKEA E2001/E2002 STYRBAR Remote control (#2)
- IKEA ICTC-G-1 TRÅDFRI wireless dimmer
- OSRAM AC025XX00NJ SMART+ Switch Mini
- Philips 324131092621 Hue Dimmer switch
- Philips 8718699693985 Hue Smart Button
- Philips 929002398602 Hue Dimmer switch v2
- SONOFF SNZB-01 Wireless Switch
- Xiaomi WXCJKG11LM Aqara Opple 2 button remote
- Xiaomi WXCJKG12LM Aqara Opple 4 button remote
- Xiaomi WXCJKG12LM Aqara Opple 4 button remote (#2)
- Xiaomi WXCJKG13LM Aqara Opple 6 button remote
- Xiaomi WXCJKG13LM Aqara Opple 6 button remote (#2)
- Xiaomi WXCJKG13LM Aqara Opple 6 button remote (#3)
- Xiaomi WXKG11LM Aqara Wireless Switch Mini
sort: false
custom_value: false
multiple: false
light:
name: (Required) Light
description: Light which will be controlled with this automation.
selector:
entity:
domain:
- light
multiple: false
light_color_mode:
name: (Optional) Light color mode
description: Specify how the controller will set the light color. Choose "Color
Temperature" and "Hue - Saturation" depending on the features supported by
your light. If you are not sure you can select "Auto". "None" will disable
color control features.
default: Auto
selector:
select:
options:
- Auto
- Color Temperature
- Hue - Saturation
- None
sort: false
custom_value: false
multiple: false
light_transition:
name: (Optional) Light Transition
description: Number that represents the time (in milliseconds) the light should
take turn on or off, if the light supports it.
default: 250
selector:
number:
min: 0.0
max: 60000.0
step: 1.0
unit_of_measurement: milliseconds
mode: box
min_brightness:
name: (Optional) Light minimum brightness
description: The minimum brightness the light can be set with this automation.
default: 1
selector:
number:
min: 1.0
max: 255.0
step: 1.0
unit_of_measurement: brightness
mode: slider
max_brightness:
name: (Optional) Light maximum brightness
description: The maximum brightness the light can be set with this automation.
default: 255
selector:
number:
min: 0.0
max: 255.0
step: 1.0
unit_of_measurement: brightness
mode: slider
brightness_steps_short:
name: (Optional) Light brightness steps - short actions
description: Number of steps from min to max brightness when controlling brightness
with short actions (eg. button press).
default: 10
selector:
number:
min: 1.0
max: 255.0
step: 1.0
unit_of_measurement: steps
mode: box
brightness_steps_long:
name: (Optional) Light brightness steps - long actions
description: Number of steps from min to max brightness when controlling brightness
with long actions (eg. button hold or controller rotation).
default: 10
selector:
number:
min: 1.0
max: 255.0
step: 1.0
unit_of_measurement: steps
mode: box
force_brightness:
name: (Optional) Force brightness value at turn on
description: Force brightness to the "On brightness" input value, when the light
is being turned on.
default: false
selector:
boolean: {}
on_brightness:
name: (Optional) On brightness
description: Brightness value to force when turning on the light
default: 1
selector:
number:
min: 0.0
max: 255.0
step: 1.0
unit_of_measurement: brightness
mode: slider
smooth_power_on:
name: (Optional) Smooth power on
description: Force the light to turn on at minimum brightness when a brightness
up command (single or continuous) is triggered and light is off.
default: true
selector:
boolean: {}
smooth_power_off:
name: (Optional) Smooth power off
description: Allow a brightness down command (single or continuous) to turn
off the light when at minimum brightness. Disabling this will prevent the
light from being turned off by brightness down commands.
default: true
selector:
boolean: {}
variables:
controller_model: !input controller_model
controller_mapping:
IKEA E1524/E1810 TRÅDFRI Wireless 5-Button Remote:
brightness_up: button_up_short
brightness_up_repeat: button_up_long
brightness_down: button_down_short
brightness_down_repeat: button_down_long
color_down: button_left_short
color_down_repeat: button_left_long
color_up: button_right_short
color_up_repeat: button_right_long
toggle: button_center_short
IKEA E1743 TRÅDFRI On/Off Switch & Dimmer:
turn_on: button_up_short
brightness_up_repeat: button_up_long
color_up: button_up_double
turn_off: button_down_short
brightness_down_repeat: button_down_long
color_down: button_down_double
IKEA E1743 TRÅDFRI On/Off Switch & Dimmer (#2):
brightness_up: button_up_short
brightness_up_repeat: button_up_long
turn_on: button_up_double
brightness_down: button_down_short
brightness_down_repeat: button_down_long
turn_off: button_down_double
IKEA E1744 SYMFONISK Rotary Remote:
brightness_down_repeat: rotate_left
brightness_up_repeat: rotate_right
toggle: click_short
color_up: click_double
color_down: click_triple
IKEA E1766 TRÅDFRI Open/Close Remote:
brightness_up: button_up_short
turn_on: button_up_double
brightness_down: button_down_short
turn_off: button_down_double
IKEA E1766 TRÅDFRI Open/Close Remote (#2):
brightness_up: button_up_short
color_up: button_up_double
brightness_down: button_down_short
color_down: button_down_double
IKEA E1812 TRÅDFRI Shortcut button:
toggle: button_short
color_up: button_double
IKEA E2001/E2002 STYRBAR Remote control:
turn_on: button_up_short
brightness_up_repeat: button_up_long
turn_off: button_down_short
brightness_down_repeat: button_down_long
color_down: button_left_short
color_down_repeat: button_left_long
color_up: button_right_short
color_up_repeat: button_right_long
IKEA E2001/E2002 STYRBAR Remote control (#2):
brightness_up: button_up_short
brightness_up_repeat: button_up_long
turn_on: button_up_double
brightness_down: button_down_short
brightness_down_repeat: button_down_long
turn_off: button_down_double
color_down: button_left_short
color_down_repeat: button_left_long
color_up: button_right_short
color_up_repeat: button_right_long
IKEA ICTC-G-1 TRÅDFRI wireless dimmer:
brightness_down_repeat: rotate_left
brightness_up_repeat: rotate_right
OSRAM AC025XX00NJ SMART+ Switch Mini:
brightness_up: button_up_short
brightness_up_repeat: button_up_long
color_up: button_up_double
brightness_down: button_down_short
brightness_down_repeat: button_down_long
color_down: button_down_double
toggle: button_center_short
Philips 324131092621 Hue Dimmer switch:
turn_on: button_on_short
color_up_repeat: button_on_long
turn_off: button_off_short
color_down_repeat: button_off_long
brightness_up: button_up_short
brightness_up_repeat: button_up_long
brightness_down: button_down_short
brightness_down_repeat: button_down_long
Philips 8718699693985 Hue Smart Button:
toggle: button_short
Philips 929002398602 Hue Dimmer switch v2:
turn_on: button_on_short
color_up_repeat: button_on_long
turn_off: button_off_short
color_down_repeat: button_off_long
brightness_up: button_up_short
brightness_up_repeat: button_up_long
brightness_down: button_down_short
brightness_down_repeat: button_down_long
SONOFF SNZB-01 Wireless Switch:
toggle: button_short
color_up: button_double
Xiaomi WXCJKG11LM Aqara Opple 2 button remote:
turn_on: button_1_short
brightness_up_repeat: button_1_long
color_up: button_1_double
turn_off: button_2_short
brightness_down_repeat: button_2_long
color_down: button_2_double
Xiaomi WXCJKG12LM Aqara Opple 4 button remote:
turn_on: button_1_short
brightness_up_repeat: button_1_long
color_up: button_1_double
turn_off: button_2_short
brightness_down_repeat: button_2_long
color_down: button_2_double
Xiaomi WXCJKG12LM Aqara Opple 4 button remote (#2):
turn_on: button_3_short
brightness_up_repeat: button_3_long
color_up: button_3_double
turn_off: button_4_short
brightness_down_repeat: button_4_long
color_down: button_4_double
Xiaomi WXCJKG13LM Aqara Opple 6 button remote:
turn_on: button_1_short
brightness_up_repeat: button_1_long
color_up: button_1_double
turn_off: button_2_short
brightness_down_repeat: button_2_long
color_down: button_2_double
Xiaomi WXCJKG13LM Aqara Opple 6 button remote (#2):
turn_on: button_3_short
brightness_up_repeat: button_3_long
color_up: button_3_double
turn_off: button_4_short
brightness_down_repeat: button_4_long
color_down: button_4_double
Xiaomi WXCJKG13LM Aqara Opple 6 button remote (#3):
turn_on: button_5_short
brightness_up_repeat: button_5_long
color_up: button_5_double
turn_off: button_6_short
brightness_down_repeat: button_6_long
color_down: button_6_double
Xiaomi WXKG11LM Aqara Wireless Switch Mini:
toggle: button_short
color_up: button_double
brightness_up: '{{ controller_mapping[controller_model]["brightness_up"] | default(None)
}}'
brightness_up_repeat: '{{ controller_mapping[controller_model]["brightness_up_repeat"]
| default(None) }}'
brightness_down: '{{ controller_mapping[controller_model]["brightness_down"] | default(None)
}}'
brightness_down_repeat: '{{ controller_mapping[controller_model]["brightness_down_repeat"]
| default(None) }}'
color_up: '{{ controller_mapping[controller_model]["color_up"] | default(None) }}'
color_up_repeat: '{{ controller_mapping[controller_model]["color_up_repeat"] | default(None)
}}'
color_down: '{{ controller_mapping[controller_model]["color_down"] | default(None)
}}'
color_down_repeat: '{{ controller_mapping[controller_model]["color_down_repeat"]
| default(None) }}'
toggle: '{{ controller_mapping[controller_model]["toggle"] | default(None) }}'
turn_on: '{{ controller_mapping[controller_model]["turn_on"] | default(None) }}'
turn_off: '{{ controller_mapping[controller_model]["turn_off"] | default(None) }}'
light_color_mode: !input light_color_mode
light: !input light
light_transition: !input light_transition
min_brightness: !input min_brightness
max_brightness: !input max_brightness
brightness_steps_short: !input brightness_steps_short
brightness_steps_long: !input brightness_steps_long
force_brightness: !input force_brightness
on_brightness: !input on_brightness
smooth_power_on: !input smooth_power_on
smooth_power_off: !input smooth_power_off
color_modes:
Auto: auto
Color Temperature: color_temp
Hue - Saturation: hs_color
None: none
light_color_mode_id: '{%- if light_color_mode == "Auto" -%} {% set supported_color_modes
= state_attr(light, "supported_color_modes") -%} {%- if "hs" in supported_color_modes
or "xy" in supported_color_modes or "rgbw" in supported_color_modes or "rgbww"
in supported_color_modes -%} {{ color_modes["Hue - Saturation"] }} {%- elif "color_temp"
in supported_color_modes -%} {{ color_modes["Color Temperature"] }} {%- else -%}
{{ color_modes["None"] }} {%- endif -%} {%- else -%} {{ color_modes[light_color_mode]
}} {%- endif -%}'
step_short: '{{ (max_brightness-min_brightness)/brightness_steps_short }}'
step_long: '{{ (max_brightness-min_brightness)/brightness_steps_long }}'
mode: restart
max_exceeded: silent
trigger:
- platform: event
event_type: ahb_controller_event
event_data:
controller: !input controller_device
- platform: event
event_type: ahb_controller_event
event_data:
controller: !input controller_entity
condition: []
action:
- variables:
action: '{{ trigger.event.data.action }}'
- choose:
- conditions: '{{ action == toggle }}'
sequence:
- choose:
- conditions: '{{ force_brightness }}'
sequence:
- service: light.toggle
entity_id: !input light
data:
brightness: !input on_brightness
transition: '{{ light_transition / 1000 }}'
default:
- service: light.toggle
entity_id: !input light
data:
transition: '{{ light_transition / 1000 }}'
- conditions: '{{ action == turn_on }}'
sequence:
- choose:
- conditions: '{{ force_brightness }}'
sequence:
- service: light.turn_on
entity_id: !input light
data:
brightness: !input on_brightness
transition: '{{ light_transition / 1000 }}'
default:
- service: light.turn_on
entity_id: !input light
data:
transition: '{{ light_transition / 1000 }}'
- conditions: '{{ action == turn_off }}'
sequence:
- service: light.turn_off
entity_id: !input light
data:
transition: '{{ light_transition / 1000 }}'
- conditions: '{{ action == brightness_up }}'
sequence:
- choose:
- conditions: '{{ states(light) == "off" and not smooth_power_on}}'
sequence:
- service: light.turn_on
data:
transition: '{{ light_transition / 1000 }}'
entity_id: !input light
- conditions: '{{ states(light) == "off" and smooth_power_on}}'
sequence:
- service: light.turn_on
data:
brightness: '{{ min_brightness }}'
transition: '{{ light_transition / 1000 }}'
entity_id: !input light
default:
- service: light.turn_on
data:
brightness: '{{ [ [state_attr(light,"brightness")+step_short, min_brightness]
| max, max_brightness] | min }}'
transition: 0.25
entity_id: !input light
- conditions: '{{ action == brightness_down and states(light) == "on" }}'
sequence:
- choose:
- conditions: '{{ smooth_power_off and state_attr(light,"brightness") == min_brightness
}}'
sequence:
- service: light.turn_off
data:
transition: '{{ light_transition / 1000 }}'
entity_id: !input light
default:
- service: light.turn_on
data:
brightness: '{{ [ [state_attr(light,"brightness")-step_short, min_brightness]
| max, max_brightness] | min }}'
transition: 0.25
entity_id: !input light
- conditions: '{{ action == brightness_up_repeat }}'
sequence:
- choose:
- conditions: '{{ states(light) == "off" and not smooth_power_on}}'
sequence:
- service: light.turn_on
data:
transition: '{{ light_transition / 1000 }}'
entity_id: !input light
- delay:
milliseconds: !input light_transition
- conditions: '{{ states(light) == "off" and smooth_power_on}}'
sequence:
- service: light.turn_on
data:
brightness: '{{ min_brightness }}'
transition: '{{ light_transition / 1000 }}'
entity_id: !input light
- delay:
milliseconds: !input light_transition
- repeat:
while: '{{ true }}'
sequence:
- service: light.turn_on
data:
brightness: '{{ [ [state_attr(light,"brightness")+step_long, min_brightness]
| max, max_brightness] | min }}'
transition: 0.25
entity_id: !input light
- delay:
milliseconds: 250
- conditions: '{{ action == brightness_down_repeat and states(light) == "on" }}'
sequence:
- choose:
- conditions: '{{ smooth_power_off }}'
sequence:
- repeat:
while: '{{ states(light) != "off" }}'
sequence:
- choose:
- conditions: '{{ state_attr(light,"brightness") == min_brightness }}'
sequence:
- service: light.turn_off
data:
transition: '{{ light_transition / 1000 }}'
entity_id: !input light
- delay:
milliseconds: !input light_transition
default:
- service: light.turn_on
data:
brightness: '{{ [ [state_attr(light,"brightness")-step_long, min_brightness]
| max, max_brightness] | min }}'
transition: 0.25
entity_id: !input light
- delay:
milliseconds: 250
default:
- repeat:
while: '{{ states(light) != "off" }}'
sequence:
- service: light.turn_on
data:
brightness: '{{ [ [state_attr(light,"brightness")-step_long, min_brightness]
| max, max_brightness] | min }}'
transition: 0.25
entity_id: !input light
- delay:
milliseconds: 250
- conditions: '{{ action == color_up and light_color_mode_id != "none" }}'
sequence:
choose:
- conditions: '{{ light_color_mode_id == "color_temp" }}'
sequence:
- service: light.turn_on
data:
color_temp: '{{ state_attr(light,"color_temp")|int + 50 }}'
transition: 0.25
entity_id: !input light
- conditions: '{{ light_color_mode_id == "hs_color" }}'
sequence:
- service: light.turn_on
data:
hs_color: '{{ [((state_attr(light,"hs_color")[0] or 0) + 15) % 360, 100]
}}'
transition: 0.25
entity_id: !input light
- conditions: '{{ action == color_down and light_color_mode_id != "none" }}'
sequence:
choose:
- conditions: '{{ light_color_mode_id == "color_temp" }}'
sequence:
- service: light.turn_on
data:
color_temp: '{{ [state_attr(light,"color_temp")|int - 50, 1]|max }}'
transition: 0.25
entity_id: !input light
- conditions: '{{ light_color_mode_id == "hs_color" }}'
sequence:
- service: light.turn_on
data:
hs_color: '{{ [((state_attr(light,"hs_color")[0] or 0) - 15) % 360, 100]
}}'
transition: 0.25
entity_id: !input light
- conditions: '{{ action == color_up_repeat and light_color_mode_id != "none" }}'
sequence:
choose:
- conditions: '{{ light_color_mode_id == "color_temp" }}'
sequence:
- repeat:
while: '{{ true }}'
sequence:
- service: light.turn_on
data:
color_temp: '{{ state_attr(light,"color_temp")|int + 50 }}'
transition: 0.25
entity_id: !input light
- delay:
milliseconds: 250
- conditions: '{{ light_color_mode_id == "hs_color" }}'
sequence:
- repeat:
while: '{{ true }}'
sequence:
- service: light.turn_on
data:
hs_color: '{{ [((state_attr(light,"hs_color")[0] or 0) + 15) % 360,
100] }}'
transition: 0.25
entity_id: !input light
- delay:
milliseconds: 250
- conditions: '{{ action == color_down_repeat and light_color_mode_id != "none"
}}'
sequence:
choose:
- conditions: '{{ light_color_mode_id == "color_temp" }}'
sequence:
- repeat:
while: '{{ true }}'
sequence:
- service: light.turn_on
data:
color_temp: '{{ [state_attr(light,"color_temp")|int - 50, 1]|max }}'
transition: 0.25
entity_id: !input light
- delay:
milliseconds: 250
- conditions: '{{ light_color_mode_id == "hs_color" }}'
sequence:
- repeat:
while: '{{ true }}'
sequence:
- service: light.turn_on
data:
hs_color: '{{ [((state_attr(light,"hs_color")[0] or 0) - 15) % 360,
100] }}'
transition: 0.25
entity_id: !input light
- delay:
milliseconds: 250
@@ -0,0 +1,67 @@
blueprint:
name: Report offline zigbee/zwave/battery/smart plug devices
description: Works with Smart Plugs, ZWave, Zigbee etc (Works with ZHA & Z2M)
domain: automation
input:
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
- switch
actions:
name: Actions
description: Call your notification here. {{offline_devices}} will replaced
with the name of any offline devices
selector:
action: {}
source_url: https://gist.github.com/Tahutipai/971bf0e07e50ce6190e0dacd73262e2e
variables:
day: !input day
exclude: !input exclude
offline_devices: "{% set result = namespace(offline_devices=[]) %} {% for sensor
in states.sensor | selectattr('attributes.device_class', 'defined') | selectattr('attributes.device_class',
'==', 'battery') %}\n {% if \"unavailable\" in sensor | string and not sensor.entity_id
in exclude.entity_id %}\n {% set result.offline_devices = result.offline_devices
+ [device_attr(device_id(sensor.entity_id), \"name\")] %}\n {% endif %}\n{% endfor
%} {% for binary_sensor in states.binary_sensor | selectattr('attributes.device_class',
'defined') | selectattr('attributes.device_class', '==', 'battery') %}\n {% if
\"unavailable\" in binary_sensor | string and not binary_sensor.entity_id in exclude.entity_id
%}\n {% set result.offline_devices = result.offline_devices + [device_attr(device_id(binary_sensor.entity_id),
\"name\")] %}\n {% endif %}\n{% endfor %} {% for switch in states.switch | selectattr('state','eq','unavailable')
%}\n {% if switch.entity_id not in exclude.entity_id %}\n {% set result.offline_devices
= result.offline_devices + [device_attr(device_id(switch.entity_id), \"name\")]
%}\n {% endif %}\n{% endfor %} {{result.offline_devices|sort|unique|join('\\n')}}"
trigger:
- platform: time
at: !input time
condition:
- '{{ offline_devices != '''' and (day | int == 0 or day | int == now().isoweekday())
}}'
action:
- choose: []
default: !input actions
mode: single
@@ -0,0 +1,932 @@
blueprint:
name: Home Assistant Auto-update on a schedule base
author: Edward Firmo (https://github.com/edwardtfn)
homeassistant:
min_version: 2024.8.0
description: '# Home Assistant Auto-update
Update Home Assistant automatically when a new update is available.
v2024.9.30.0
Attention:
* Home Assistant may restart automatically as part of the update process.
* **Use under your own risk!** Please see the discussions on Home Assistant community
around the risks involved on auto-updating the system.
For questions and suggestions, please use [this thread in Home Assistant Community
portal](https://community.home-assistant.io/t/scheduled-auto-update-for-home-assistant/459281).
'
domain: automation
source_url: https://raw.githubusercontent.com/edwardtfn/HomeAssistant-Config/main/blueprints/automation/EdwardTFN/auto_update_scheduled.yaml
input:
when_section:
name: When (Schedule, etc.)
icon: mdi:calendar
description: Select when the updates should happen and when it should be skipped.
collapsed: false
input:
schedule_entity:
name: Schedule entity
description: 'You can create an [Schedule](https://www.home-assistant.io/integrations/schedule)
under [Settings > Devices & Services > Helpers](https://my.home-assistant.io/redirect/config_flow_start/?domain=schedule).
Note => The schedule windows will define when an update will start. It
is possible that a backup, an update or a restart process finishes after
the schedule window, but new updates won''t stars outside the schedule
windows.'
default: []
selector:
entity:
multiple: false
domain:
- schedule
reorder: false
schedule_monthday:
name: Earliest day in the month to update Home Assistant (optional)
description: 'Usually a new major version of Home Assistant is available
on the begining of every month. Some people consider those releases as
not stable enough and prefer to avoid those versions, not updating the
system until the mid of the month (day 15).
Note => If you select a day higher than 28 the updates won''t run every
month.
'
default: 1
selector:
number:
min: 1.0
max: 31.0
step: 1.0
mode: slider
update_out_of_schedule:
name: Out of schedule entities (optional)
description: You can select update entities which will be updated as soon
an update is detected, even if outside the schedule windows.
default: []
selector:
entity:
multiple: true
domain:
- update
reorder: false
pause_entities:
name: Pause update entities (optional)
description: 'You can select one or more entities to pause the updates.
If any of the selected entities is "On" or "True" the system won''t be
updated on the schedule time.
You can use this to hold your updates when you have a party at home, or
when you are on vacations and don''t want to be concerned about updates
on Home Assistant.'
default: []
selector:
entity:
multiple: true
domain:
- input_boolean
- binary_sensor
- switch
reorder: false
what_section:
name: What (optional)
icon: mdi:update
description: Select what should be updated and what shouldn't be updated.
collapsed: true
input:
core_os_update_mode:
name: Update mode for Home Assistant core and OS updates
description: "Please select the update mode for Home Assistant core and
Home Assistan OS updates.\n* All: All updates will be installed.\n* Patches
only:\n ✅ From 2022.11.0 to 2022.11.3 will be updated (patches).\n ❌
From 2022.11.x to 2022.12.x will be ignored (minor update).\n ❌ From
2022.12.x to 2023.1.x will be ignored (major update).\n* Don't update:
Ignore any update.\n"
default: all
selector:
select:
multiple: false
options:
- label: All
value: all
- label: Patches only
value: patches
- label: Don't update
value: ignore
sort: false
custom_value: false
firmware_update_mode:
name: Update mode for device's firmware
description: "Please select the update mode for firmware in the devices
connected to Home Assistant (when supported as an HA update).\n* All:
All updates will be installed.\n* Patches only:\n ✅ From 2022.11.0 to
2022.11.3 will be updated (patches).\n ❌ From 2022.11.x to 2022.12.x
will be ignored (minor update).\n ❌ From 2022.12.x to 2023.1.x will be
ignored (major update).\n* Don't update: Ignore any update.\n"
default: all
selector:
select:
multiple: false
options:
- label: All
value: all
- label: Patches only
value: patches
- label: Don't update
value: ignore
sort: false
custom_value: false
general_update_mode:
name: Update mode for general updates
description: "Please select the update mode for everything that is not a
device's firmware or a core component of Home Assistant.\nThis includes
add-ons, HACS componentes, custom cards, etc.\n* All: All updates will
be installed.\n* Patches only:\n ✅ From 2022.11.0 to 2022.11.3 will be
updated (patches).\n ❌ From 2022.11.x to 2022.12.x will be ignored (minor
update).\n ❌ From 2022.12.x to 2023.1.x will be ignored (major update).\n*
Don't update: Ignore any update.\n"
default: all
selector:
select:
multiple: false
options:
- label: All
value: all
- label: Patches only
value: patches
- label: Don't update
value: ignore
sort: false
custom_value: false
update_exclusions:
name: Exclusions (optional)
description: 'Select the items that should NOT be included on the automated
updates.
=> Use this if you want to keep some add-on on an specific version and
avoid auto-updates to it.'
default: []
selector:
entity:
multiple: true
domain:
- update
reorder: false
backup_section:
name: Backup (optional)
icon: mdi:backup-restore
description: Select the back-up options
collapsed: true
input:
backup_bool:
name: Create a full backup before start the updates?
default: true
selector:
boolean: {}
backup_wait_time:
name: Backup wait time
description: 'Select how long the system should wait for the backup to be
completed after it is triggered.
Please make sure the schedule covers the waiting time, otherwise the update
will never be triggered after a backup.'
default: 60
selector:
number:
min: 0.0
max: 3600.0
step: 10.0
mode: box
unit_of_measurement: minutes
max_backup_age:
name: Maximum backup age (or zero, to disable) (optional)
description: This requires the [Google Drive Backup](https://github.com/sabeechen/hassio-google-drive-backup)
addon to be installed and configured to automatically backup, and provide
a sensor with the backup states. The setting only checks for the age of
the automatic backups from that addon, not the backups created internally
by this blueprint.
default:
days: 0
hours: 0
minutes: 0
seconds: 0
selector:
duration:
enable_day: true
actions_section:
name: Actions (optional)
icon: mdi:shoe-print
description: Select actions to run at diferent moments on the update process
collapsed: true
input:
actions_pre_update:
name: Pre-update actions (optional)
description: 'Actions to execute before the backup or any update starts.
You can use this to send notifications, turn on/off devices or activate
scenes before starting the updates.
Note => Please be aware that all actions will run right before the update
process, which can happens over-night. Take this in account when selecting
your actions.
Note => The variable "\{\{ updates_list \}\}" is available for your actions
and contains the list of pending updates.'
default: []
selector:
action: {}
actions_pre_restart:
name: Pre-restart actions (optional)
description: 'Actions to execute before the automation requests a restart.
You can use this to send notifications, turn on/off devices or stopping
automations before restarting Home Assistant.
Note => Please be aware that all actions will run right before the restart
process, which can happens over-night. Take this in account when selecting
your actions.
Note => Note all the restarts will be controlled by this automation, like
when a Core update is installed. These actions might not be executed in
those cases.
Note => The variable "\{\{ updates_list \}\}" is available for your actions
and contains the list of pending updates.'
default: []
selector:
action: {}
actions_pos_update:
name: Post-update actions (optional)
description: 'Actions to execute AFTER the update process finishes.
You can use this to send notifications, turn on/off devices or activate
scenes after applying the updates.
Note => Please be aware that all actions will run right after the update
process, which can happens over-night. Take this in account when selecting
your actions.
Note => The variable "\{\{ updates_list \}\}" is available for your actions
and contains the list of pending updates.
**IMPORTANT** => Some updates will automatically restart Home Assistant,
causing the automation to interrupt before finishing, preventing the pos-updates
actions to be executed. If you have critical actions to run after an update,
consider including also in another automation based on Home Assistant
start.
'
default: []
selector:
action: {}
general_settings:
name: General settings (optional)
icon: mdi:cog
description: Select additional settings to the update process
collapsed: true
input:
restart_type:
name: Force Home Assistant to restart if required by any update?
description: This won't affect updates where a restart is automatic, but
for updates requiring a manual restart (quite common on HACS) this blueprint
can automatically force a restart by the end of the updates.
default: no-restart
selector:
select:
multiple: false
options:
- label: Don't force a restart
value: no-restart
- label: Restart Home Assistant core
value: core
- label: Restart Home Assistant host
value: host
sort: false
custom_value: false
verbose_logging_bool:
name: Log addon progress with verbosity to the logbook? (optional)
default: false
selector:
boolean: {}
mode: single
max_exceeded: warning
trigger_variables:
input_update_exclusions: !input update_exclusions
input_update_out_of_schedule: !input update_out_of_schedule
updates_available: "{% set updates_available_obj =\n states.update\n | default([])\n
\ | selectattr(\"state\", \"eq\", \"on\")\n | rejectattr(\"entity_id\", \"in\",
input_update_exclusions)\n%} {{\n updates_available_obj | map(attributes=\"entity_id\")
| list\n if (updates_available_obj | list | count | int(0) > 0)\n else []\n}}\n"
trigger:
- id: HA Schedule based
platform: state
entity_id: !input schedule_entity
- id: HA Start
platform: homeassistant
event: start
- id: New update
platform: template
value_template: "{{\n states.update\n | default([])\n | selectattr(\"state\",
\"eq\", \"on\")\n | rejectattr(\"entity_id\", \"in\", input_update_exclusions)\n
\ | list | count | int(0) > 0\n}}"
- id: New day
platform: time
at: 00:00:01
- id: Automations reloaded
platform: event
event_type: automation_reloaded
- id: Pause entities changed
platform: state
entity_id: !input pause_entities
condition:
- condition: template
value_template: "{{\n states.update\n | default([])\n | selectattr(\"state\",
\"eq\", \"on\")\n | rejectattr(\"entity_id\", \"in\", input_update_exclusions)\n
\ | list | count | int(0) > 0\n}}"
- condition: or
conditions:
- condition: and
conditions:
- condition: template
value_template: '{{ now().day >= ((input_schedule_monthday) | int(0)) }}
'
- condition: state
entity_id: !input schedule_entity
state: 'on'
- condition: template
value_template: "{% set ns = namespace(found=false) %} {% for item in input_update_out_of_schedule
%}\n {% if item in updates_available %}\n {% set ns.found = true %}\n {%
break %}\n {% endif %}\n{% endfor %} {{ ns.found }}\n"
- condition: or
conditions:
- '{{ input_pause_entities | default([]) | list | count | int(0) < 1 }}'
- condition: state
entity_id: !input pause_entities
state: 'off'
variables:
input_schedule_monthday: !input schedule_monthday
input_pause_entities: !input pause_entities
temp_input_update_exclusions: !input update_exclusions
input_verbose_logging_bool: !input verbose_logging_bool
input_backup_bool: !input backup_bool
input_restart_type: !input restart_type
temp_max_backup_age: !input max_backup_age
input_max_backup_age_seconds: "{{\n timedelta(\n days=temp_max_backup_age.days,\n
\ hours=temp_max_backup_age.hours,\n minutes=temp_max_backup_age.minutes,\n
\ seconds=temp_max_backup_age.seconds\n ).total_seconds()\n}}\n"
input_core_os_update_mode: !input core_os_update_mode
input_firmware_update_mode: !input firmware_update_mode
input_general_update_mode: !input general_update_mode
updates_list: []
pending_updates_list: []
action:
- &id001
variables:
core_update_entity: "{% for u in integration_entities('hassio') | select('search',
'^update[.]')\n if (device_attr(u, 'identifiers') | first)[1] == 'core'
%}\n {{ u }}\n{% endfor %}\n"
os_update_entity: "{% for u in integration_entities('hassio') | select('search',
'^update[.]')\n if (device_attr(u, 'identifiers') | first)[1] == 'OS'
%}\n {{ u }}\n{% endfor %}\n"
supervisor_update_entity: "{% for u in integration_entities('hassio') | select('search',
'^update[.]')\n if (device_attr(u, 'identifiers') | first)[1] == 'supervisor'
%}\n {{ u }}\n{% endfor %}\n"
firmware_update_entities: "{{ states.update\n | default([])\n | selectattr('attributes.device_class',
'defined')\n | selectattr('attributes.device_class', 'eq', 'firmware')\n |
map(attribute='entity_id')\n | list\n}}\n"
general_update_entities: "{{ states.update\n | default([])\n | rejectattr('entity_id',
'in', core_update_entity)\n | rejectattr('entity_id', 'in', os_update_entity)\n
\ | rejectattr('entity_id', 'in', supervisor_update_entity)\n | rejectattr('entity_id',
'in', firmware_update_entities)\n | map(attribute='entity_id')\n | list\n}}\n"
input_update_exclusions: "{% set exclusions = temp_input_update_exclusions | default([])
%}\n{% if input_core_os_update_mode == 'ignore' %}\n {% set exclusions = exclusions
+ [core_update_entity | default(\"\"), os_update_entity | default(\"\")] %}\n{%
else %}\n {% set core_installed_version = states.update | default([]) | selectattr('entity_id',
'in', core_update_entity | default(\"\")) | map(attribute='attributes.installed_version')
| list | first | default('') %}\n {% set core_latest_version = states.update
| default([]) | selectattr('entity_id', 'in', core_update_entity | default(\"\"))
| map(attribute='attributes.latest_version') | list | first | default('') %}\n
\ {% set core_version_change = version(core_latest_version) - version(core_installed_version)
%}\n {% set os_installed_version = states.update | default([]) | selectattr('entity_id',
'in', os_update_entity | default(\"\")) | map(attribute='attributes.installed_version')
| list | first | default('') %}\n {% set os_latest_version = states.update
| default([]) | selectattr('entity_id', 'in', os_update_entity | default(\"\"))
| map(attribute='attributes.latest_version') | list | first | default('') %}\n
\ {% set os_version_change = version(os_latest_version) - version(os_installed_version)
%}\n\n {% if input_core_os_update_mode == 'patches' %}\n {% if core_version_change.major
or core_version_change.minor or (not core_version_change.patch) %}\n {%
set exclusions = exclusions + [core_update_entity | default(\"\")] %}\n {%
endif %}\n {% if os_version_change.major or os_version_change.minor or (not
os_version_change.patch) %}\n {% set exclusions = exclusions + [os_update_entity
| default(\"\")] %}\n {% endif %}\n {% elif input_core_os_update_mode ==
'major_and_minor' %}\n {% if (not core_version_change.major) and (not core_version_change.minor)
%}\n {% set exclusions = exclusions + [core_update_entity | default(\"\")]
%}\n {% endif %}\n {% if (not os_version_change.major) and (not os_version_change.minor)
%}\n {% set exclusions = exclusions + [os_update_entity | default(\"\")]
%}\n {% endif %}\n {% endif %}\n{% endif %}\n{% if input_firmware_update_mode
== 'ignore' %}\n {% set exclusions = exclusions + [ firmware_update_entities
] %}\n{% else %}\n {% set ns = namespace(entities = []) %}\n {% for entity
in expand(firmware_update_entities) | rejectattr('entity_id', 'in', exclusions)
| selectattr('state', 'eq', 'on') %}\n {% set entity_version_change = version(entity.attributes.latest_version
| default('')) - version(entity.attributes.installed_version | default(''))
%}\n {% if input_firmware_update_mode == 'patches' %}\n {% if entity_version_change.major
or entity_version_change.minor or (not entity_version_change.patch) %}\n {%
set ns.entities = ns.entities + [ entity.entity_id ] %}\n {% endif %}\n
\ {% elif input_firmware_update_mode == 'major_and_minor' %}\n {% if
(not entity_version_change.major) and (not entity_version_change.minor) %}\n
\ {% set ns.entities = ns.entities + [ entity.entity_id ] %}\n {%
endif %}\n {% endif %}\n {% endfor %}\n {% set exclusions = exclusions
+ [ ns.entities ] %}\n{% endif %}\n{% if input_general_update_mode == 'ignore'
%}\n {% set exclusions = exclusions + [ general_update_entities ] %}\n{% else
%}\n {% set ns = namespace(entities = []) %}\n {% for entity in expand(general_update_entities)
| rejectattr('entity_id', 'in', exclusions) | selectattr('state', 'eq', 'on')
%}\n {% set entity_version_change = version(entity.attributes.latest_version
| default('')) - version(entity.attributes.installed_version | default(''))
%}\n {% if input_general_update_mode == 'patches' %}\n {% if entity_version_change.major
or entity_version_change.minor or (not entity_version_change.patch) %}\n {%
set ns.entities = ns.entities + [ entity.entity_id ] %}\n {% endif %}\n
\ {% elif input_general_update_mode == 'major_and_minor' %}\n {% if (not
entity_version_change.major) and (not entity_version_change.minor) %}\n {%
set ns.entities = ns.entities + [ entity.entity_id ] %}\n {% endif %}\n
\ {% endif %}\n {% endfor %}\n {% set exclusions = exclusions + [ ns.entities
] %}\n{% endif %}\n{{ exclusions }}\n"
pending_updates_list: "{{ states.update\n | default([])\n | selectattr('state','eq','on')\n
\ | rejectattr('entity_id', 'in', input_update_exclusions)\n | map(attribute='entity_id')\n
\ | list\n}}\n"
- alias: Refresh update list - update entities
action: homeassistant.update_entity
data: {}
target:
entity_id: '{{ states.update | map(attribute=''entity_id'') | list }}'
continue_on_error: true
- variables:
updates_list: '{{ pending_updates_list }}'
- alias: Re-check conditions
continue_on_error: true
if: "{{\n (\n states.update\n | selectattr('state','eq','on')\n | selectattr('entity_id',
'in', pending_updates_list)\n | rejectattr('entity_id', 'in', input_update_exclusions)\n
\ | list\n | count\n | int(0)\n ) < 1\n}}\n"
then:
- stop: Nothing to update
- &id002
if: '{{ input_verbose_logging_bool }}'
then:
- alias: Logbook - variables
continue_on_error: true
action: logbook.log
data:
name: Auto-update
entity_id: '{{ this.entity_id }}'
message: "Variables:\n input_backup_bool: {{ input_backup_bool }},\n input_restart_type:
{{ input_restart_type }},\n input_verbose_logging_bool: {{ input_verbose_logging_bool
}},\n input_max_backup_age_seconds: {{ input_max_backup_age_seconds }},\n
\ input_schedule_monthday: {{ input_schedule_monthday }},\n input_update_exclusions:
{{ input_update_exclusions }},\n input_core_os_update_mode: {{ input_core_os_update_mode
}},\n input_firmware_update_mode: {{ input_firmware_update_mode }},\n input_general_update_mode:
{{ input_general_update_mode }},\n core_update_entity: {{ core_update_entity
}},\n os_update_entity: {{ os_update_entity }},\n supervisor_update_entity:
{{ supervisor_update_entity }},\n firmware_update_entities: {{ firmware_update_entities
}},\n general_update_entities: {{ general_update_entities }},\n updates_list:
{{ updates_list }}"
continue_on_error: true
- if: '{{ input_verbose_logging_bool }}'
then:
- alias: Logbook - A new update is available
action: logbook.log
data:
name: Auto-update
entity_id: '{{ this.entity_id }}'
domain: update
message: A new update is available for Home Assistant.
- alias: Logbook - List of updates
continue_on_error: true
action: logbook.log
data:
name: Auto-update
entity_id: '{{ this.entity_id }}'
domain: update
message: "List of updates: - {{ states.update\n | selectattr('state','eq','on')\n
\ | selectattr('entity_id', 'in', pending_updates_list)\n | rejectattr('entity_id',
'in', input_update_exclusions)\n | map(attribute='name') | list | join('\n\n-
') }}\n"
- alias: 'Logbook: Running pre-update actions'
continue_on_error: true
action: logbook.log
data:
name: Auto-update
entity_id: '{{ this.entity_id }}'
message: Running pre-update actions...
continue_on_error: true
- alias: Run pre-update actions
continue_on_error: true
choose:
- conditions:
- '{{ true }}'
sequence: !input actions_pre_update
default: []
- alias: Check existing backups uploaded
continue_on_error: true
if:
- '{{ input_max_backup_age_seconds > 0 }}'
then:
- variables:
last_backup_timestamp_list: "{{\n states.sensor\n | selectattr(\"attributes.last_backup\",
\"defined\")\n | map(attribute=\"attributes.last_backup\")\n | list\n}}\n"
last_backup_timestamp: '{{ last_backup_timestamp_list | max if last_backup_timestamp_list
| count > 0 else None }}'
- alias: Check if backup state is defined
if: '{{ last_backup_timestamp != None }}'
then:
- stop: Backup State sensor not found
- alias: Check age of last uploaded backup
if: '{{ as_timestamp(now()) - as_timestamp(last_backup_timestamp) > input_max_backup_age_seconds
}}'
then:
- stop: Last uploaded backup is too old
- alias: Backup
continue_on_error: true
if:
- '{{ input_backup_bool }}'
then:
- if: '{{ input_verbose_logging_bool }}'
then:
- alias: Logbook - Backing up
continue_on_error: true
action: logbook.log
data:
name: Auto-update
entity_id: '{{ this.entity_id }}'
message: Backing up Home Assistant.
- alias: Call backup service
continue_on_error: true
action: hassio.backup_full
data:
compressed: true
- if: '{{ input_verbose_logging_bool }}'
then:
- alias: Backup triggered
continue_on_error: true
action: logbook.log
data:
name: Auto-update
entity_id: '{{ this.entity_id }}'
message: Backup triggered.
- variables:
backup_wait_time: !input backup_wait_time
backup_wait_time_seconds: '{{ (backup_wait_time | int(60)) * 60 }}'
- if: '{{ backup_wait_time_seconds > 0 }}'
then:
- alias: Give selected wait time for the backup
delay: '{{ backup_wait_time_seconds }}'
else: []
- *id001
- *id002
- alias: Update - Standard
continue_on_error: true
repeat:
while:
- '{{ input_general_update_mode in [''patches'', ''major_and_minor'', ''all'']
}}'
- condition: state
entity_id: !input schedule_entity
state: 'on'
- condition: template
value_template: "{{ ( states.update\n | selectattr('state','eq','on')\n |
selectattr('entity_id', 'in', pending_updates_list)\n | rejectattr('entity_id',
'in', core_update_entity)\n | rejectattr('entity_id', 'in', os_update_entity)\n
\ | rejectattr('entity_id', 'in', firmware_update_entities)\n | rejectattr('entity_id',
'in', input_update_exclusions)\n | map(attribute='entity_id')\n | list |
count | int(0) ) > 0\n}}\n"
sequence:
- if: '{{ input_verbose_logging_bool }}'
then:
- alias: Update - Standard - Logbook - Starting
continue_on_error: true
action: logbook.log
data:
name: Auto-update
entity_id: '{{ this.entity_id }}'
message: Starting sequence of standard updates...
- variables:
pending_update_list: "{{ states.update\n | selectattr('state','eq','on')\n
\ | selectattr('entity_id', 'in', pending_updates_list)\n | rejectattr('entity_id',
'in', core_update_entity)\n | rejectattr('entity_id', 'in', os_update_entity)\n
\ | rejectattr('entity_id', 'in', firmware_update_entities)\n | rejectattr('entity_id',
'in', input_update_exclusions)\n | map(attribute='entity_id')\n | list\n
\ }}\n"
- if: '{{ input_verbose_logging_bool }}'
then:
- alias: Update - Standard - Logbook - Updating
continue_on_error: true
action: logbook.log
data:
name: Auto-update
entity_id: '{{ this.entity_id }}'
message: Updating {{pending_update_list[0]}} of {{pending_update_list}}
...
- alias: Update - Standard - Install
continue_on_error: true
action: update.install
data: {}
target:
entity_id: '{{ pending_update_list[0] }}'
- alias: Update - Standard - Wait
continue_on_error: true
wait_template: '{{ is_state(pending_update_list[0], ''off'') }}'
continue_on_timeout: true
timeout: '3600'
- *id001
- *id002
- alias: Update - Core
continue_on_error: true
repeat:
while:
- '{{ input_core_os_update_mode in [''patches'', ''major_and_minor'', ''all'']
}}'
- condition: state
entity_id: !input schedule_entity
state: 'on'
- condition: template
value_template: "{{ ( states.update\n | selectattr('state','eq','on')\n |
selectattr('entity_id', 'in', pending_updates_list)\n | selectattr('entity_id',
'in', core_update_entity)\n | rejectattr('entity_id', 'in', os_update_entity)\n
\ | rejectattr('entity_id', 'in', firmware_update_entities)\n | rejectattr('entity_id',
'in', input_update_exclusions)\n | map(attribute='entity_id')\n | list |
count | int(0) ) > 0\n}}\n"
sequence:
- if: '{{ input_verbose_logging_bool }}'
then:
- alias: Update - Core - Logbook - Starting
continue_on_error: true
action: logbook.log
data:
name: Auto-update
entity_id: '{{ this.entity_id }}'
message: Starting sequence of core items updates...
- variables:
pending_update_list: "{{ states.update\n | selectattr('state','eq','on')\n
\ | selectattr('entity_id', 'in', pending_updates_list)\n | selectattr('entity_id',
'in', core_update_entity)\n | rejectattr('entity_id', 'in', os_update_entity)\n
\ | rejectattr('entity_id', 'in', firmware_update_entities)\n | rejectattr('entity_id',
'in', input_update_exclusions)\n | map(attribute='entity_id')\n | list\n
\ }}\n"
- if: '{{ input_verbose_logging_bool }}'
then:
- alias: Update - Core - Logbook - Updating
continue_on_error: true
action: logbook.log
data:
name: Auto-update
entity_id: '{{ this.entity_id }}'
message: Updating {{pending_update_list[0]}} of {{pending_update_list}}
...
- alias: Update - Core - Install
continue_on_error: true
action: update.install
data: {}
target:
entity_id: '{{ pending_update_list[0] }}'
- alias: Update - Core - Wait
continue_on_error: true
wait_template: '{{ is_state(pending_update_list[0], ''off'') }}'
continue_on_timeout: true
timeout: '3600'
- *id001
- *id002
- alias: Update - OS
continue_on_error: true
repeat:
while:
- '{{ input_core_os_update_mode in [''patches'', ''major_and_minor'', ''all'']
}}'
- condition: state
entity_id: !input schedule_entity
state: 'on'
- condition: template
value_template: "{{ ( states.update\n | selectattr('state','eq','on')\n |
selectattr('entity_id', 'in', pending_updates_list)\n | rejectattr('entity_id',
'in', core_update_entity)\n | selectattr('entity_id', 'in', os_update_entity)\n
\ | rejectattr('entity_id', 'in', firmware_update_entities)\n | rejectattr('entity_id',
'in', input_update_exclusions)\n | map(attribute='entity_id')\n | list |
count | int(0) ) > 0\n}}\n"
sequence:
- if: '{{ input_verbose_logging_bool }}'
then:
- alias: Update - OS - Logbook - Starting
continue_on_error: true
action: logbook.log
data:
name: Auto-update
entity_id: '{{ this.entity_id }}'
message: Starting sequence of OS update...
- variables:
pending_update_list: "{{ states.update\n | selectattr('state','eq','on')\n
\ | selectattr('entity_id', 'in', pending_updates_list)\n | rejectattr('entity_id',
'in', core_update_entity)\n | selectattr('entity_id', 'in', os_update_entity)\n
\ | rejectattr('entity_id', 'in', firmware_update_entities)\n | rejectattr('entity_id',
'in', input_update_exclusions)\n | map(attribute='entity_id')\n | list\n
\ }}\n"
- if: '{{ input_verbose_logging_bool }}'
then:
- alias: Update - OS - Logbook - Updating
continue_on_error: true
action: logbook.log
data:
name: Auto-update
entity_id: '{{ this.entity_id }}'
message: Updating {{pending_update_list[0]}} of {{pending_update_list}}
...
- alias: Update - OS - Install
continue_on_error: true
action: update.install
data: {}
target:
entity_id: '{{ pending_update_list[0] }}'
- alias: Update - OS - Wait
continue_on_error: true
wait_template: '{{ is_state(pending_update_list[0], ''off'') }}'
continue_on_timeout: true
timeout: '3600'
- *id001
- alias: Update - Devices firmware
continue_on_error: true
repeat:
while:
- '{{ input_firmware_update_mode in [''patches'', ''major_and_minor'', ''all'']
}}'
- condition: state
entity_id: !input schedule_entity
state: 'on'
- condition: template
value_template: "{{ ( states.update\n | selectattr('state','eq','on')\n |
selectattr('entity_id', 'in', pending_updates_list)\n | rejectattr('entity_id',
'in', core_update_entity)\n | rejectattr('entity_id', 'in', os_update_entity)\n
\ | selectattr('entity_id', 'in', firmware_update_entities)\n | rejectattr('entity_id',
'in', input_update_exclusions)\n | map(attribute='entity_id')\n | list |
count | int(0) ) > 0\n}}\n"
sequence:
- if: '{{ input_verbose_logging_bool }}'
then:
- alias: Update - Devices firmware - Logbook - Starting
continue_on_error: true
action: logbook.log
data:
name: Auto-update
entity_id: '{{ this.entity_id }}'
message: Starting sequence of Devices firmware update...
- variables:
pending_update_list: "{{ states.update\n | selectattr('state','eq','on')\n
\ | selectattr('entity_id', 'in', pending_updates_list)\n | rejectattr('entity_id',
'in', core_update_entity)\n | rejectattr('entity_id', 'in', os_update_entity)\n
\ | selectattr('entity_id', 'in', firmware_update_entities)\n | map(attribute='entity_id')\n
\ | list\n }}\n"
- if: '{{ input_verbose_logging_bool }}'
then:
- alias: Update - Devices firmware - Logbook - Updating
continue_on_error: true
action: logbook.log
data:
name: Auto-update
entity_id: '{{ this.entity_id }}'
message: Updating {{pending_update_list[0]}} of {{pending_update_list}}
...
- alias: Update - Devices firmware - Install
continue_on_error: true
action: update.install
data: {}
target:
entity_id: '{{ pending_update_list[0] }}'
- alias: Update - Devices firmware - Wait
continue_on_error: true
wait_template: '{{ is_state(pending_update_list[0], ''off'') }}'
continue_on_timeout: true
timeout: '3600'
- *id001
- *id002
- if: '{{ input_verbose_logging_bool }}'
then:
- alias: Logbook - Updating
continue_on_error: true
action: logbook.log
data:
name: Auto-update
entity_id: '{{ this.entity_id }}'
message: Finishing update process.
- alias: Logbook - Remaining updates
continue_on_error: true
action: logbook.log
data:
name: Auto-update
entity_id: '{{ this.entity_id }}'
message: "Remaining updates: - {{ states.update\n | selectattr('state','eq','on')\n
\ | selectattr('entity_id', 'in', pending_updates_list)\n | rejectattr('entity_id',
'in', input_update_exclusions)\n | map(attribute='name') | list | join('\n\n-
') }}\n"
- if: '{{ input_verbose_logging_bool }}'
then:
- alias: Restart - Logbook
continue_on_error: true
action: logbook.log
data:
name: Auto-update
entity_id: '{{ this.entity_id }}'
message: "{{ states.update\n | selectattr('attributes.release_summary', 'defined')\n
\ | selectattr('attributes.release_summary', 'search', \"<ha-alert alert-type='error'>\")\n
\ | map(attribute='entity_id')\n | list\n | count\n | int(0) }} item(s)
pending a restart:\n- {{ states.update\n | selectattr('attributes.release_summary',
'defined')\n | selectattr('attributes.release_summary', 'search', \"<ha-alert
alert-type='error'>\")\n | map(attribute='entity_id')\n | list\n | join('\n-
') }}\n"
- alias: Restart
continue_on_error: true
if:
- "{{ input_restart_type != \"no-restart\" and (\n (\n states.update\n |
selectattr('attributes.release_summary', 'defined')\n | selectattr('attributes.release_summary',
'search', \"<ha-alert alert-type='error'>\")\n | map(attribute='entity_id')\n
\ | list | count | int(0)\n ) > 0)\n}}"
then:
- alias: Restart - Check config
continue_on_error: true
action: homeassistant.check_config
- if:
- '{{ states.persistent_notification.invalid_config.state | default(''unavailable'')
== ''notifying'' or states.persistent_notification.homeassistant_check_config.state
| default(''unavailable'') == ''notifying'' }}'
then:
- if: '{{ input_verbose_logging_bool }}'
then:
- alias: 'Logbook: Running pre-restart actions'
continue_on_error: true
action: logbook.log
data:
name: Auto-update
entity_id: '{{ this.entity_id }}'
message: Running pre-restart actions...
- alias: Run pre-restart actions
continue_on_error: true
choose:
- conditions:
- '{{ true }}'
sequence: !input actions_pre_restart
default: []
- if: '{{ input_verbose_logging_bool }}'
then:
- alias: Restart - Logbook - Skipping restart
continue_on_error: true
action: logbook.log
data:
name: Auto-update
entity_id: '{{ this.entity_id }}'
message: 'Skipping restart process due to notifications of invalid configurations:
states.persistent_notification.invalid_config.state = {{ states.persistent_notification.invalid_config.state
| default(''unavailable'') }}, states.persistent_notification.homeassistant_check_config.state
= {{ states.persistent_notification.homeassistant_check_config.state |
default(''unavailable'') }}
'
else:
- alias: Restart - Logbook - Restarting
continue_on_error: true
action: logbook.log
data:
name: Auto-update
entity_id: '{{ this.entity_id }}'
message: Restarting Home Assistant {{ input_restart_type }}...
- alias: Restart - Call reboot service
continue_on_error: true
action: '{{ "hassio.host_reboot" if input_restart_type == "host" else "homeassistant.restart"
}}'
- if: '{{ input_verbose_logging_bool }}'
then:
- alias: Logbook - Post-actions
continue_on_error: true
action: logbook.log
data:
name: Auto-update
entity_id: '{{ this.entity_id }}'
message: Running post-update actions...
- alias: Run post-update actions
continue_on_error: true
choose:
- conditions:
- '{{ true }}'
sequence: !input actions_pos_update
default: []
- if: '{{ input_verbose_logging_bool }}'
then:
- alias: Logbook - Done
continue_on_error: true
action: logbook.log
data:
name: Auto-update
entity_id: '{{ this.entity_id }}'
message: Done!
@@ -0,0 +1,200 @@
blueprint:
name: Motion-activated Light extended
description: Turn on a light when a movement occurs
domain: automation
source_url: https://github.com/giannisigalotti/HomeAssistant/blob/main/blueprints/motion-activated-light.yaml
input:
motion_entity:
name: Motion sensor
selector:
entity:
domain:
- binary_sensor
multiple: false
light_target:
name: Light
selector:
target:
entity:
- domain:
- light
no_motion_wait:
name: Wait time
description:
The time to wait before turning off the light after no movement
is detected.
default: 120
selector:
number:
min: 0.0
max: 3600.0
unit_of_measurement: seconds
mode: slider
step: 1.0
skip_if_light_is_on:
name:
Do not execute if the light is already on (prevent auto-turn-off if the
light was turned on manually).
selector:
boolean: {}
default: false
no_sunset_handling:
name: Disable day/night management?
description:
When you turn this option to off, you can define how many hour
before sunset and after sunshine the automation turn on the light
selector:
boolean: {}
default: false
wheater_handling:
name: Enable meteo managment?
description:
Does it also take weather into account to enable/disable motion
sensors (use the time range only when it's sunny and disable otherwise)?
selector:
boolean: {}
default: false
wheater_entity:
name: Weather status sensor
description:
This sensor is used only with the Meteo managment option to determine
if the weather is sunny or not (useful if you are in a room usually dark in
case of bad weather condition
selector:
entity:
domain:
- weather
multiple: false
default: weather.home
sunset_start_hh:
name: Pre-sunset hours activation
description:
How many hours before sunset does the management activate (negative
numbers indicate a delay)?
selector:
number:
min: 0.0
max: 12.0
unit_of_measurement: hours
mode: slider
step: 1.0
default: 0
sunset_start_mm:
name: Pre-sunset minutes activation
description:
How many minutes before sunset does the management activate (negative
numbers indicate a delay)?
selector:
number:
min: 0.0
max: 59.0
unit_of_measurement: minutes
mode: slider
step: 1.0
default: 0
sunrise_start_hh:
name: Post-sunrise hours activation
description:
How many hours after sunrise does the management deactivate (negative
numbers indicate an advance)?
selector:
number:
min: 0.0
max: 12.0
unit_of_measurement: hours
mode: slider
step: 1.0
default: 0
sunrise_start_mm:
name: Post-sunrise minutes activation
description:
How many minutes after sunrise does the management deactivate (negative
numbers indicate an advance)?
selector:
number:
min: 0.0
max: 59.0
unit_of_measurement: minutes
mode: slider
step: 1.0
default: 0
timeout:
name: Deactivation timeout?
description:
After how many minutes does the switch turn off automatically (-1
if no timeout)
selector:
number:
min: -1.0
max: 60.0
unit_of_measurement: minutes
mode: slider
step: 1.0
default: 5
mode: restart
max_exceeded: silent
trigger:
platform: state
entity_id: !input motion_entity
from: "off"
to: "on"
variables:
dusk_start_hour: !input sunset_start_hh
dusk_start_minute: !input sunset_start_mm
rising_start_hour: !input sunrise_start_hh
rising_start_minute: !input sunrise_start_mm
use_weather: !input wheater_handling
skip_light_on: !input skip_if_light_is_on
target_lights: !input light_target
force_skip:
"{{ skip_light_on and\n (expand(\n (([] if target_lights.device_id
is undefined\n else target_lights.device_id | device_entities\n if
target_lights.device_id is string\n else target_lights.device_id
| map('device_entities') | sum(start=[]) )\n +\n ([]
if target_lights.entity_id is undefined\n else [target_lights.entity_id]\n
\ if target_lights.entity_id is string\n else target_lights.entity_id
))\n | select('search', '^light\\.') | list\n ) | selectattr('state',
'eq', 'on') | list | length > 0)\n}}\n"
sun_rising:
"{% if (states.sun.sun.state == \"above_horizon\") %}\n {{ states.sun.sun.last_changed
}}\n{%- else -%}\n {{ states.sun.sun.attributes.next_rising }}\n{%- endif %}\n"
sun_dusk:
"{% if (states.sun.sun.state == \"above_horizon\") %}\n {{ states.sun.sun.attributes.next_dusk
}}\n{%- else -%}\n {{ states.sun.sun.last_changed }}\n{%- endif %}\n"
wheater_sensor: !input wheater_entity
no_sunny_wheater: "{{ states(wheater_sensor) != 'sunny' and use_weather }}
"
condition:
- condition: and
conditions:
- condition: template
value_template: "{{ not force_skip }}"
- condition: or
conditions:
- condition: template
value_template: !input no_sunset_handling
- condition: template
value_template: "{{ no_sunny_wheater }}"
- condition: and
conditions:
- "{{ as_timestamp(now()) >= ((as_timestamp(sun_dusk) - dusk_start_hour*3600
- dusk_start_minute*60) )}}"
- "{{ as_timestamp(now()) < ((as_timestamp(sun_rising) + rising_start_hour*3600
+ rising_start_minute*60) )}}"
action:
- service: light.turn_on
target: !input light_target
- wait_for_trigger:
platform: state
entity_id: !input motion_entity
from: "on"
to: "off"
timeout:
hours: 0
minutes: !input timeout
seconds: 0
milliseconds: 0
- delay: !input no_motion_wait
- service: light.turn_off
target: !input light_target
@@ -0,0 +1,322 @@
blueprint:
name: Synchronize 2 Home Assistant todo list
description: This blueprint for Home Assistant synchronizes 2 to-do lists. Originally
designed to sync Google Keep lists with the Bring shopping list, its versatility
allows syncing any list. Currently limited to syncing only active items, those
marked as completed are removed from the lists
source_url: https://gist.github.com/hectorzin/53f9811ff2d6a673af9ff3a9801df7af
domain: automation
input:
google_list:
name: List 1
description: Select your first list to synchronize
selector:
entity:
domain:
- todo
multiple: false
bring_list:
name: List 2
description: Select your second list to synchronize
selector:
entity:
domain:
- todo
multiple: false
temp_list:
name: Temp List
description: Select the temporary list that is used as the basis of the synchronization
selector:
entity:
domain:
- todo
multiple: false
trigger:
- platform: state
entity_id:
- !input google_list
- platform: state
entity_id:
- !input bring_list
condition: []
action:
- variables:
google_list: !input google_list
bring_list: !input bring_list
temp_list: !input temp_list
- service: todo.get_items
target:
entity_id: '{{ google_list }}'
data:
status: needs_action
response_variable: google_incompleted
- service: todo.get_items
target:
entity_id: '{{ bring_list }}'
data:
status: needs_action
response_variable: bring_incompleted
- service: todo.get_items
target:
entity_id: '{{ temp_list }}'
data:
status: needs_action
response_variable: temp_incompleted
- variables:
deleted_items: "{%- for temp_item in temp_incompleted[temp_list]['items'] -%}\n
\ {% set ns = namespace(found=false) %}\n {%- for google_item in google_incompleted[google_list]['items']
-%}\n {%- if google_item.summary|capitalize == temp_item.summary|capitalize
-%}\n {% set ns.found = true %}\n {%- endif -%}\n {%- endfor -%}\n
\ {%- if not ns.found -%}\n {{ temp_item.summary }};\n {%- endif -%}\n{%-
endfor -%}\n{%- for temp_item in temp_incompleted[temp_list]['items'] -%}\n
\ {% set ns = namespace(found=false) %}\n {%- for bring_item in bring_incompleted[bring_list]['items']
-%}\n {%- if bring_item.summary|capitalize == temp_item.summary|capitalize
-%}\n {% set ns.found = true %}\n {%- endif -%}\n {%- endfor -%}\n
\ {%- if not ns.found -%}\n {{ temp_item.summary }};\n {%- endif -%}\n{%-
endfor -%}\n"
- variables:
deleted_items: "{% for index in range(deleted_items.split(';')|length-1) -%}\n
\ {%- set item = deleted_items.split(';')[index] -%}\n {%- for google_item
in google_incompleted[google_list]['items'] -%}\n {%- if item|capitalize
== google_item.summary|capitalize -%}\n {{ google_item.summary }};\n {%-
endif -%}\n {%- endfor -%}\n{%- endfor -%}\n{% for index in range(deleted_items.split(';')|length-1)
-%}\n {%- set item = deleted_items.split(';')[index] -%}\n {%- for bring_item
in bring_incompleted[bring_list]['items'] -%}\n {%- if item|capitalize ==
bring_item.summary|capitalize -%}\n {{ bring_item.summary }};\n {%-
endif -%}\n {%- endfor -%}\n{%- endfor -%}\n"
- repeat:
for_each: '{{ (deleted_items).split('';'') | list }}'
sequence:
- condition: template
value_template: '{{ repeat.item != "" }}'
- service: todo.update_item
target:
entity_id:
- '{{ temp_list }}'
data:
item: '{{ repeat.item }}'
status: completed
- variables:
delete_google: "{% set ns = namespace(found=\"\") %} {%- for google_item in\ngoogle_incompleted[google_list]['items']
-%}\n {%- if google_item.summary|capitalize == repeat.item|capitalize -%}\n
\ {% set ns.found = google_item.summary %}\n {%- endif -%}\n{%- endfor
-%}\n{%- if ns.found != \"\" -%}\n {{ ns.found }}\n{%- else -%}\n \n{%-
endif -%}\n"
- if:
- condition: template
value_template: '{{ delete_google != "" }}'
then:
- service: todo.remove_item
target:
entity_id:
- '{{ google_list }}'
data:
item: '{{ delete_google }}'
- variables:
delete_bring: "{% set ns = namespace(found=\"\") %}\n{%- for bring_item in
bring_incompleted[bring_list]['items'] -%}\n {%- if bring_item.summary|capitalize
== repeat.item|capitalize -%}\n {% set ns.found = bring_item.summary
%}\n {%- endif -%}\n{%- endfor -%}\n{%- if ns.found != \"\" -%}\n {{ ns.found
}}\n{%- else -%}\n \n{%- endif -%}\n"
- if:
- condition: template
value_template: '{{ delete_bring != "" }}'
then:
- service: todo.update_item
target:
entity_id:
- '{{ bring_list }}'
data:
item: '{{ delete_bring }}'
status: completed
- service: todo.get_items
target:
entity_id: '{{ temp_list }}'
data:
status: needs_action
response_variable: temp_incompleted
- service: todo.get_items
target:
entity_id: '{{ google_list }}'
data:
status: needs_action
response_variable: google_incompleted
- service: todo.get_items
target:
entity_id: '{{ bring_list }}'
data:
status: needs_action
response_variable: bring_incompleted
- variables:
items_to_buy_rep: "{%- for google_item in google_incompleted[google_list]['items']
-%}\n {% set ns = namespace(found=false) %}\n {%- for temp_item in temp_incompleted[temp_list]['items']
-%}\n {%- if google_item.summary|capitalize == temp_item.summary|capitalize
-%}\n {% set ns.found = true %}\n {%- endif -%}\n {%- endfor -%}\n
\ {%- if not ns.found -%}\n {{ google_item.summary|capitalize }};\n {%-
endif -%}\n{%- endfor -%}\n{%- for bring_item in bring_incompleted[bring_list]['items']
-%}\n {% set ns = namespace(found=false) %}\n {%- for temp_item in temp_incompleted[temp_list]['items']
-%}\n {%- if bring_item.summary|capitalize == temp_item.summary|capitalize
-%}\n {% set ns.found = true %}\n {%- endif -%}\n {%- endfor -%}\n
\ {%- if not ns.found -%}\n {{ bring_item.summary|capitalize }};\n {%- endif
-%}\n{%- endfor -%}\n"
- variables:
items_to_buy: "{% for index in range(items_to_buy_rep.split(';')|length-1) -%}\n
\ {% set ns = namespace(found=false) %}\n {%- set item = items_to_buy_rep.split(';')[index]
-%}\n {% for index2 in range(index+1,items_to_buy_rep.split(';')|length-1)
-%}\n {%- set item2 = items_to_buy_rep.split(';')[index2] -%}\n {%- if
item == item2 -%}\n {% set ns.found = true %}\n {%- endif -%}\n {%-
endfor -%}\n {%- if not ns.found -%}\n {{ item }};\n {%- endif -%}\n{%-
endfor -%}\n"
- service: todo.get_items
target:
entity_id: '{{ temp_list }}'
data:
status: completed
response_variable: temp_completed
- variables:
items_to_delete: "{% for index in range(items_to_buy.split(';')|length-1) -%}\n
\ {% set ns = namespace(found=false) %}\n {%- set item = items_to_buy.split(';')[index]
-%}\n {%- for temp_item in temp_completed[temp_list]['items'] -%}\n {%-
if item|capitalize == temp_item.summary|capitalize -%}\n {{ temp_item.summary
}};\n {%- endif -%}\n {%- endfor -%}\n{%- endfor -%}\n"
- repeat:
for_each: '{{ (items_to_delete).split('';'') | list }}'
sequence:
- condition: template
value_template: '{{ repeat.item != "" }}'
- service: todo.remove_item
target:
entity_id: '{{ temp_list }}'
data:
item: '{{ repeat.item }}'
- repeat:
for_each: '{{ (items_to_buy).split('';'') | list }}'
sequence:
- condition: template
value_template: '{{ repeat.item != "" }}'
- service: todo.add_item
target:
entity_id: '{{ temp_list }}'
data:
item: '{{ repeat.item }}'
- service: todo.get_items
target:
entity_id: '{{ temp_list }}'
data:
status: needs_action
response_variable: temp_incompleted
- variables:
items_to_bring: "{%- for temp_item in temp_incompleted[temp_list]['items'] -%}\n
\ {% set ns = namespace(found=false) %}\n {%- for bring_item in bring_incompleted[bring_list]['items']
-%}\n {%- if bring_item.summary|capitalize == temp_item.summary|capitalize
-%}\n {% set ns.found = true %}\n {%- endif -%}\n {%- endfor -%}\n
\ {%- if not ns.found -%}\n {{ temp_item.summary|capitalize }};\n {%- endif
-%}\n{%- endfor -%}\n"
- service: todo.get_items
target:
entity_id: '{{ bring_list }}'
data:
status: completed
response_variable: bring_completed
- variables:
items_to_delete: "{% for index in range(items_to_bring.split(';')|length-1) -%}\n
\ {% set ns = namespace(found=false) %}\n {%- set item = items_to_bring.split(';')[index]
-%}\n {%- for bring_item in bring_completed[bring_list]['items'] -%}\n {%-
if item|capitalize == bring_item.summary|capitalize -%}\n {{ bring_item.summary
}};\n {%- endif -%}\n {%- endfor -%}\n{%- endfor -%}\n"
- repeat:
for_each: '{{ (items_to_delete).split('';'') | list }}'
sequence:
- condition: template
value_template: '{{ repeat.item != "" }}'
- service: todo.remove_item
target:
entity_id: '{{ bring_list }}'
data:
item: '{{ repeat.item }}'
- repeat:
for_each: '{{ (items_to_bring).split('';'') | list }}'
sequence:
- condition: template
value_template: '{{ repeat.item != "" }}'
- service: todo.add_item
target:
entity_id: '{{ bring_list }}'
data:
item: '{{ repeat.item }}'
- variables:
items_delete_bring: "{%- for bring_item in bring_incompleted[bring_list]['items']
-%}\n {% set ns = namespace(found=false) %}\n {%- for temp_item in temp_incompleted[temp_list]['items']
-%}\n {%- if bring_item.summary|capitalize == temp_item.summary|capitalize
-%}\n {% set ns.found = true %}\n {%- endif -%}\n {%- endfor -%}\n
\ {%- if not ns.found -%}\n {{ bring_item.summary }};\n {%- endif -%}\n{%-
endfor -%}\n"
- repeat:
for_each: '{{ (items_delete_bring).split('';'') | list }}'
sequence:
- condition: template
value_template: '{{ repeat.item != "" }}'
- service: todo.update_item
target:
entity_id: '{{ bring_list }}'
data:
item: '{{ repeat.item }}'
status: completed
- variables:
items_to_google: "{%- for temp_item in temp_incompleted[temp_list]['items'] -%}\n
\ {% set ns = namespace(found=false) %}\n {%- for google_item in google_incompleted[google_list]['items']
-%}\n {%- if google_item.summary|capitalize == temp_item.summary|capitalize
-%}\n {% set ns.found = true %}\n {%- endif -%}\n {%- endfor -%}\n
\ {%- if not ns.found -%}\n {{ temp_item.summary|capitalize }};\n {%- endif
-%}\n{%- endfor -%}\n"
- service: todo.get_items
target:
entity_id: '{{ google_list }}'
data:
status: completed
response_variable: google_completed
- variables:
items_to_delete: "{% for index in range(items_to_google.split(';')|length-1) -%}\n
\ {% set ns = namespace(found=false) %}\n {%- set item = items_to_google.split(';')[index]
-%}\n {%- for google_item in google_completed[google_list]['items'] -%}\n {%-
if item|capitalize == google_item.summary|capitalize -%}\n {{ google_item.summary
}};\n {%- endif -%}\n {%- endfor -%}\n{%- endfor -%}\n"
- repeat:
for_each: '{{ (items_to_delete).split('';'') | list }}'
sequence:
- condition: template
value_template: '{{ repeat.item != "" }}'
- service: todo.remove_item
target:
entity_id: '{{ google_list }}'
data:
item: '{{ repeat.item }}'
- repeat:
for_each: '{{ (items_to_google).split('';'') | list }}'
sequence:
- condition: template
value_template: '{{ repeat.item != "" }}'
- service: todo.add_item
target:
entity_id: '{{ google_list }}'
data:
item: '{{ repeat.item }}'
- variables:
items_delete_google: "{%- for google_item in google_incompleted[google_list]['items']
-%}\n {% set ns = namespace(found=false) %}\n {%- for temp_item in temp_incompleted[temp_list]['items']
-%}\n {%- if google_item.summary|capitalize == temp_item.summary|capitalize
-%}\n {% set ns.found = true %}\n {%- endif -%}\n {%- endfor -%}\n
\ {%- if not ns.found -%}\n {{ google_item.summary }};\n {%- endif -%}\n{%-
endfor -%}\n"
- repeat:
for_each: '{{ (items_delete_google).split('';'') | list }}'
sequence:
- condition: template
value_template: '{{ repeat.item != "" }}'
- service: todo.update_item
target:
entity_id: '{{ google_list }}'
data:
item: '{{ repeat.item }}'
status: completed
mode: single
@@ -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,680 @@
blueprint:
name: Controller - Philips 324131137411 Hue Dimmer switch
description: "# Controller - Philips 324131137411 Hue Dimmer switch\n\nAutomations
created with this blueprint can be connected with one or more [Hooks](https://epmatt.github.io/awesome-ha-blueprints/docs/blueprints/hooks)
supported by this controller.\nHooks allow to easily create controller-based automations
for interacting with media players, lights, covers and more.\nSee the list of
[Hooks available for this controller](https://epmatt.github.io/awesome-ha-blueprints/docs/blueprints/controllers/philips_324131137411#available-hooks)
for additional details.\n\n\U0001F4D5 Full documentation regarding this blueprint
is available [here](https://epmatt.github.io/awesome-ha-blueprints/docs/blueprints/controllers/philips_324131137411).\n\n\U0001F680
This blueprint is part of the **[Awesome HA Blueprints](https://epmatt.github.io/awesome-ha-blueprints)
project**.\n\n️ Version 2024.07.10\n"
source_url: https://raw.githubusercontent.com/lsismeiro/awesome-ha-blueprints/main/blueprints/controllers/philips_324131137411/philips_324131137411.yaml
domain: automation
input:
integration:
name: (Required) Integration
description: Integration used for connecting the remote with Home Assistant.
Select one of the available values.
selector:
select:
options:
- deCONZ
- ZHA
- Zigbee2MQTT
sort: false
custom_value: false
multiple: false
controller_device:
name: (deCONZ, ZHA) Controller Device
description: The controller device to use for the automation. Choose a value
only if the remote is integrated with deCONZ, ZHA.
default: ''
selector:
device: {}
controller_entity:
name: (Zigbee2MQTT) Controller Entity
description: The action sensor of the controller to use for the automation.
Choose a value only if the remote is integrated with Zigbee2MQTT.
default: ''
selector:
entity:
domain:
- sensor
multiple: false
helper_last_controller_event:
name: (Required) Helper - Last Controller Event
description: Input Text used to store the last event fired by the controller.
You will need to manually create a text input entity for this, please read
the blueprint Additional Notes for more info.
default: ''
selector:
entity:
domain:
- input_text
multiple: false
action_button_on_short:
name: (Optional) On button short press
description: Action to run on short on button press.
default: []
selector:
action: {}
action_button_on_long:
name: (Optional) On button long press
description: Action to run on long on button press.
default: []
selector:
action: {}
action_button_on_release:
name: (Optional) On button release
description: Action to run on on button release after long press.
default: []
selector:
action: {}
action_button_on_double:
name: (Optional) On button double press
description: Action to run on double on button press.
default: []
selector:
action: {}
action_button_off_short:
name: (Optional) Off button short press
description: Action to run on short off button press.
default: []
selector:
action: {}
action_button_off_long:
name: (Optional) Off button long press
description: Action to run on long off button press.
default: []
selector:
action: {}
action_button_off_release:
name: (Optional) Off button release
description: Action to run on off button release after long press.
default: []
selector:
action: {}
action_button_off_double:
name: (Optional) Off button double press
description: Action to run on double off button press.
default: []
selector:
action: {}
action_button_up_short:
name: (Optional) Up button short press
description: Action to run on short up button press.
default: []
selector:
action: {}
action_button_up_long:
name: (Optional) Up button long press
description: Action to run on long up button press.
default: []
selector:
action: {}
action_button_up_release:
name: (Optional) Up button release
description: Action to run on up button release after long press.
default: []
selector:
action: {}
action_button_up_double:
name: (Optional) Up button double press
description: Action to run on double up button press.
default: []
selector:
action: {}
action_button_down_short:
name: (Optional) Down button short press
description: Action to run on short down button press.
default: []
selector:
action: {}
action_button_down_long:
name: (Optional) Down button long press
description: Action to run on long down button press.
default: []
selector:
action: {}
action_button_down_release:
name: (Optional) Down button release
description: Action to run on down button release after long press.
default: []
selector:
action: {}
action_button_down_double:
name: (Optional) Down button double press
description: Action to run on double down button press.
default: []
selector:
action: {}
button_on_long_loop:
name: (Optional) On button long press - loop until release
description: Loop the on button action until the button is released.
default: false
selector:
boolean: {}
button_on_long_max_loop_repeats:
name: (Optional) On button long press - Maximum loop repeats
description: Maximum number of repeats for the custom action, when looping is
enabled. Use it as a safety limit to prevent an endless loop in case the corresponding
stop event is not received.
default: 500
selector:
number:
min: 1.0
max: 5000.0
mode: slider
step: 1.0
button_off_long_loop:
name: (Optional) Off button long press - loop until release
description: Loop the off button action until the button is released.
default: false
selector:
boolean: {}
button_off_long_max_loop_repeats:
name: (Optional) Off button long press - Maximum loop repeats
description: Maximum number of repeats for the custom action, when looping is
enabled. Use it as a safety limit to prevent an endless loop in case the corresponding
stop event is not received.
default: 500
selector:
number:
min: 1.0
max: 5000.0
mode: slider
step: 1.0
button_up_long_loop:
name: (Optional) Up button long press - loop until release
description: Loop the up button action until the button is released.
default: false
selector:
boolean: {}
button_up_long_max_loop_repeats:
name: (Optional) Up button long press - Maximum loop repeats
description: Maximum number of repeats for the custom action, when looping is
enabled. Use it as a safety limit to prevent an endless loop in case the corresponding
stop event is not received.
default: 500
selector:
number:
min: 1.0
max: 5000.0
mode: slider
step: 1.0
button_down_long_loop:
name: (Optional) Down button long press - loop until release
description: Loop the down button action until the button is released.
default: false
selector:
boolean: {}
button_down_long_max_loop_repeats:
name: (Optional) Down button long press - Maximum loop repeats
description: Maximum number of repeats for the custom action, when looping is
enabled. Use it as a safety limit to prevent an endless loop in case the corresponding
stop event is not received.
default: 500
selector:
number:
min: 1.0
max: 5000.0
mode: slider
step: 1.0
button_on_double_press:
name: (Optional) Expose on button double press event
description: Choose whether or not to expose the virtual double press event
for the on button. Turn this on if you are providing an action for the on
button double press event.
default: false
selector:
boolean: {}
button_off_double_press:
name: (Optional) Expose off button double press event
description: Choose whether or not to expose the virtual double press event
for the off button. Turn this on if you are providing an action for the off
button double press event.
default: false
selector:
boolean: {}
button_up_double_press:
name: (Optional) Expose up button double press event
description: Choose whether or not to expose the virtual double press event
for the up button. Turn this on if you are providing an action for the up
button double press event.
default: false
selector:
boolean: {}
button_down_double_press:
name: (Optional) Expose down button double press event
description: Choose whether or not to expose the virtual double press event
for the down button. Turn this on if you are providing an action for the down
button double press event.
default: false
selector:
boolean: {}
helper_double_press_delay:
name: (Optional) Helper - Double Press delay
description: Max delay between the first and the second button press for the
double press event. Provide a value only if you are using a double press action.
Increase this value if you notice that the double press action is not triggered
properly.
default: 500
selector:
number:
min: 100.0
max: 5000.0
unit_of_measurement: milliseconds
mode: box
step: 10.0
helper_debounce_delay:
name: (Optional) Helper - Debounce delay
description: Delay used for debouncing RAW controller events, by default set
to 0. A value of 0 disables the debouncing feature. Increase this value if
you notice custom actions or linked Hooks running multiple times when interacting
with the device. When the controller needs to be debounced, usually a value
of 100 is enough to remove all duplicate events.
default: 0
selector:
number:
min: 0.0
max: 1000.0
unit_of_measurement: milliseconds
mode: box
step: 10.0
variables:
integration: !input integration
button_on_long_loop: !input button_on_long_loop
button_on_long_max_loop_repeats: !input button_on_long_max_loop_repeats
button_on_double_press: !input button_on_double_press
button_off_long_loop: !input button_off_long_loop
button_off_long_max_loop_repeats: !input button_off_long_max_loop_repeats
button_off_double_press: !input button_off_double_press
button_up_long_loop: !input button_up_long_loop
button_up_long_max_loop_repeats: !input button_up_long_max_loop_repeats
button_up_double_press: !input button_up_double_press
button_down_long_loop: !input button_down_long_loop
button_down_long_max_loop_repeats: !input button_down_long_max_loop_repeats
button_down_double_press: !input button_down_double_press
helper_last_controller_event: !input helper_last_controller_event
helper_double_press_delay: !input helper_double_press_delay
helper_debounce_delay: !input helper_debounce_delay
integration_id: '{{ integration | lower }}'
adjusted_double_press_delay: '{{ [helper_double_press_delay - helper_debounce_delay,
100] | max }}'
actions_mapping:
deconz:
button_on_short:
- '1000'
button_on_long:
- '1001'
button_on_release:
- '1003'
button_off_short:
- '4000'
button_off_long:
- '4001'
button_off_release:
- '4003'
button_up_short:
- '2000'
button_up_long:
- '2001'
button_up_release:
- '2003'
button_down_short:
- '3000'
button_down_long:
- '3001'
button_down_release:
- '3003'
zha:
button_on_short:
- on_press
button_on_long:
- on_hold
button_on_release:
- on_long_release
button_off_short:
- off_press
button_off_long:
- off_hold
button_off_release:
- off_long_release
button_up_short:
- up_press
button_up_long:
- up_hold
button_up_release:
- up_long_release
button_down_short:
- down_press
button_down_long:
- down_hold
button_down_release:
- down_long_release
zigbee2mqtt:
button_on_short:
- on_press
button_on_long:
- on_hold
button_on_release:
- on_hold_release
button_off_short:
- off_press
button_off_long:
- off_hold
button_off_release:
- off_hold_release
button_up_short:
- up_press
button_up_long:
- up_hold
button_up_release:
- up_hold_release
button_down_short:
- down_press
button_down_long:
- down_hold
button_down_release:
- down_hold_release
button_on_short: '{{ actions_mapping[integration_id]["button_on_short"] }}'
button_on_long: '{{ actions_mapping[integration_id]["button_on_long"] }}'
button_on_release: '{{ actions_mapping[integration_id]["button_on_release"] }}'
button_off_short: '{{ actions_mapping[integration_id]["button_off_short"] }}'
button_off_long: '{{ actions_mapping[integration_id]["button_off_long"] }}'
button_off_release: '{{ actions_mapping[integration_id]["button_off_release"] }}'
button_up_short: '{{ actions_mapping[integration_id]["button_up_short"] }}'
button_up_long: '{{ actions_mapping[integration_id]["button_up_long"] }}'
button_up_release: '{{ actions_mapping[integration_id]["button_up_release"] }}'
button_down_short: '{{ actions_mapping[integration_id]["button_down_short"] }}'
button_down_long: '{{ actions_mapping[integration_id]["button_down_long"] }}'
button_down_release: '{{ actions_mapping[integration_id]["button_down_release"]
}}'
controller_entity: !input controller_entity
controller_device: !input controller_device
controller_id: '{% if integration_id=="zigbee2mqtt" %}{{controller_entity}}{% else
%}{{controller_device}}{% endif %}'
mode: restart
max_exceeded: silent
trigger:
- platform: event
event_type: state_changed
event_data:
entity_id: !input controller_entity
- platform: event
event_type:
- deconz_event
- zha_event
event_data:
device_id: !input controller_device
condition:
- condition: and
conditions:
- '{%- set trigger_action -%} {%- if integration_id == "zigbee2mqtt" -%} {{ trigger.event.data.new_state.state
}} {%- elif integration_id == "deconz" -%} {{ trigger.event.data.event }} {%-
elif integration_id == "zha" -%} {{ trigger.event.data.command }} {%- endif -%}
{%- endset -%} {{ trigger_action not in ["","None"] }}'
- '{{ integration_id != "zigbee2mqtt" or trigger.event.data.new_state.state != trigger.event.data.old_state.state
}}'
action:
- delay:
milliseconds: !input helper_debounce_delay
- variables:
trigger_action: '{%- if integration_id == "zigbee2mqtt" -%} {{ trigger.event.data.new_state.state
}} {%- elif integration_id == "deconz" -%} {{ trigger.event.data.event }} {%-
elif integration_id == "zha" -%} {{ trigger.event.data.command }} {%- endif
-%}'
trigger_delta: '{{ (as_timestamp(now()) - ((states(helper_last_controller_event)
| from_json).t if helper_last_controller_event is not none and (states(helper_last_controller_event)
| regex_match("^\{((\"a\": \".*\"|\"t\": \d+\.\d+)(, )?){2}\}$")) else as_timestamp("1970-01-01
00:00:00"))) * 1000 }}'
- service: input_text.set_value
data:
entity_id: !input helper_last_controller_event
value: '{{ {"a":trigger_action,"t":as_timestamp(now())} | to_json }}'
- choose:
- conditions: '{{ trigger_action | string in button_on_short }}'
sequence:
- choose:
- conditions: '{{ button_on_double_press }}'
sequence:
- choose:
- conditions: '{{ trigger_action | string in states(helper_last_controller_event)
and trigger_delta | int <= helper_double_press_delay | int }}'
sequence:
- service: input_text.set_value
data:
entity_id: !input helper_last_controller_event
value: '{{ {"a":"double_press","t":as_timestamp(now())} | to_json
}}'
- event: ahb_controller_event
event_data:
controller: '{{ controller_id }}'
action: button_on_double
- choose:
- conditions: []
sequence: !input action_button_on_double
default:
- delay:
milliseconds: '{{ adjusted_double_press_delay }}'
- event: ahb_controller_event
event_data:
controller: '{{ controller_id }}'
action: button_on_short
- choose:
- conditions: []
sequence: !input action_button_on_short
default:
- event: ahb_controller_event
event_data:
controller: '{{ controller_id }}'
action: button_on_short
- choose:
- conditions: []
sequence: !input action_button_on_short
- conditions: '{{ trigger_action | string in button_on_long }}'
sequence:
- event: ahb_controller_event
event_data:
controller: '{{ controller_id }}'
action: button_on_long
- choose:
- conditions: '{{ button_on_long_loop }}'
sequence:
- repeat:
while: '{{ repeat.index < button_on_long_max_loop_repeats | int }}'
sequence: !input action_button_on_long
default: !input action_button_on_long
- conditions: '{{ trigger_action | string in button_on_release }}'
sequence:
- event: ahb_controller_event
event_data:
controller: '{{ controller_id }}'
action: button_on_release
- choose:
- conditions: []
sequence: !input action_button_on_release
- conditions: '{{ trigger_action | string in button_off_short }}'
sequence:
- choose:
- conditions: '{{ button_off_double_press }}'
sequence:
- choose:
- conditions: '{{ trigger_action | string in states(helper_last_controller_event)
and trigger_delta | int <= helper_double_press_delay | int }}'
sequence:
- service: input_text.set_value
data:
entity_id: !input helper_last_controller_event
value: '{{ {"a":"double_press","t":as_timestamp(now())} | to_json
}}'
- event: ahb_controller_event
event_data:
controller: '{{ controller_id }}'
action: button_off_double
- choose:
- conditions: []
sequence: !input action_button_off_double
default:
- delay:
milliseconds: '{{ adjusted_double_press_delay }}'
- event: ahb_controller_event
event_data:
controller: '{{ controller_id }}'
action: button_off_short
- choose:
- conditions: []
sequence: !input action_button_off_short
default:
- event: ahb_controller_event
event_data:
controller: '{{ controller_id }}'
action: button_off_short
- choose:
- conditions: []
sequence: !input action_button_off_short
- conditions: '{{ trigger_action | string in button_off_long }}'
sequence:
- event: ahb_controller_event
event_data:
controller: '{{ controller_id }}'
action: button_off_long
- choose:
- conditions: '{{ button_off_long_loop }}'
sequence:
- repeat:
while: '{{ repeat.index < button_off_long_max_loop_repeats | int }}'
sequence: !input action_button_off_long
default: !input action_button_off_long
- conditions: '{{ trigger_action | string in button_off_release }}'
sequence:
- event: ahb_controller_event
event_data:
controller: '{{ controller_id }}'
action: button_off_release
- choose:
- conditions: []
sequence: !input action_button_off_release
- conditions: '{{ trigger_action | string in button_up_short }}'
sequence:
- choose:
- conditions: '{{ button_up_double_press }}'
sequence:
- choose:
- conditions: '{{ trigger_action | string in states(helper_last_controller_event)
and trigger_delta | int <= helper_double_press_delay | int }}'
sequence:
- service: input_text.set_value
data:
entity_id: !input helper_last_controller_event
value: '{{ {"a":"double_press","t":as_timestamp(now())} | to_json
}}'
- event: ahb_controller_event
event_data:
controller: '{{ controller_id }}'
action: button_up_double
- choose:
- conditions: []
sequence: !input action_button_up_double
default:
- delay:
milliseconds: '{{ adjusted_double_press_delay }}'
- event: ahb_controller_event
event_data:
controller: '{{ controller_id }}'
action: button_up_short
- choose:
- conditions: []
sequence: !input action_button_up_short
default:
- event: ahb_controller_event
event_data:
controller: '{{ controller_id }}'
action: button_up_short
- choose:
- conditions: []
sequence: !input action_button_up_short
- conditions: '{{ trigger_action | string in button_up_long }}'
sequence:
- event: ahb_controller_event
event_data:
controller: '{{ controller_id }}'
action: button_up_long
- choose:
- conditions: '{{ button_up_long_loop }}'
sequence:
- repeat:
while: '{{ repeat.index < button_up_long_max_loop_repeats | int }}'
sequence: !input action_button_up_long
default: !input action_button_up_long
- conditions: '{{ trigger_action | string in button_up_release }}'
sequence:
- event: ahb_controller_event
event_data:
controller: '{{ controller_id }}'
action: button_up_release
- choose:
- conditions: []
sequence: !input action_button_up_release
- conditions: '{{ trigger_action | string in button_down_short }}'
sequence:
- choose:
- conditions: '{{ button_down_double_press }}'
sequence:
- choose:
- conditions: '{{ trigger_action | string in states(helper_last_controller_event)
and trigger_delta | int <= helper_double_press_delay | int }}'
sequence:
- service: input_text.set_value
data:
entity_id: !input helper_last_controller_event
value: '{{ {"a":"double_press","t":as_timestamp(now())} | to_json
}}'
- event: ahb_controller_event
event_data:
controller: '{{ controller_id }}'
action: button_down_double
- choose:
- conditions: []
sequence: !input action_button_down_double
default:
- delay:
milliseconds: '{{ adjusted_double_press_delay }}'
- event: ahb_controller_event
event_data:
controller: '{{ controller_id }}'
action: button_down_short
- choose:
- conditions: []
sequence: !input action_button_down_short
default:
- event: ahb_controller_event
event_data:
controller: '{{ controller_id }}'
action: button_down_short
- choose:
- conditions: []
sequence: !input action_button_down_short
- conditions: '{{ trigger_action | string in button_down_long }}'
sequence:
- event: ahb_controller_event
event_data:
controller: '{{ controller_id }}'
action: button_down_long
- choose:
- conditions: '{{ button_down_long_loop }}'
sequence:
- repeat:
while: '{{ repeat.index < button_down_long_max_loop_repeats | int }}'
sequence: !input action_button_down_long
default: !input action_button_down_long
- conditions: '{{ trigger_action | string in button_down_release }}'
sequence:
- event: ahb_controller_event
event_data:
controller: '{{ controller_id }}'
action: button_down_release
- choose:
- conditions: []
sequence: !input action_button_down_release
@@ -0,0 +1,49 @@
blueprint:
name: Notify when an entity becomes unavailable
description: Notify via a selected service when an entity becomes unavailable (version
1.0)
source_url: https://gist.github.com/sagilo/9c5f85794fa8ee3427e7cdab27f573f5
domain: automation
input:
entities_filter_regex:
name: Entities filter
description: Optional, whitelist filter entities by regex, leave empty to include
all entities. Can be a domain, an entity name or both, for example 'sensor.'
for sensors or for example 'sensor|light.main_light' for all sensors and 'main_light'
entity
default: ''
actions:
name: Actions
description: Notifications or similar to execute, {{ trigger.event.data.entity_id
}} is replaced with the unavailable entitiy name.
selector:
action: {}
max_queued:
name: Maximum queued notifications
description: A number, in case of multiple events, what should be the queue
max depth, defaults to 10
default: 10
selector:
number:
min: 1.0
max: 100.0
step: 1.0
mode: slider
variables:
filter: !input entities_filter_regex
alias: Notify if an entity becomes unavailable
description: ''
trigger:
- platform: event
event_type: state_changed
event_data: {}
condition:
- condition: template
value_template: '{{ trigger.event.data.entity_id |regex_search(filter, ignorecase=False)
and trigger.event.data.new_state.state == ''unavailable'' and trigger.event.data.old_state.state
!= ''unknown'' }}'
action:
- choose: []
default: !input actions
mode: queued
max: !input max_queued