Alexa Notification issue

Hi All,

I am having trouble issuing an Alexa notification via node red, I can achieve this via HA no issue calling a service using the below:

service: notify.alexa_media
data:
  target: 
    - media_player.living_room_echo_2
  data:
    type: announce
    #method: all
  message: "This is a test ."

The issue I have is when I try and convert this to a Node Red flow I get errors left and right about the dataset, I’ve scoured the internet for help but the answers I’ve come across are either not relevant or out of date, the option of using the Alexa Notify node red palette isn’t an option as that uses notify me which doesn’t do an announcement like the notify service does.

An example of an error I get is

Call-service error. extra keys not allowed @ data['entity_id']

The latest version I am trying to use is below:

[{"id":"24a3cdee.713402","type":"inject","z":"4fbb0f02.0e5f6","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":100,"y":1140,"wires":[["4f3e98a0.47f778"]]},{"id":"4f3e98a0.47f778","type":"api-call-service","z":"4fbb0f02.0e5f6","name":"","server":"b3a3253e.d12568","version":3,"debugenabled":false,"service_domain":"notify","service":"alexa_media","entityId":"media_player.living_room_echo_2","data":"{\t    \"data\" :{\t        \"data\" :{\t            \"type\": \"announce\"},\t        \"message\": \"This is a test .\"\t    }\t}","dataType":"jsonata","mergecontext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":330,"y":1140,"wires":[[]]},{"id":"b3a3253e.d12568","type":"server","name":"Home Assistant","version":1,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true}]

Can anyone see any glaring issue I have made?

From what i see, you should change the NodeRed field to JSON instead of having it at expression.

So when I change it to JSON I get a new error:

Call-service error. extra keys not allowed @ data['entity_id']

Thing is I am not calling the entity ID in the JSON unless I have to include it there rather than as an entity target

I was just checking how I actually do it. and then it dawned on me. I think the issue is that you are trying to do an announcement but you are selecting an entity. Just remove the entity and it should work on all the Alexas in your System.

1 Like

Thanks for your help, this is making my brain hurt, when you look at it, this should be really simple so I must be missing something obvious, I am getting closer (I think) but again I am now getting a new error lol

Call-service error. required key not provided @ data['message']

Now I have tried to move the Data key around to different locations of the JSON but just I still get the error as if it’s not been included, the new flow is:

[{"id":"24a3cdee.713402","type":"inject","z":"4fbb0f02.0e5f6","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":100,"y":1140,"wires":[["4f3e98a0.47f778"]]},{"id":"4f3e98a0.47f778","type":"api-call-service","z":"4fbb0f02.0e5f6","name":"","server":"b3a3253e.d12568","version":3,"debugenabled":false,"service_domain":"notify","service":"alexa_media","entityId":"","data":"{\t   \"data\":{\t   \"message\":\"This is a test .\",\t       \"data\":{\"type\":\"announce\",\"method\":\"all\"}\t   }\t}","dataType":"json","mergecontext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":330,"y":1140,"wires":[[]]},{"id":"b3a3253e.d12568","type":"server","name":"Home Assistant","version":1,"legacy":false,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true}]

Maybe try my flow:

[{"id":"1e28ab77.23bd65","type":"inject","z":"5aabfbbd.fa65a4","name":"","repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":100,"y":120,"wires":[["ec24ba76.d74be8"]]},{"id":"ec24ba76.d74be8","type":"change","z":"5aabfbbd.fa65a4","name":"Message","rules":[{"t":"set","p":"message","pt":"msg","to":"Das ist ein Test","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":261,"y":120,"wires":[["2273e59a.9f407a"]]},{"id":"51757b47.a0b174","type":"comment","z":"5aabfbbd.fa65a4","name":"Notification Voice Alexa","info":"","x":120,"y":80,"wires":[]},{"id":"c907fa7a.f729a8","type":"function","z":"5aabfbbd.fa65a4","name":"Message","func":"newmsg = {}\n\nnewmsg.payload = { data: { \"message\":msg.message} }\n\nreturn newmsg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":840,"y":180,"wires":[["2794b292.bfe80e"]]},{"id":"2794b292.bfe80e","type":"api-call-service","z":"5aabfbbd.fa65a4","name":"Notify Voice","server":"","version":3,"debugenabled":false,"service_domain":"notify","service":"alexa_media_durchsage","entityId":"","data":"{\"title\":\"Home Assistant\",\"data\":{\"type\":\"announce\",\"method\":\"all\"}}","dataType":"json","mergecontext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":990,"y":180,"wires":[[]]},{"id":"2273e59a.9f407a","type":"link out","z":"5aabfbbd.fa65a4","name":"Alexa Voice Notification Input (MANUAL)","links":["ec6b31d3.2c5d1"],"x":360,"y":120,"wires":[]},{"id":"ec6b31d3.2c5d1","type":"link in","z":"5aabfbbd.fa65a4","name":"Alexa Voice Notification Output","links":["2273e59a.9f407a","28028027.e4ade","1ec87f02.a7c051","3835fbe7.400f84","43fb9654.cb43d8","e9fa725b.46ef8","90407290.cf46f"],"x":455,"y":120,"wires":[["c1e16c2d.cc506"]]},{"id":"ba4ffe8b.8b9ac","type":"api-call-service","z":"5aabfbbd.fa65a4","name":"Notify Whisper","server":"","version":3,"debugenabled":false,"service_domain":"notify","service":"alexa_media_durchsage","entityId":"","data":"{\"title\":\"Home Assistant\",\"data\":{\"type\":\"announce\",\"method\":\"speak\"}}","dataType":"json","mergecontext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1000,"y":120,"wires":[[]]},{"id":"8950cc36.b2a65","type":"function","z":"5aabfbbd.fa65a4","name":"Whisper","func":"newmsg = {}\n\nnewmsg.payload = { data: {\"message\":\"<amazon:effect name='whispered'>\" + msg.whisper + \"</amazon:effect>\"}}\nreturn newmsg;\n","outputs":1,"noerr":0,"x":840,"y":120,"wires":[["ba4ffe8b.8b9ac"]]},{"id":"177bb849.b1aaf8","type":"change","z":"5aabfbbd.fa65a4","name":"Message","rules":[{"t":"set","p":"whisper","pt":"msg","to":"I know what you did last summer...hahahahaha","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":260,"y":240,"wires":[["1ec87f02.a7c051"]]},{"id":"1ec87f02.a7c051","type":"link out","z":"5aabfbbd.fa65a4","name":"Alexa Voice Notficiation Input (WHISPER MANUAL)","links":["ec6b31d3.2c5d1"],"x":355,"y":240,"wires":[]},{"id":"420e3e98.39ebc","type":"inject","z":"5aabfbbd.fa65a4","name":"","repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":100,"y":240,"wires":[["177bb849.b1aaf8"]]},{"id":"51bce81b.a35308","type":"comment","z":"5aabfbbd.fa65a4","name":"Notification Voice Alexa Whisper Louder","info":"","x":170,"y":200,"wires":[]},{"id":"c1e16c2d.cc506","type":"delay","z":"5aabfbbd.fa65a4","name":"1s","pauseType":"delay","timeout":"1","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":false,"x":550,"y":120,"wires":[["53c30353.32aaac","df58f69b.1648c8"]]},{"id":"53c30353.32aaac","type":"switch","z":"5aabfbbd.fa65a4","name":"Whisper","property":"whisper","propertyType":"msg","rules":[{"t":"nempty"}],"checkall":"true","repair":false,"outputs":1,"x":700,"y":120,"wires":[["8950cc36.b2a65"]]},{"id":"df58f69b.1648c8","type":"switch","z":"5aabfbbd.fa65a4","name":"Message","property":"message","propertyType":"msg","rules":[{"t":"nempty"}],"checkall":"true","repair":false,"outputs":1,"x":700,"y":180,"wires":[["c907fa7a.f729a8"]]}]
2 Likes

Well I don’t get any errors when I use your flow and just adjust it to my living room echo, alas I can’t hear it when I am at work so I will test later when I get back and report my findings, many thanks for your help squire

That worked a treat thanks

1 Like

wow thank you. I just got stuck on exactly the same issue. Can you explain why using entity makes no sense in this particular situation? Because we invoke a service thus physical entity must not be chosen? How to explain this in simple terms? Thank you.

I actually need to look at this again, since the latest updates it’s broken again and I’ve not gotten round to figuring out why

If im not mistaken it is because an announcement is by design going to all the Alexas. So putting an entity doesn’t make sense. You would only put an entity, or entities if you do a normal TTS message.

thanks this is the only one that work for me your a star

1 Like