Skip to content

Instantly share code, notes, and snippets.

@Blackshome
Last active October 27, 2024 19:59
Show Gist options
  • Save Blackshome/610854c4868aa73e32347ca54aa276ae to your computer and use it in GitHub Desktop.
Save Blackshome/610854c4868aa73e32347ca54aa276ae to your computer and use it in GitHub Desktop.
android-notification-channel-manager.yaml
blueprint:
name: Android Notification Channel Manager
description: >
# 🤖 Android Notification Channel Manager
**Version: 1.0**
Channel Your Alerts, Easily Create and Delete Notification Channels on Android Devices📲
**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) 🙂
<details>
<summary><b>The Automation Process:</b> 👈</summary>
- **Trigger Options:**
- Press a button to create a notification channel.
- Press a button to remove a notification channel.
- **Notification:**
- Receive a message when a notification channel is created.
- Receive a message when a notification channel is removed.
</details>
Need help?
- FAQ: [Click Here](https://community.home-assistant.io/t/753551/2)
- Community Support Including Updates: [Click Here](https://community.home-assistant.io/t/753551)
⚠️ It is recommended to disable this automation when not in use. Ensure you fully understand notification channels before creating or removing them.
domain: automation
input:
create_notify_settings:
name: "Channel to Create"
icon: mdi:bell-plus-outline
collapsed: true
input:
trigger_create:
name: Trigger Create - Button Helper
description: Enter your button helper to create a channel on your selected devices.
default: []
selector:
entity:
filter:
domain: input_button
create_notify_device:
name: Devices Notified
description: Add the devices where you want to create a notification channel.
default: []
selector:
device:
filter:
- integration: mobile_app
multiple: true
create_message_title:
name: Title
description: Enter the notification title you want to receive when the channel is created.
default: Notification Channel Creator
selector:
text:
create_message:
name: Message
description: Enter the notification message you want to receive when the channel is created.
Use **{{channel_to_create}}** to insert the channel name into the message.
default: "The {{channel_to_create}} channel has been created for your device!"
selector:
text:
channel_to_create:
name: Channel To Create
description: Enter the channel name to be created on the selected devices above.
default: []
selector:
text:
create_importance:
name: Notification Style - Importance
description: This will set the notification style (importance) for your channel.
**Note** - The notification style will be set only the first time the channel is created.
default: default
selector:
select:
options:
- label: "Sound and pop-up"
value: high
- label: "Sound (Default)"
value: default
- label: "Silent"
value: low
- label: "Silent and minimised"
value: min
create_visibility:
name: Notification Lockscreen Visibility
description: You can adjust the visibility of notifications on the lock screen.
**Note** - The notification lock screen visibility will be set only when the channel is created for the first time.
default: private
selector:
select:
options:
- label: "Show content"
value: public
- label: "Hide content (Default)"
value: private
- label: "Don't show notifications"
value: secret
remove_notify_settings:
name: "Channel to Remove"
icon: mdi:bell-cancel-outline
collapsed: true
input:
trigger_remove:
name: Trigger Remove - Button Helper
description: Enter your button helper to remove a channel from the selected devices.
default: []
selector:
entity:
filter:
domain: input_button
remove_notify_device:
name: Devices Notified
description: Add the devices from which you want to remove a notification channel.
default: []
selector:
device:
filter:
- integration: mobile_app
multiple: true
remove_message_title:
name: Title
description: Enter the notification title you want to receive when the channel is removed.
default: Notification Channel Remover
selector:
text:
remove_message:
name: Message
description: Enter the notification message you want to receive when the channel is removed.
Use **{{channel_to_remove}}** to insert the channel name into the message.
default: "The {{channel_to_remove}} channel has been removed from your device!"
selector:
text:
channel_to_remove:
name: Channel To Remove
description: Enter the channel name you would like to remove on the selected devices above.
default: []
selector:
text:
mode: single
max_exceeded: silent
variables:
trigger_create: !input trigger_create
create_notify_device: !input create_notify_device
create_message_title: !input create_message_title
create_message: !input create_message
channel_to_create: !input channel_to_create
create_importance: !input create_importance
create_visibility: !input create_visibility
trigger_remove: !input trigger_remove
remove_notify_device: !input remove_notify_device
remove_message_title: !input remove_message_title
remove_message: !input remove_message
channel_to_remove: !input channel_to_remove
trigger:
- platform: state
entity_id: !input trigger_create
id: 't0'
- platform: state
entity_id: !input trigger_remove
id: 't1'
action:
- choose:
- alias: "Create a channel"
conditions:
- condition: trigger
id: 't0'
sequence:
- alias: "Send a notification to each device"
repeat:
for_each: !input create_notify_device
sequence:
- service: "notify.mobile_app_{{ device_attr(repeat.item, 'name') | slugify }}"
data:
title: !input create_message_title
message: !input create_message
data:
sticky: "true"
channel: !input channel_to_create
importance: !input create_importance
visibility: !input create_visibility
- alias: "Remove a channel"
conditions:
- condition: trigger
id: 't1'
sequence:
- alias: "Send a notification to each device"
repeat:
for_each: !input remove_notify_device
sequence:
- service: "notify.mobile_app_{{ device_attr(repeat.item, 'name') | slugify }}"
data:
message: "remove_channel"
data:
channel: !input channel_to_remove
- alias: "Send a confirmation notification to each device"
repeat:
for_each: !input remove_notify_device
sequence:
- service: "notify.mobile_app_{{ device_attr(repeat.item, 'name') | slugify }}"
data:
title: !input remove_message_title
message: !input remove_message
data:
sticky: "true"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment