nope, well i dont notice anything happening anyway, i tried that before and nothing happened
Using the āRun Scriptā button should generate a debug trace if the script runs at allā¦ Is there a trace available when you click the Trace button or does it say something like āNo traces foundā?
Also, have you tried it with the selector set to a non-Show device, just a plain Echo or Dot?
theres this
and still this when i seleced a difrrent device
i also got this for the run command / ask question but i dont think this is important for the tts so i will ignore it for now
i had hoped it might be alexa needs to discover them so i did a discovery and it found the scipts but its defiantly within home assistant
Click āTrace timelineā and see if thereās an error and which step it is occurring at.
i was going to mention in the thing it said it was turned off for some reason could it be that?
nevermind i just realised its on then off
Okay, thereās something weird going onā¦ Hereās what mine looks like:
Notice how the entities in yours are missing their underscores and one of them does not match the script configuration you showed alexa_state
vs. alexa selection
.
I think it might be best to delete the script, restart HA, then re-create the script.
script.send_alexa_announcement
ok yep i had a feeling so should i run it to test it through the script? try it through the card?
Either wayā¦i guess through the script editor is more direct.
still nothing it seems
and
ok an update the top command / ask question works on the card for all devices āthe tts works if run manually in the script (but only for the echo show trying to change it to the dot via the card and run tts through the script doesnāt happen at all) but the card is not detecting the tts script still
(i also changed it from announce to tts so no bongs before the announcemnnt)
good news i have gotten it all up and running just to figure out how to gget rid of the ācall Alexa scriptā./ play button on the bottom left
unfortunately i cant manage to sort the buttons the way i like but its cool cause it all works, except it refuses to run any groups i make i have set up a media player group with two Alexa devices but any time i run it with the group selected neither of the devices speak any ideas??
I actually had a slightly different approach: instead of a sensor, I convert an āinput_selectā helper value to a string:
target:
- "{{(states('input_select.alexa_device'))|string}}"
Also I run this via an automation triggered by a button on a dashboard, and specifically checking whether I run it for a group or an individual device: for a group you have to use the āannounceā method, while individual ones are fine with āttsā.
And adding a whisper toggle is a nice touch I think
alias: Dashboard - Alexa Says
description: ""
trigger: []
condition: []
action:
- if:
- condition: or
conditions:
- condition: state
entity_id: input_select.alexa_device
state: Downstairs
- condition: state
entity_id: input_select.alexa_device
state: Downstairs and Basement
- condition: state
entity_id: input_select.alexa_device
state: Everywhere
- condition: state
entity_id: input_select.alexa_device
state: Upstairs
then:
- if:
- condition: state
entity_id: input_boolean.whisper
state: "on"
then:
- service: notify.alexa_media
data:
target:
- "{{(states('input_select.alexa_device'))|string}}"
message: >-
"<amazon:effect
name='whispered'>{{states('input_text.alexa_says')}}</amazon:effect>"
data:
type: announce
method: all
else:
- service: notify.alexa_media
data:
target:
- "{{(states('input_select.alexa_device'))|string}}"
message: "\"{{states('input_text.alexa_says')}}\""
data:
type: announce
method: all
else:
- if:
- condition: state
entity_id: input_boolean.whisper
state: "on"
then:
- service: notify.alexa_media
data:
target:
- "{{(states('input_select.alexa_device'))|string}}"
message: >-
"<amazon:effect
name='whispered'>{{states('input_text.alexa_says')}}</amazon:effect>"
data:
type: tts
method: all
else:
- service: notify.alexa_media
data:
target:
- "{{(states('input_select.alexa_device'))|string}}"
message: "\"{{states('input_text.alexa_says')}}\""
data:
type: tts
method: all
mode: single
Trying to enter in the script, but I keep getting this error:
Message malformed: extra keys not allowed @ data[āsend_alexa_commandā]
Section Iām copying:
SCRIPTS -----------------------------
Most Lovelace/Dashboard Cards do not accept templates,
so the logic and templating needs to be placed in a script.
Then you can call the script from the card.
send_alexa_command:
alias: Send Alexa command
sequence:
- service: media_player.play_media
data:
entity_id: '{{ states("sensor.alexa_selector") }}'
media_content_id: '{{ states("input_text.cmd_text") }}'
media_content_type: custom
mode: single
Any suggestions?
From the information you have provided I canāt tell if the issue is due to where you have placed the configuration or the lack of proper indenting.
The script configurations shown in the gist are formatted for use in scripts.yaml
, if you are placing them elsewhere be sure to include the top-level key script
as appropriate.
The code block you have pasted is not properly formatted. The first line, send_alexa_command:
should be all the way to the left. All the subsequent lines should be indented 2 spaces.
Thanks for the reply.
I beleive the issue was that I added āsend_alexa_command:ā to the script because as soon as I took that out it let me save.
Feel like Iām so close to getting this going, but now Iām running into this issue:
This entity (āsensor.alexa_selectorā) does not have a unique ID, therefore its settings cannot be managed from the UI. See the documentation for more detail.
I added the template sensor directly into the Configuration.yaml because I couldnāt figure out the settings in Helpers. Took some playing around with to not get any errors, but feels like somethingās off.
Hereās the code:
template:
sensor:
- name: "Alexa Selector"
state: >-
{% set room = states('input_select.alexa_state') -%}
{% set echo_select = {
'Kitchen Echo Show': 'media_player.kitchen_echo_show',
'All': 'media_player.everywhere',
'Master Bathroom Dot': 'media_player.master_bathroom_dot',
'Kids Echo': 'media_player.kids_echo',
'Kids Bathroom Echo': 'media_player.kid_s_bathroom_echo'
} %}
{%- if room in echo_select -%}
media_player.{{ echo_select.get(room) }}
{%- endif %}
With this code, a new Helpers entry popped up, but I canāt see or modify it directly from the UI (image attached).
I added the card and can see all the devices specified, but itās not sounding anything.
When I give it a prompt in the first box (image attached) I get this error:
Failed to perform the action script/send_alexa_command. not a valid value for dictionary value @ data[āentity_idā]
What am I missing?
Make sure that the script has the correct entity ID. From the Script menu, find your script in the list and click its 3-dot expansion menu in the right column, then select āInformationā. In the pop-up, clicking the gear will open the entities settings and allow you to edit the entity ID if necessary to match what is used in the cards.
Regarding the sensor:
If you created a helper with the same name make sure to delete it and restart HA so the entity ID is available for use.
A unique_id
ā¦
template:
sensor:
- name: "Alexa Selector"
unique_id: any_unique_string_of_letters_and_digits_up_to_255_characters
state: >-
{% set room = states('input_select.alexa_state') -%}
{% set echo_select = {
'Kitchen Echo Show': 'kitchen_echo_show',
'All': 'everywhere',
'Master Bathroom Dot': 'master_bathroom_dot',
'Kids Echo': 'kids_echo',
'Kids Bathroom Echo': 'kid_s_bathroom_echo'
} %}
{%- if room in echo_select -%}
media_player.{{ echo_select.get(room) }}
{%- endif %}
Strangest thingā¦ I canāt delete the automatic sensor that was created in Helpers and it says itās Unmanageable, and every time I update the Entity ID name in Configuration.yaml to match that Sensor Entity ID in Helpers changes up a number (_2, _3, etc.).