good morning.
I created a flow in nodered cha when the HA is restarted the theme is set (day or night) and warns through alexa that HA has restarted.
[{"id":"1012a002.7fb4e","type":"tab","label":"Flow 1","disabled":false,"info":""},{"id":"28885053.a2885","type":"inject","z":"1012a002.7fb4e","name":"HASS Connected?","topic":"","payload":"homeassistant.homeAssistant.isConnected","payloadType":"global","repeat":"1","crontab":"","once":false,"onceDelay":0.1,"x":160,"y":140,"wires":[["7d19488b.8a2fe8"]]},{"id":"7d19488b.8a2fe8","type":"rbe","z":"1012a002.7fb4e","name":"","func":"rbei","gap":"","start":"","inout":"out","property":"payload","x":340,"y":140,"wires":[["7d42b452.29c9fc"]]},{"id":"7d42b452.29c9fc","type":"switch","z":"1012a002.7fb4e","name":"","property":"payload","propertyType":"msg","rules":[{"t":"true"},{"t":"else"}],"checkall":"false","repair":false,"outputs":2,"x":460,"y":140,"wires":[["50c4b2a1.edd7dc"],[]]},{"id":"50c4b2a1.edd7dc","type":"api-current-state","z":"1012a002.7fb4e","name":"","server":"789ba5c6.d478cc","version":1,"outputs":1,"halt_if":"","halt_if_type":"str","halt_if_compare":"is","override_topic":true,"entity_id":"sun.sun","state_type":"str","state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","blockInputOverrides":false,"x":640,"y":140,"wires":[["eb12478d.3d9d08"]]},{"id":"eb12478d.3d9d08","type":"switch","z":"1012a002.7fb4e","name":"","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"below_horizon","vt":"str"},{"t":"eq","v":"above_horizon","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":810,"y":140,"wires":[["fcc0c68e.301c18","4b5b70d6.2b869"],["21589516.28594a","573cde82.856bc"]]},{"id":"fcc0c68e.301c18","type":"api-call-service","z":"1012a002.7fb4e","name":"","server":"789ba5c6.d478cc","version":1,"debugenabled":false,"service_domain":"frontend","service":"set_theme","entityId":"","data":"{ \"name\": \"ios-dark-mode\" }","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":1020,"y":60,"wires":[[]]},{"id":"573cde82.856bc","type":"api-call-service","z":"1012a002.7fb4e","name":"Hassio start","server":"789ba5c6.d478cc","version":1,"debugenabled":false,"service_domain":"script","service":"speak_all","entityId":"","data":"{\"message\":\"La domotica è attiva\",\"data\":{\"type\":\"tts\"}}","dataType":"json","mergecontext":"","output_location":"payload","output_location_type":"msg","mustacheAltTags":false,"x":1060,"y":170,"wires":[[]]},{"id":"21589516.28594a","type":"api-call-service","z":"1012a002.7fb4e","name":"","server":"789ba5c6.d478cc","version":1,"debugenabled":false,"service_domain":"frontend","service":"set_theme","entityId":"","data":"{ \"name\": \"Dark - Yellow\" }","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":1020,"y":220,"wires":[[]]},{"id":"fddec517.778ca8","type":"comment","z":"1012a002.7fb4e","name":"Home Assistant on restart Day/Night Theme Changer","info":"","x":250,"y":80,"wires":[]},{"id":"4b5b70d6.2b869","type":"api-call-service","z":"1012a002.7fb4e","name":"Hassio start","server":"789ba5c6.d478cc","version":1,"debugenabled":false,"service_domain":"script","service":"speak_all","entityId":"","data":"{\"message\":\"La domotica è attiva\",\"data\":{\"type\":\"tts\"}}","dataType":"json","mergecontext":"","output_location":"payload","output_location_type":"msg","mustacheAltTags":false,"x":1060,"y":110,"wires":[[]]},{"id":"789ba5c6.d478cc","type":"server","z":"","name":"Home Assistant","legacy":false,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true}]
I have other automations that notify Alexa of their execution but all of them have the same problem similar to the code I have attached.
Alexa is activated by nodered by calling a script that sets the volume and plays the alert.
i have two different scripts that activate alexa.
One activates a part and the other activates them all
The scripts are these:
################################################## ########################################
speak:
alias: "TTS message"
sequence:
- service: media_player.volume_set
entity_id:
- media_player.cucina
- media_player.office
date:
volume_level: '.5'
- service: notify.alexa_media
data_template:
message: "{{message}}"
date:
type: announce
target:
- media_player.cucina
- media_player.office
##################################################
speak_all:
alias: "TTS message"
sequence:
- service: media_player.volume_set
entity_id:
- media_player.cucina
- media_player.office
- media_player.letto
date:
volume_level: '.4'
- service: notify.alexa_media
data_template:
message: "{{message}}"
date:
type: announce
target:
- media_player.cucina
- media_player.office
- media_player.letto
##################################################
The problem is that when the script is called I see alexa activate for the volume setting but then the announcement is not played, if not in a random way.
Going into nodered checking the debugging of the node I see an api error that says:
Call-service API error. Error Message: Too Many Requests
how can I solve in your opinion?
Thanks, Alberto