I have a set of Sonos speakers and I set them up to tell me (/w Google TTS) when doors and windows open and close, it’s really nice. I recently learned (tonight) how to use the alert component to tell me, for example, if the garage doors are open for too long after dark:
alert_garage_doors_at_night:
name: Alert if garage doors are open after dark
title: Garage doors alert
message: >
{% for entity in states.group.all_garage_doors.attributes.entity_id if is_state(entity, 'open') %}
{%- if loop.first and loop.last %}
{{ states[entity.split('.')[0]][entity.split('.')[1]].name }} is open
{% else %}
{%- if loop.first %}{% elif loop.last %} & {% else %}, {% endif -%}
{{ states[entity.split('.')[0]][entity.split('.')[1]].name }}{{ " are open" if loop.last }}
{%- endif -%}
{% endfor %}
done_message: Garage doors were alerted but are now closed
entity_id: binary_sensor.garage_doors_alert
state: 'on'
repeat: 15
skip_first: true
can_acknowledge: true
notifiers:
- vapid
data:
tag: garage_doors
However, the alert takes a notify component (in notifiers) to send the message. I’d really like to use the TTS with Sonos to have the notification broadcast over the speakers but I can’t figure out how to make the Sonos TTS entities “notify component”-compatible. Is there a way?
Hi @memnom, I think you’ve missed the point of my original post. I already have the Sonos speakers working with automations. I’m trying to get it working specifically with an alert component.
I must be missing something here because I’m using the alert component for this. There doesn’t seem to be any “action” section for it, only a “notifiers” section and the Sonos isn’t a notifier. I want the Sonos speakers to be triggered on the same 15 minute interval (except immediately [skip_first: true]).
@memnom’s config uses input_boolean.mytest to trigger the Sonos. It seems like you guys are both saying to just “use an automation instead of the alert component”. If I do that, how do I model the alert’s method of notifying every 15 minutes except for the initial trigger?
Ideally, I wouldn’t have to recreate all the logic and the message in a completely independent automation.