Could you post your yaml for this? not the Node red stuff as I don’t use it.
cheers
The only yaml I used was for the last alexa called sensor which is
sensor:
- platform: template
sensors:
last_alexa:
entity_id:
- media_player.bedroom
- media_player.kitchen
- media_player.emma_louise
- media_player.livingroom
- media_player.john_luke
value_template: >
{%- for entity in states.media_player -%}
{%- if state_attr(entity.entity_id, 'last_called') == True -%}
{{ entity.entity_id }}
{%- endif -%}
{%- endfor -%}
Just use your own media_player.IDs The rest I have done in nodered as I struggle to get my head around yaml.
Maybe you can try the ‘How do I enable advanced debugging?’ section of the wiki:
Can anybody answer a question for me. I updated this component ( I love it )
im trying to figure out the structure for this script and automation for custom random greetings.
script.yaml
say_greeting:
sequence:
service: notify.alexa_media
data_template:
target:
- "{{ entity_id }}"
data_template:
type: tts
message: "{{ message.replace('PERSON',person) }}"
say_goodbye:
sequence:
service: notify.alexa_media
data_template:
target:
- "{{ entity_id }}"
data_template:
type: tts
message: "{{ message.replace('PERSON',person) }}"
audio_notify:
sequence:
- service: notify.alexa_media
data_template:
target:
- "media_player.{{ mplayer }}"
data_template:
type: tts
message: "{{ tts_msg }}"
And my automation.yaml
- id: family_greeting
alias: Family Greeting
trigger:
platform: state
entity_id:
- binary_sensor.cameron_home
- binary_sensor.corey_home
- binary_sensor.courtney_home
- binary_sensor.mom_home
- binary_sensor.morgan_home
- binary_sensor.wendy_home
- binary_sensor.jasmine_home
- binary_sensor.brandon_home
from: 'off'
to: 'on'
for: '00:01:45'
condition:
condition: time
# At least one of the following is required.
after: '10:00:00'
before: '02:00:01'
action:
- wait_template: "{{ is_state('script.say_greeting', 'off') }}"
- service: script.say_greeting
entity_id: media_player.livingroom
person: >
{{ trigger.to_state.name }}
{%- for s in states.binary_sensor
|rejectattr('entity_id','eq',trigger.entity_id)
|selectattr('state','eq','on')
if '_home' in s.entity_id and
(now() - s.last_changed).total_seconds() < 200 -%}
{{ (' and ' if loop.last else ', ') ~ s.name }}
{%- endfor %}
message: >
{{ ["Hey there PERSON Welcome Home, Did you hear about the restaurant on the moon? Great food, no atmosphere.",
"Sometimes you feel like a nut, Sometimes you don't, Sometimes you feel like PERSON, l o l Welcome Back",
"Hello PERSON, How many apples grow on a tree, All of them",
"Welcome home PERSON, Want to hear a joke about paper, , , , , Nevermind it's tearable",
"Welcome home PERSON, I just watched a program about beavers, It was the best, dam program I have ever seen",
"Welcome home PERSON, Why did the coffee file a police report, It got mugged",
"Welcome home PERSON, How does a penguin build its house, Igloos it together",
"Welcome home PERSON, I once, asked my Dad, did you get a haircut, No, he replied, I got them all cut",
"Welcome home PERSON, What do you call a Mexican who has lost his car? Carlos",
"Welcome home PERSON, Why did the scarecrow win an award? Because he was outstanding in his field",
"Welcome home PERSON, Why don't skeletons ever go trick or treating, Because they have no body to go with",
"Welcome home PERSON, What do you call an elephant that does not matter? An irrelephant ",
"Welcome home PERSON, Want to hear a joke about construction, I am still working on it",
"Welcome home PERSON, What do you call cheese that is not yours, Nacho Cheese",
"Welcome home PERSON, do you know Why the bicycle could not stand up by itself, It was two tired",
"Welcome home PERSON, What did the grape do when he got stepped on, He let out a little wine",
"Welcome home PERSON, I would not buy anything with velcro. It is a total rip-off",
"Welcome home PERSON, The shovel was a ground-breaking invention",
"Welcome home PERSON, This graveyard looks overcrowded, People must be dying to get in there",
"Welcome home PERSON, Two goldfish are in a tank, One says to the other, do you know how to drive this thing?",
"Welcome home PERSON, What do you call, a man with a rubber toe, Roberto",
"Welcome home PERSON, What do you call a fat psychic, A four-chin teller",
"Welcome home PERSON, I would avoid the sushi if I was you, It is a little fishy",
"Welcome home PERSON, To the man in the wheelchair, that stole my camouflage jacket,... You can hide but you can not run",
"Welcome home PERSON, The rotation of earth, really makes my day ",
"Welcome home PERSON, I thought about, going on an, all-almond diet, But that is just nuts",
"Welcome home PERSON, What is brown and sticky, A stick, he he",
"Welcome home PERSON, I have never gone, to a gun range before, I decided to give it a shot!",
"Welcome home PERSON, Why do you never, see elephants hiding in trees, Because, they are so good at it",
"Welcome home PERSON, Did you hear about the kidnapping at school, It is fine, he woke up",
"Welcome home PERSON, A furniture store keeps calling me, All I wanted was, one, night, stand",
"Welcome home PERSON, I used to work, in a shoe recycling shop, It was sole destroying",
"Welcome home PERSON, Did I tell you the time, I fell in love during a backflip, I was heels, over head",
"Welcome home PERSON, I do not play soccer because, I enjoy the sport, I just do it for kicks",
"Welcome home PERSON, People do not like having to bend over to get their drinks, We really need to raise the bar",
"Welcome home PERSON, You are so ugly, you scared the crap out of the toilet",
"Welcome home PERSON, Your family tree, must be a cactus because, everybody on it is a prick",
"Welcome home PERSON, No, I am not insulting you, I am describing you",
"Welcome home PERSON, If I had, a face like yours, I would sue, my parents",
"Welcome home PERSON, Your birth certificate, is an apology letter from, the condom factory",
"Welcome home PERSON, The only way, you will ever get laid, is if you, crawl up a chickens arse, and wait",
"Welcome home PERSON, You are so fake, Barbie is jealous",
"Welcome home PERSON, I am jealous of people, that do not know you!",
"Welcome home PERSON, You are so ugly, when your mom dropped you off at school, she got a fine, for littering",
"Welcome home PERSON, If I wanted to, kill myself, I would climb your ego, and jump to your I Q",
"Welcome home PERSON, You must have been born on a highway, because that is where most accidents happen",
"Welcome home PERSON, Brains are not everything, In your case, they are nothing",
"Welcome home PERSON, Roses are red violets are blue, God made me pretty, what happened to you",
"Welcome home PERSON, Behind every fat woman, there is a beautiful woman, No seriously, your in the way",
"Welcome home PERSON, Calling you an idiot, would be an insult, to all the stupid people",
"Welcome home PERSON, Please shut your mouth, when you are talking to me",
"Welcome home PERSON, I would slap you, but that would be, animal abuse",
"Welcome home PERSON, They say opposites attract, I hope you meet someone who is, good-looking, intelligent, and cultured",
"Welcome home PERSON, The last time, I saw something like you, I flushed it",
"Welcome home PERSON, If ugly, were a crime, you would get, a life sentence",
"Welcome home PERSON, Shock me, say something, intelligent",
"Welcome home PERSON, If your gonna be two faced, honey at least, make one of them pretty",
"Welcome home PERSON, I do not know, what your problem is, but I would bet, it is hard to pronounce",
"Welcome home PERSON, so you claim, You get ten times more girls than me, well lets do the math, ten times, zero is, still zero",
"Welcome home PERSON, You are the reason, the gene pool needs, a lifeguard",
"Welcome home PERSON, Of course, I talk like an idiot, how else would you, understand me?",
"Welcome home PERSON, All day I thought of you.., I was at the zoo ",
"Welcome home PERSON, I would like to see things, from your point of view, but I can not seem to get, my head that far up, my own arse",
"Welcome home PERSON, Stupidity, is not a crime, so you are free to go",
"Welcome home PERSON, You so dumb, you think Cheerios, are doughnut seeds",
"Welcome home PERSON, Is your body, from McDonalds?, , , , , , , , Cause, I am loving it ",
"Welcome home PERSON, You are so dumb, that you got hit, by a parked car",
"Welcome home PERSON, Are you always, this stupid or, is today a special occasion?",
"Damn, how, you, doin PERSON, question, Are you Israeli?, , , , Cause you Israeli hot",
"PERSON is finally here, hey PERSON , Are you from, dunkin donuts, , , , because I like you, a latte",
"Are you my appendix PERSON, Because I do not understand, how you work, but this feeling in my stomach, makes me want to take you out, Oh welcome home PERSON",
"Do you like sales, PERSON, Because, if you are looking for a good one, clothing is, 100% off at my place.",
"hey PERSON, Are you from, Japan, cause im trying, to get in, Japanties ",
"Are you craving Pizza, PERSON, Because I would love, to get a, pizza you, welcome home",
"Is your dad, a terrorist, PERSON, Because you are, the bomb",
"PERSON, Are you, Australian? ,,,,Because you meet all of my, koala,fications",
"PERSON, If I had a garden, I would put your tulips, and my, tulips together",
" welcome home PERSON, Did you hear, of the new disease, called beautiful, I think you are, infected",
" PERSON, If you were a vegetable, you would be a, cute-cumber, welcome home",
" Hello PERSON, You should change your name to, Coca Cola, because, you are so-da-licious",
" hey finally PERSON is here, I wanted to ask you, if I cook you dinner, would you cook me breakfast, PERSON, I have to say your so HOT",
"Hey PERSON, my name is, Microsoft" "Can I crash, at your place, tonight"
] | random }}
Im sure Im missing something simple as usual lol
Thanks for any information anybody could give
The message is literally what Amazon is saying without modification. We’re directly passing on the password from your configuration.yaml so you don’t have to reenter it. If you get stuck on this screen, it’s commonly because the captcha is failing. As mentioned earlier, you would need to turn on advanced debugging to figure out the login issues. Advanced debugging will give you more info including the webpages the component is seeing and also debugging on what information is sent to and from Amazon (e.g., email/password, etc.)
Hi, check the screen when this happens, amazon uk use 2 factor authentication, so it will ask for your password, then the captcha and then a code that is sent to the mobile phone of the user. I had the same problem, took me about 4 attempts before I logged on
Does TTS or Announce allow for the message to include SSML? I think TTS uses Simon says so probably not. Not sure if announce would be different.
Hi i am trying to do the same thing but cant get my head around it. Would you mind sharing your flow from node red? I would really appreciate it!!
Also, did you get the last alexa sensor working to fix your issue?
oof… That’s alot of responsibility lol. Also I’m not familiar with how to edit that. Feel free to add my examples if you want. I don’t want to mess anything up.
Trying to get the notify.alexa_media service working through Nodered.
{
"message": "Bing bong",
"title": "My title for Echo show",
"data": {
"type": "announce",
"method": "all"
}
}
I’ve tried a bunch of variations in service (alexa_media_bedroom_echo_dot, alexa_media) and the same for entity id.
I receive this error when assigning the alexa device in the entity field:
TypeError: Cannot read property 'addListener' of undefined
If there were no “Entity Id” field in call service then i imagine i would be set with the target parameter. Just a bit confusing with the nodered overlay at the top as the yaml version works fine.
Is it possible to ask Alexa something with a custom command?
For instance say something like “Alexa turn on TV” and have a code trigger a set of commands.
If so is there an example anywhere?
You should make a script in HA, and then call il by an Alexa routine, after making Alexa aware of the script.
@msauto
Here is my flow as it stands. work in progress but working well
[{"id":"9f1905c7.0ed8d8","type":"tab","label":"Flow 3","disabled":false,"info":""},{"id":"965b618f.94936","type":"function","z":"9f1905c7.0ed8d8","name":"","func":"var name = flow.get('name')\nvar device = flow.get('device')\nvar message1 = msg.payload1\nvar message2 = msg.payload2\nvar l_loc = flow.get('kll')\nvar c_loc = flow.get('kcl')\nvar final_msg = `${name}` + `${message1}` + `${c_loc}` + `${message2}` + `${l_loc}`\nvar payload = {\"domain\":\"notify\",\"service\":\"alexa_media\",\"data\":{\"message\":`${final_msg}`,\"data\":{\"type\":\"tts\"},\"target\":[`${device}`]}}\nmsg.payload = payload\nreturn msg;\n","outputs":1,"noerr":0,"x":1017.857173374721,"y":358.5714416503906,"wires":[["42acf552.80ce1c"]]},{"id":"f11a52fc.52ef4","type":"server-state-changed","z":"9f1905c7.0ed8d8","name":"KarenLoc","server":"74cbfde1.f316f4","entityidfilter":"device_tracker.life360_karen_priest","entityidfiltertype":"exact","outputinitially":false,"state_type":"str","haltifstate":"","halt_if_type":"str","halt_if_compare":"is","outputs":1,"output_only_on_state_change":true,"x":170.71429824829102,"y":512.8572006225586,"wires":[["26acff9e.84a58"]]},{"id":"26acff9e.84a58","type":"switch","z":"9f1905c7.0ed8d8","name":"","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"Moving","vt":"str"},{"t":"eq","v":"Driving","vt":"str"},{"t":"eq","v":"away","vt":"str"},{"t":"eq","v":"not_home","vt":"str"},{"t":"else"}],"checkall":"true","repair":false,"outputs":5,"x":695.0000114440918,"y":501.4285945892334,"wires":[[],[],[],[],["36235bf0.0c8fb4"]]},{"id":"d7179801.6ba5c8","type":"change","z":"9f1905c7.0ed8d8","name":"Karen Last Loc","rules":[{"t":"move","p":"payload","pt":"msg","to":"kll","tot":"flow"}],"action":"","property":"","from":"","to":"","reg":false,"x":1066.6429977416992,"y":496.60719108581543,"wires":[["73eaae3d.76afc"]]},{"id":"8530e1e8.f55ef","type":"change","z":"9f1905c7.0ed8d8","name":"","rules":[{"t":"change","p":"topic","pt":"msg","from":"input_boolean.where_is_mark","fromt":"str","to":"Mark","tot":"str"},{"t":"change","p":"topic","pt":"msg","from":"input_boolean.where_is_karen","fromt":"str","to":"Karen","tot":"str"},{"t":"change","p":"topic","pt":"msg","from":"input_boolean.where_is_el","fromt":"str","to":"Emma-Louise","tot":"str"},{"t":"move","p":"topic","pt":"msg","to":"name","tot":"flow"},{"t":"delete","p":"data","pt":"msg"},{"t":"set","p":"payload1","pt":"msg","to":"/is currently/","tot":"str"},{"t":"set","p":"payload2","pt":"msg","to":"/and was last seen/","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":620.7143173217773,"y":264.2857656478882,"wires":[["d6770777.91e158"]]},{"id":"3cb2083f.f54b88","type":"server-state-changed","z":"9f1905c7.0ed8d8","name":"where karen","server":"74cbfde1.f316f4","entityidfilter":"input_boolean.where_is_karen","entityidfiltertype":"exact","outputinitially":false,"state_type":"str","haltifstate":"off","halt_if_type":"str","halt_if_compare":"is","outputs":2,"output_only_on_state_change":true,"x":132.14286804199213,"y":348.57146031515947,"wires":[["8530e1e8.f55ef","c31d93b6.60fac"],[]]},{"id":"3c84b75.9234848","type":"server-state-changed","z":"9f1905c7.0ed8d8","name":"where el","server":"74cbfde1.f316f4","entityidfilter":"input_boolean.where_is_el","entityidfiltertype":"exact","outputinitially":false,"state_type":"str","haltifstate":"off","halt_if_type":"str","halt_if_compare":"is","outputs":2,"output_only_on_state_change":true,"x":120.7142944335937,"y":425.71431119101396,"wires":[["8530e1e8.f55ef"],[]]},{"id":"6cc968a7.f99f38","type":"server-state-changed","z":"9f1905c7.0ed8d8","name":"where mark","server":"74cbfde1.f316f4","entityidfilter":"input_boolean.where_is_mark","entityidfiltertype":"exact","outputinitially":false,"state_type":"str","haltifstate":"off","halt_if_type":"str","halt_if_compare":"is","outputs":2,"output_only_on_state_change":true,"x":132.500015258789,"y":276.7857185091292,"wires":[["8530e1e8.f55ef"],[]]},{"id":"e4d6505d.54cb5","type":"comment","z":"9f1905c7.0ed8d8","name":"Assign Name to flow.name","info":"","x":382.28574371337885,"y":221.42860753195635,"wires":[]},{"id":"89154ddc.e976a","type":"comment","z":"9f1905c7.0ed8d8","name":"Input_Boolean","info":"","x":139.428592136928,"y":221.4285535812378,"wires":[]},{"id":"d6770777.91e158","type":"api-current-state","z":"9f1905c7.0ed8d8","name":"Last Alexa Sensor","server":"74cbfde1.f316f4","outputs":1,"halt_if":"","halt_if_type":"str","halt_if_compare":"is","override_topic":false,"entity_id":"sensor.last_alexa","state_type":"str","state_location":"device","override_payload":"flow","entity_location":"","override_data":"none","x":786.4286575317383,"y":304.285765171051,"wires":[["c57e1d7c.f2828"]]},{"id":"ad5527e4.c13068","type":"comment","z":"9f1905c7.0ed8d8","name":"Assign Last Alexa to flow.device","info":"","x":689.4286172049385,"y":222.85711274828225,"wires":[]},{"id":"c57e1d7c.f2828","type":"api-call-service","z":"9f1905c7.0ed8d8","name":"Reset Input_Boolean","server":"74cbfde1.f316f4","service_domain":"input_boolean","service":"turn_off","data":"{\"entity_id\":\"input_boolean.where_is_mark, input_boolean.where_is_karen, input_boolean.where_is_el\"}","mergecontext":"","output_location":"","output_location_type":"none","x":1005.0000871930804,"y":311.4285306930542,"wires":[["3c95921c.6b0dfe"]]},{"id":"2f33208f.01294","type":"comment","z":"9f1905c7.0ed8d8","name":"Turn off Input_Boolean","info":"","x":992.2857622419085,"y":221.4285364151001,"wires":[]},{"id":"42acf552.80ce1c","type":"api-call-service","z":"9f1905c7.0ed8d8","name":"","server":"74cbfde1.f316f4","service_domain":"notify","service":"alexa_media","data":"","mergecontext":"","output_location":"payload","output_location_type":"msg","x":1266.4285997663226,"y":357.1428270339966,"wires":[["73eaae3d.76afc"]]},{"id":"73eaae3d.76afc","type":"debug","z":"9f1905c7.0ed8d8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":1297.85718863351,"y":275.71429920196533,"wires":[]},{"id":"3c95921c.6b0dfe","type":"delay","z":"9f1905c7.0ed8d8","name":"","pauseType":"delay","timeout":"1","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":853.571399143764,"y":358.5714645385742,"wires":[["965b618f.94936"]]},{"id":"c31d93b6.60fac","type":"api-current-state","z":"9f1905c7.0ed8d8","name":"","server":"74cbfde1.f316f4","outputs":1,"halt_if":"","halt_if_type":"str","halt_if_compare":"is","override_topic":false,"entity_id":"device_tracker.life360_karen_priest","state_type":"str","state_location":"kcl","override_payload":"flow","entity_location":"","override_data":"none","x":551.571418762207,"y":395.7143268585205,"wires":[[]]},{"id":"36235bf0.0c8fb4","type":"rbe","z":"9f1905c7.0ed8d8","name":"","func":"rbe","gap":"","start":"","inout":"out","property":"payload","x":865.1250457763672,"y":516.25,"wires":[["d7179801.6ba5c8"]]},{"id":"74cbfde1.f316f4","type":"server","z":"","name":"Home Assistant","legacy":false,"hassio":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true}]
You will need to set up the last alexa sensor in HA and an input_Boolean and a routine in alexa so when you say “where is whoever” it triggers the input boolean.
In my flow the name of the person is taken from the input boolean and saved as a variable, the Last alexa seen service is called and also stored and then there is a get state node for life360 to get the current location. This is called in the function node which passes on the message to the alexa call service node.
In the flow I also set a variable for the last seen place which only updates on state changes but ignors “driving” “moving” etc
@splendstrom
You need this format in the data field
{"message":"test","data":{"type":"tts"},"target":["media_player.bedroom"]}
and leave the entity field blank.
You don’t learn without trying and we can revert it even if you did make a mistake. There’s a preview button so you can experiment with how editing works.
That said, if you’re not comfortable that’s fine; someone might eventually. Thanks for sharing in the thread.
so i’ve had this working in the past but with a fresh install now i’m setting up all my devices completely fresh. with this i have all the files installed in what i believe are the correct folder:
/custom_componets/alexa_media/
however when i enable the media player code i get this:
Configuration invalidCHECK CONFIG
Platform not found: media_player.alexa
componeNts
Oh yeah. Typo lol. But it is spelled correctly in my config… I did find that I wrote alexa_meda tho… so again, my fault. Lol
Edit: still getting the same thing
Edit2: I had it setup as a media_player and not as a root device in the config. i found a snippet within this thread but this could have been avoided if the documentation was better on this, i didn’t really find anything stating that within the github, having to find it within the forum was fairly rough
Thanks So Much !! I will give it a try.
Great job here!
How would I add sensor data to the message?