Skip to content

Instantly share code, notes, and snippets.

@DannyFeliz
Created February 7, 2026 03:38
Show Gist options
  • Select an option

  • Save DannyFeliz/df58fc494c34ff2c50186845dd3e07a2 to your computer and use it in GitHub Desktop.

Select an option

Save DannyFeliz/df58fc494c34ff2c50186845dd3e07a2 to your computer and use it in GitHub Desktop.
alias: Notificar dispositivos Danny
description: >-
Envía notificaciones críticas o estándar con soporte para iconos automáticos y
acciones destructivas.
mode: parallel
fields:
title:
name: Título
description: "Ej: ♨️ Gas detectado"
required: true
selector:
text: {}
message:
name: Mensaje
description: Cuerpo del texto de la notificación
required: true
selector:
text:
multiline: true
tag:
name: Tag
description: "ID para agrupar/reemplazar. Ej: estado_estufa"
required: true
selector:
text: {}
critical:
name: Crítica
description: Si es True, ignora el modo silencio y suena al volumen máximo.
default: false
selector:
boolean: {}
a1_id:
name: ID Acción 1
description: "Identificador del evento. Ej: ACCION_SILENCIAR"
selector:
text: {}
a1_title:
name: Título Acción 1
description: "Texto del botón. Ej: Silenciar Alarma"
selector:
text: {}
a1_icon:
name: Icono Acción 1
description: "Ej: checkmark. Ver lista en https://tinyurl.com/ha-notifications"
selector:
text: {}
a1_destructive:
name: Acción 1 Destructiva
description: Pone el texto del botón en rojo.
default: false
selector:
boolean: {}
a2_id:
name: ID Acción 2
description: "Identificador del evento. Ej: ACCION_IGNORAR"
selector:
text: {}
a2_title:
name: Título Acción 2
description: "Texto del botón. Ej: Ignorar"
selector:
text: {}
a2_icon:
name: Icono Acción 2
description: "Ej: xmark. Ver lista en https://bit.ly/3ZUzJYh"
selector:
text: {}
a2_destructive:
name: Acción 2 Destructiva
default: false
selector:
boolean: {}
sequence:
- variables:
notif_actions: |
{% set actions = [] %} {% if a1_id is defined and a1_id != "" %}
{% set a1 = {"action": a1_id, "title": a1_title | default(a1_id)} %}
{% if a1_icon is defined and a1_icon != "" %}
{% set a1 = dict(a1, icon="sfsymbols:" ~ a1_icon) %}
{% endif %}
{% if a1_destructive %}{% set a1 = dict(a1, destructive=true) %}{% endif %}
{% set actions = actions + [a1] %}
{% endif %} {% if a2_id is defined and a2_id != "" %}
{% set a2 = {"action": a2_id, "title": a2_title | default(a2_id)} %}
{% if a2_icon is defined and a2_icon != "" %}
{% set a2 = dict(a2, icon="sfsymbols:" ~ a2_icon) %}
{% endif %}
{% if a2_destructive %}{% set a2 = dict(a2, destructive=true) %}{% endif %}
{% set actions = actions + [a2] %}
{% endif %} {{ actions }}
- repeat:
for_each:
- notify.mobile_app_dannys_iphone
- notify.mobile_app_dannys_macbook_pro_personal
sequence:
- action: "{{ repeat.item }}"
data:
title: "{{ title }}"
message: "{{ message }}"
data:
tag: "{{ tag }}"
push:
interruption-level: "{{ 'critical' if critical else 'active' }}"
sound: |
{% if critical %}
{{
{
"name": "default",
"critical": 1,
"volume": 1.0
}
}}
{% else %}
{{ "default" }}
{% endif %}
actions: "{{ notif_actions }}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment