Ok do you mean that you comma separate the entity ids or do you repeat the whole “service/data” part? thanks
Wait, simultaneously? Sorry missed that part. If its supported it would be a delimited list, not multiple data entries. I seem to remember there was a reason I didn’t do it though - I can’t remember if it was an issue with multiple devices not firing together or the net effect (due to the staggering of announcements) was… Off putting and hard to follow. I’ve run into both issues but don’t remember the context.
I solved this problem a different way… Instead of ‘broadcasting’ to multiple devices - I use the last called device feature of Alexa Media Player to target the announcements to where people actually are. (pretty active Alexa household so the devices are well used)
Yes it ‘misses’ sometimes but it’s better than 85% for me and therefore good enough for this use.
I tried to get that working a while back and never figured it out.
I even asked in the AMP thread and no one had any ideas.
So I gave up.
I would be interested to know how to do it if you figure it out tho.
Do you mean this?
notify:
- platform: alexa_media
name: Alexa Media
- platform: group
name: All Echos
services:
- service: alexa_media
data:
target: media_player.echo_dot_room1
data:
type: announce
- service: alexa_media
data:
target: media_player.echo_dot_room2
data:
type: announce
- service: alexa_media
data:
target: media_player.echo_dot_room3
data:
type: announce
And then call the service…
- service: notify.all_echos
data:
message: Your message goes here
Hi no I am talking about Alexa custom notifications not just regular ones
So figured it out … kind off. You can just create a helper group of media devices and then refer to the entity id of the group.
That results in the announcement on 1 echo and then once you have fully answered Alexa and said yes or no the announcement happens on the next Alexa device in the group.
Would you mind sharing an example of your find?
Sorry not at home but basically just go to Helpers, create a media player group of the players that you wish to include. Then in your notification use the entity I’d of the group instead of an individual media player entity I’d.
It repeats only if you answers.
For me, it’s more useful if it repeats the actionable notification if nobody answers and until someone does it.
I created a script the does exactly that:
alias: Repeat actionable notifications until response
sequence:
- alias: >-
Repeat the actionable notification on every speaker in the group until
there's a response or the group members end
repeat:
for_each: "{{expand(speakers_group)|map(attribute='entity_id') | list }}"
sequence:
- service: "{{service}}"
data:
text: "{{text}}"
event_id: "{{event_id}}"
alexa_device: "{{repeat.item}}"
enabled: true
- wait_for_trigger:
- platform: event
event_type: alexa_actionable_notification
event_data:
event_id: "{{event_id}}"
event_response_type: ResponseNone
timeout:
hours: 0
minutes: 0
seconds: 20
milliseconds: 0
continue_on_timeout: false
enabled: true
- service: notify.alexa_media
data:
data:
type: tts
target: media_player.2_salone_echo_4_1
message: "{{repeat.item}}"
enabled: false
mode: single
The script should be called with the following data.
text: what alexa should ask
event_id: the common event_id you’d use for identify the actionable notification
speakers_group: the group of speakers you’d like to receive the notification. For example, “group.all_my_home_speakers”
service: script.activate_alexa_actionable_notification
@malorezzanzo64 Could you please provide some more insight on your script. I’m trying to use it but i’m not sure I understand how to use it. I assume it’s an automation and not a script. Even so, I would appreciate some help in adopting it.
I have Alexa Actionable Notification working from the Wiki site instruction, but I could use some help with multiple device.
Thanks in advance
@caple no, it’s a script. It has to be called with the parameters I listed (text, event_id, speakers_group). Now I edited a bit, but I remember it was working. Be careful speakers_group works only with old groups (the ones starting with group), not new media groups (the ones starting with media_player).
Hi and thanks for the script. I use it every morning for an automation that asks in each room if i want to open the garage. Sometimes it stops after hitting the third echo device, sometimes it works for all of them… it’s really random and i did not figure it out. It stops because of timeout error. Do you know why? I tried to enable “Continue on timeout” but nothing changed.
I don’t know how to create a group of media players starting with group, mine starts with media_player:
sequence:
- alias: >-
Repeat the actionable notification on every speaker in the group until
there's a response or the group members end
repeat:
for_each: "{{expand(speakers_group)|map(attribute='entity_id') | list }}"
sequence:
- service: "{{service}}"
data:
text: "{{text}}"
event_id: "{{event_id}}"
alexa_device: "{{repeat.item}}"
enabled: true
- wait_for_trigger:
- platform: event
event_type: alexa_actionable_notification
event_data:
event_id: "{{event_id}}"
event_response_type: ResponseNone
timeout:
hours: 0
minutes: 0
seconds: 30
milliseconds: 0
continue_on_timeout: false
enabled: true
Here is also a trace of the running script:
{
"trace": {
"last_step": "sequence/0/repeat/sequence/1",
"run_id": "f55f3ce2756abd5e7194d6f095b8ad87",
"state": "stopped",
"script_execution": "aborted",
"timestamp": {
"start": "2024-03-05T06:30:00.261947+00:00",
"finish": "2024-03-05T06:31:04.656560+00:00"
},
"domain": "script",
"item_id": "multiple_alexa_actionable_notification",
"trace": {
"sequence/0": [
{
"path": "sequence/0",
"timestamp": "2024-03-05T06:30:00.269282+00:00",
"changed_variables": {
"this": {
"entity_id": "script.multiple_alexa_actionable_notification",
"state": "off",
"attributes": {
"last_triggered": "2024-03-04T06:50:39.509226+00:00",
"mode": "single",
"current": 0,
"friendly_name": "multiple_alexa_actionable_notification"
},
"last_changed": "2024-03-04T06:51:39.777010+00:00",
"last_updated": "2024-03-04T06:51:39.777010+00:00",
"context": {
"id": "01HR43PYW1PVSK3DA5SFJYQ0QF",
"parent_id": null,
"user_id": null
}
},
"text": "Sono le 7:30, apro il garage?",
"event_id": "alexa_garage_mattina",
"speakers_group": "media_player.all_home_alexa",
"service": "script.activate_alexa_actionable_notification",
"context": {
"id": "01HR6MW0ST8TRSVD7JTFYVT08H",
"parent_id": null,
"user_id": null
},
"repeat": {
"first": false,
"index": 3,
"last": false,
"item": "media_player.echo_bagno"
},
"wait": {
"remaining": 0,
"trigger": null
}
},
"error": "TimeoutError"
}
],
"sequence/0/repeat/sequence/0": [
{
"path": "sequence/0/repeat/sequence/0",
"timestamp": "2024-03-05T06:30:00.274345+00:00",
"child_id": {
"domain": "script",
"item_id": "activate_alexa_actionable_notification",
"run_id": "1cb7f01d88a5cac0bd1e27e5547febf1"
},
"changed_variables": {
"repeat": {
"first": true,
"index": 1,
"last": false,
"item": "media_player.echo_cameretta"
}
},
"result": {
"params": {
"domain": "script",
"service": "activate_alexa_actionable_notification",
"service_data": {
"text": "Sono le 7:30, apro il garage?",
"event_id": "alexa_garage_mattina",
"alexa_device": "media_player.echo_cameretta"
},
"target": {}
},
"running_script": true
}
},
{
"path": "sequence/0/repeat/sequence/0",
"timestamp": "2024-03-05T06:30:17.593786+00:00",
"child_id": {
"domain": "script",
"item_id": "activate_alexa_actionable_notification",
"run_id": "8d815c925f7bff5c6f62ba0d5d66e948"
},
"changed_variables": {
"repeat": {
"first": false,
"index": 2,
"last": false,
"item": "media_player.echo_soggiorno"
},
"wait": {
"remaining": 12.72329361597076,
"trigger": {
"id": "0",
"idx": "0",
"alias": null,
"platform": "event",
"event": {
"event_type": "alexa_actionable_notification",
"data": {
"event_id": "alexa_garage_mattina",
"event_response": "ResponseNone",
"event_response_type": "ResponseNone"
},
"origin": "REMOTE",
"time_fired": "2024-03-05T06:30:17.587024+00:00",
"context": {
"id": "01HR6MWHQJKHXGQ31719Q26HW2",
"parent_id": null,
"user_id": "f6062591ef294ac2a45b617348075650"
}
},
"description": "event 'alexa_actionable_notification'"
}
}
},
"result": {
"params": {
"domain": "script",
"service": "activate_alexa_actionable_notification",
"service_data": {
"text": "Sono le 7:30, apro il garage?",
"event_id": "alexa_garage_mattina",
"alexa_device": "media_player.echo_soggiorno"
},
"target": {}
},
"running_script": true
}
},
{
"path": "sequence/0/repeat/sequence/0",
"timestamp": "2024-03-05T06:30:34.575665+00:00",
"child_id": {
"domain": "script",
"item_id": "activate_alexa_actionable_notification",
"run_id": "b10bc4f9838f64e2046894fbc601c475"
},
"changed_variables": {
"repeat": {
"first": false,
"index": 3,
"last": false,
"item": "media_player.echo_bagno"
},
"wait": {
"remaining": 13.054631958017126,
"trigger": {
"id": "0",
"idx": "0",
"alias": null,
"platform": "event",
"event": {
"event_type": "alexa_actionable_notification",
"data": {
"event_id": "alexa_garage_mattina",
"event_response": "ResponseNone",
"event_response_type": "ResponseNone"
},
"origin": "REMOTE",
"time_fired": "2024-03-05T06:30:34.546636+00:00",
"context": {
"id": "01HR6MX29J8W21YDQKFR9FAV8K",
"parent_id": null,
"user_id": "f6062591ef294ac2a45b617348075650"
}
},
"description": "event 'alexa_actionable_notification'"
}
}
},
"result": {
"params": {
"domain": "script",
"service": "activate_alexa_actionable_notification",
"service_data": {
"text": "Sono le 7:30, apro il garage?",
"event_id": "alexa_garage_mattina",
"alexa_device": "media_player.echo_bagno"
},
"target": {}
},
"running_script": true
}
}
],
"sequence/0/repeat/sequence/1": [
{
"path": "sequence/0/repeat/sequence/1",
"timestamp": "2024-03-05T06:30:00.311923+00:00",
"changed_variables": {
"wait": {
"remaining": 12.72329361597076,
"trigger": {
"id": "0",
"idx": "0",
"alias": null,
"platform": "event",
"event": {
"event_type": "alexa_actionable_notification",
"data": {
"event_id": "alexa_garage_mattina",
"event_response": "ResponseNone",
"event_response_type": "ResponseNone"
},
"origin": "REMOTE",
"time_fired": "2024-03-05T06:30:17.587024+00:00",
"context": {
"id": "01HR6MWHQJKHXGQ31719Q26HW2",
"parent_id": null,
"user_id": "f6062591ef294ac2a45b617348075650"
}
},
"description": "event 'alexa_actionable_notification'"
}
}
},
"result": {
"wait": {
"remaining": 12.72329361597076,
"trigger": {
"id": "0",
"idx": "0",
"alias": null,
"platform": "event",
"event": {
"event_type": "alexa_actionable_notification",
"data": {
"event_id": "alexa_garage_mattina",
"event_response": "ResponseNone",
"event_response_type": "ResponseNone"
},
"origin": "REMOTE",
"time_fired": "2024-03-05T06:30:17.587024+00:00",
"context": {
"id": "01HR6MWHQJKHXGQ31719Q26HW2",
"parent_id": null,
"user_id": "f6062591ef294ac2a45b617348075650"
}
},
"description": "event 'alexa_actionable_notification'"
}
}
}
},
{
"path": "sequence/0/repeat/sequence/1",
"timestamp": "2024-03-05T06:30:17.624237+00:00",
"changed_variables": {
"wait": {
"remaining": 13.054631958017126,
"trigger": {
"id": "0",
"idx": "0",
"alias": null,
"platform": "event",
"event": {
"event_type": "alexa_actionable_notification",
"data": {
"event_id": "alexa_garage_mattina",
"event_response": "ResponseNone",
"event_response_type": "ResponseNone"
},
"origin": "REMOTE",
"time_fired": "2024-03-05T06:30:34.546636+00:00",
"context": {
"id": "01HR6MX29J8W21YDQKFR9FAV8K",
"parent_id": null,
"user_id": "f6062591ef294ac2a45b617348075650"
}
},
"description": "event 'alexa_actionable_notification'"
}
}
},
"result": {
"wait": {
"remaining": 13.054631958017126,
"trigger": {
"id": "0",
"idx": "0",
"alias": null,
"platform": "event",
"event": {
"event_type": "alexa_actionable_notification",
"data": {
"event_id": "alexa_garage_mattina",
"event_response": "ResponseNone",
"event_response_type": "ResponseNone"
},
"origin": "REMOTE",
"time_fired": "2024-03-05T06:30:34.546636+00:00",
"context": {
"id": "01HR6MX29J8W21YDQKFR9FAV8K",
"parent_id": null,
"user_id": "f6062591ef294ac2a45b617348075650"
}
},
"description": "event 'alexa_actionable_notification'"
}
}
}
},
{
"path": "sequence/0/repeat/sequence/1",
"timestamp": "2024-03-05T06:30:34.642253+00:00",
"changed_variables": {
"wait": {
"remaining": 0,
"trigger": null
}
},
"error": "TimeoutError",
"result": {
"wait": {
"remaining": 0,
"trigger": null
},
"timeout": true
}
}
]
},
"config": {
"sequence": [
{
"alias": "Repeat the actionable notification on every speaker in the group until there's a response or the group members end",
"repeat": {
"for_each": "{{expand(speakers_group)|map(attribute='entity_id') | list }}",
"sequence": [
{
"service": "{{service}}",
"data": {
"text": "{{text}}",
"event_id": "{{event_id}}",
"alexa_device": "{{repeat.item}}"
},
"enabled": true
},
{
"wait_for_trigger": [
{
"platform": "event",
"event_type": "alexa_actionable_notification",
"event_data": {
"event_id": "{{event_id}}",
"event_response_type": "ResponseNone"
}
}
],
"timeout": {
"hours": 0,
"minutes": 0,
"seconds": 30,
"milliseconds": 0
},
"continue_on_timeout": false,
"enabled": true
}
]
}
}
]
},
"blueprint_inputs": null,
"context": {
"id": "01HR6MW0ST8TRSVD7JTFYVT08H",
"parent_id": null,
"user_id": null
}
},
"logbookEntries": [
{
"when": 1709620200.262314,
"state": "on",
"entity_id": "script.multiple_alexa_actionable_notification"
},
{
"name": "activate_alexa_actionable_notification",
"message": "started",
"entity_id": "script.activate_alexa_actionable_notification",
"context_id": "01HR6MW0ST8TRSVD7JTFYVT08H",
"when": 1709620200.279609,
"domain": "script",
"context_state": "on",
"context_entity_id": "script.multiple_alexa_actionable_notification"
},
{
"when": 1709620200.280045,
"state": "on",
"entity_id": "script.activate_alexa_actionable_notification",
"context_state": "on",
"context_entity_id": "script.multiple_alexa_actionable_notification"
},
{
"when": 1709620200.297533,
"state": "{\"text\": \"Sono le 7:30, apro il garage?\", \"event\": \"alexa_garage_mattina\"}",
"entity_id": "input_text.alexa_actionable_notification",
"context_state": "on",
"context_entity_id": "script.multiple_alexa_actionable_notification"
},
{
"when": 1709620200.310114,
"state": "off",
"entity_id": "script.activate_alexa_actionable_notification",
"context_state": "on",
"context_entity_id": "script.multiple_alexa_actionable_notification"
},
{
"name": "activate_alexa_actionable_notification",
"message": "started",
"entity_id": "script.activate_alexa_actionable_notification",
"context_id": "01HR6MW0ST8TRSVD7JTFYVT08H",
"when": 1709620217.598736,
"domain": "script",
"context_state": "on",
"context_entity_id": "script.multiple_alexa_actionable_notification"
},
{
"when": 1709620217.599196,
"state": "on",
"entity_id": "script.activate_alexa_actionable_notification",
"context_state": "on",
"context_entity_id": "script.multiple_alexa_actionable_notification"
},
{
"when": 1709620217.622849,
"state": "off",
"entity_id": "script.activate_alexa_actionable_notification",
"context_state": "on",
"context_entity_id": "script.multiple_alexa_actionable_notification"
},
{
"name": "activate_alexa_actionable_notification",
"message": "started",
"entity_id": "script.activate_alexa_actionable_notification",
"context_id": "01HR6MW0ST8TRSVD7JTFYVT08H",
"when": 1709620234.583457,
"domain": "script",
"context_state": "on",
"context_entity_id": "script.multiple_alexa_actionable_notification"
},
{
"when": 1709620234.58393,
"state": "on",
"entity_id": "script.activate_alexa_actionable_notification",
"context_state": "on",
"context_entity_id": "script.multiple_alexa_actionable_notification"
},
{
"when": 1709620234.620691,
"state": "off",
"entity_id": "script.activate_alexa_actionable_notification",
"context_state": "on",
"context_entity_id": "script.multiple_alexa_actionable_notification"
}
]
}
So apparently there might be a bug with the ResponeNone on the echo show devices? Alexa Actionable Notifications - ResponseNone Event Not Firing - #3 by tmi
This might explain why it stops after the third echo that is the echo show one. @malorezzanzo64 any suggestion on how to edit the script to have a workaround?
@sciorty Hi and sorry for the late response. I don’t think the problem is ResponseNone not firing because in that case it should trigger the timeout. I think the problem could be in the group starting with media_player. One of the difference between groups starting with group (the old style groups) and the groups starting with media_player (or light, sensor…) is that the expand function can be used only on the former. Instead of:
for_each: "{{expand(speakers_group)|map(attribute='entity_id') | list }}"
Try to use a simple list of speakers like that:
for_each:
- media_player.kitchen_echo
- media_player.hall_echo
Still nothing, I put the echo show device as second in the list, the script stopped there and did not proceed with the remaining two.
Instead, putting it as last in the list is a workaround
How did you use the last alexa in an automation, can you please share your yaml?
I cannot those automations do not currently exist.
Short version, use the last Alexa (template pointing at the device returned by last Alexa) as the target when you make your service call.
I never used it before, do you mind looking over my automation and advice where would i need to put it. To make it work. Thank you
alias: Weather Forecast
description: ""
trigger:
- platform: state
entity_id:
- input_boolean.weather
from: "off"
to: "on"
id: weather
- platform: event
event_type: alexa_actionable_notification
event_data:
event_id: weather_forecast
event_response_type: ResponseYes
event_person_id: >-
amzn1.ask.person.AMBP36GPCA2LQUU4NLFRNL2FOATMD63S43KZUFHFZETNQBVEXJ7I6IN3Z2Y375NBBJHSQGBMPZXSFYVHANCKQ4DNXLLIG3E75CSYKGFR675IA7TAENLMRDLQLNZEM5QTYKDY6RFF
id: Animeking Yes
alias: Animeking Response
- platform: event
event_type: alexa_actionable_notification
event_data:
event_id: weather_forecast
event_response_type: ResponseYes
event_person_id: >-
amzn1.ask.person.AMBI3YG2HU25KADRECI6QO2622VBQE2N47ZPU7MU63PNPFO6FAVQLYE76I7SJFIWLKWFHCOGN4TII6JCLGL6CVEKKDZPPGTP66A5GVDJBSFNTOMAYA3GCSXV3YVQVLA24WCH7ECV
id: Paris Yes
alias: Paris Response
- platform: event
event_type: alexa_actionable_notification
event_data:
event_id: weather_forecast
event_response_type: ResponseYes
event_person_id: >-
amzn1.ask.person.AMBEIWSNS64KLBIDEIT6GMGBLO37XXUDT62E6XJ3STYQ7SRATLSEDE2UVGC6UU736CDHT6KARTUIYW5X5A6PDGHSC6IST6534V4CBOGGF264THZROCBP3XKVOD5DUW6ZFAUCGUY
id: Jamar Yes
alias: Jamar Response
condition: []
action:
- alias: Weather Question
choose:
- conditions:
- condition: trigger
id:
- weather
sequence:
- service: script.activate_alexa_actionable_notification
metadata: {}
data:
text: Are you wanting to know the weather for today
event_id: weather_forecast
alexa_device: media_player.animeking_echo_dot
alias: Weather Question
- alias: Weather Forecast
choose:
- conditions:
- condition: trigger
id:
- Jamar Yes
- Paris Yes
sequence:
- service: weather.get_forecasts
target:
entity_id:
- weather.accuwather
data:
type: daily
response_variable: daily_forecast
- variables:
weather_entity: weather.home
prompt: >-
You are an all knowing AI that will be to a kid, please speak as
if it was your child. Do not use emojis as this will be read out
loud
Do not say anything that is meant for grown ups
Try and make the message fun and engaging
What to say : Please talk about todays weather and what is fun
and interesting about it.
Give todays actual weather forecast
- alias: Conversation Agent Notification Text
service: conversation.process
data:
text: >-
Weather: {{ daily_forecast.condition }} ({{
daily_forecast.temperature }}{{ temperature_unit }}, {{
daily_forecast.precipitation }}% precipitation)
{{ prompt }}
agent_id: conversation.openai_conversation
response_variable: agent
- alias: Send notification
service: notify.notify
data:
title: "{{ now().strftime('%A') }} Agenda"
message: "{{ agent.response.speech.plain.speech }}"
- service: notify.alexa_media
data:
message: "{{agent.response.speech.plain.speech}}"
target:
- media_player.animeking_echo_dot
data:
type: tts
enabled: true
alias: Kids Weather
- conditions:
- condition: trigger
id:
- Animeking Yes
sequence:
- service: weather.get_forecast
metadata: {}
data:
type: daily
response_variable: daily_forecast
target:
entity_id: weather.accuwather
- variables:
weather_entity: weather.home
prompt: >-
You are an all knowing AI that will be talking to an anime
lover, please speak as if you love anime. Do not use emojis as
this will be read out loud
Try to use anime references
What to say : Please talk about todays weather and what is fun
and interesting about it.
Give todays actual weather forecast
- alias: Conversation Agent Notification Text
service: conversation.process
data:
text: >-
Weather: {{ daily_forecast.condition }} ({{
daily_forecast.temperature }}{{ temperature_unit }}, {{
daily_forecast.precipitation }}% precipitation)
{{ prompt }}
agent_id: conversation.openai_conversation
response_variable: agent
- alias: Send notification
service: notify.notify
data:
title: "{{ now().strftime('%A') }} Agenda"
message: "{{ agent.response.speech.plain.speech }}"
- service: notify.alexa_media
data:
message: "{{agent.response.speech.plain.speech}}"
target:
- media_player.animeking_echo_dot
data:
type: tts
enabled: true
alias: Anime Weather
mode: single
````Preformatted text`
Sorry I will not, this is a learning opportunity to learn how to write a notification. And one you’re going to need.
Also - don’t try to slam something you’ve never done into an existing complex automation.
Instead start small. Make a single notification automation that you can call to say something simple to last Alexa. When you know that works. THEN try to integrate.
Why - last Alexa is flaky enough (if you overrun your calls in a certain time Amazon will throttle the api - blocking announcements) and many other things will go wrong. - you need to figure out if it’s your call to Amazon or your other automation. By having a standalone simple automation you can test. It simplifies troubleshooting.
Thank you i will try