Alexa notifications with Node-RED and alexa_media_player with random responses

Hi all. Playing with alexa_media_player and Node_RED. It checks to see if device is charging and the battery level. Some random voice responses are given. You will need the HA app on the device and a smart plug. The Inject Node is used for testing.

Change the entity_id’s and you should be good to go.

Any input appreciated. Enjoy.

[{"id":"798afcff.7da324","type":"tab","label":"Tablet Charging","disabled":false,"info":""},{"id":"9cb0cc9f.d47cb8","type":"api-current-state","z":"798afcff.7da324","name":"Is Tablet Charged ?","server":"ceea5ac5.1b1658","version":1,"outputs":2,"halt_if":"99","halt_if_type":"num","halt_if_compare":"gt","override_topic":false,"entity_id":"sensor.sm_p555_battery_level","state_type":"num","state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","blockInputOverrides":false,"x":330,"y":160,"wires":[["aaa67ff6.905d38"],[]]},{"id":"69cdfd45.9402fc","type":"poll-state","z":"798afcff.7da324","name":"Check charger","server":"be196a96.e67d88","version":1,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"updateinterval":"60","updateIntervalUnits":"seconds","outputinitially":false,"outputonchanged":false,"entity_id":"binary_sensor.sm_p555_is_charging","state_type":"str","halt_if":"on","halt_if_type":"str","halt_if_compare":"is","outputs":2,"x":120,"y":200,"wires":[["9cb0cc9f.d47cb8"],[]]},{"id":"5d4127a.78892d8","type":"api-call-service","z":"798afcff.7da324","name":"Turn off plug","server":"be196a96.e67d88","version":1,"debugenabled":false,"service_domain":"switch","service":"turn_off","entityId":"switch.kitchen_plug","data":"","dataType":"jsonata","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":790,"y":260,"wires":[[]]},{"id":"1e86f303.c994b5","type":"api-current-state","z":"798afcff.7da324","name":"Is Tablet Charged ?","server":"ceea5ac5.1b1658","version":1,"outputs":2,"halt_if":"55","halt_if_type":"num","halt_if_compare":"lt","override_topic":false,"entity_id":"sensor.sm_p555_battery_level","state_type":"num","state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","blockInputOverrides":false,"x":430,"y":660,"wires":[["83aaa1a8.cfc148"],[]]},{"id":"186c41e4.b7996e","type":"time-range-switch","z":"798afcff.7da324","name":"Is it OK to notify ?","lat":"","lon":"","startTime":"11:30","endTime":"22:00","startOffset":0,"endOffset":0,"x":410,"y":760,"wires":[["1e86f303.c994b5"],[]]},{"id":"681d7f6e.9f7358","type":"poll-state","z":"798afcff.7da324","name":"Check charger","server":"be196a96.e67d88","version":1,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"updateinterval":"15","updateIntervalUnits":"minutes","outputinitially":false,"outputonchanged":false,"entity_id":"binary_sensor.sm_p555_is_charging","state_type":"str","halt_if":"on","halt_if_type":"str","halt_if_compare":"is","outputs":2,"x":140,"y":760,"wires":[[],["186c41e4.b7996e"]]},{"id":"aaa67ff6.905d38","type":"time-range-switch","z":"798afcff.7da324","name":"Is it OK to notify ?","lat":"","lon":"","startTime":"11:30","endTime":"22:00","startOffset":0,"endOffset":0,"x":470,"y":260,"wires":[["9a64290b.480a98"],["5d4127a.78892d8"]]},{"id":"1268bed.ded99c1","type":"switch","z":"798afcff.7da324","name":"Number","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"1","vt":"str"},{"t":"eq","v":"2","vt":"str"},{"t":"eq","v":"3","vt":"str"},{"t":"eq","v":"4","vt":"str"},{"t":"eq","v":"5","vt":"str"},{"t":"eq","v":"6","vt":"str"}],"checkall":"true","repair":false,"outputs":6,"x":840,"y":160,"wires":[["be22422b.59cc"],["6aeeefb3.94ebf"],["c0cc25b6.de04d8"],["5e56c68c.47f3c"],["fe2e369e.147da"],["7d5083f.b8b3b7c"]]},{"id":"9a64290b.480a98","type":"random","z":"798afcff.7da324","name":"Random Number","low":1,"high":"6","inte":"true","property":"payload","x":610,"y":140,"wires":[["1268bed.ded99c1"]]},{"id":"be22422b.59cc","type":"api-call-service","z":"798afcff.7da324","name":"📢 Alexa Lupe Voice","server":"be196a96.e67d88","version":1,"debugenabled":false,"service_domain":"notify","service":"alexa_media_living_room_echo_dot","entityId":"","data":"{\"message\":\"<voice name=\\\"Mía\\\"><amazon:domain name=\\\"news\\\">Hi Dianna; your tablet is fully charged.</amazon:domain></voice>\",\"data\":{\"type\":\"announce\",\"method\":\"speak\"},\"target\":[\"media_player.living_room_echo_dot\"]}","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":1120,"y":40,"wires":[[]]},{"id":"6aeeefb3.94ebf","type":"api-call-service","z":"798afcff.7da324","name":"📢 Alexa Joey Voice","server":"be196a96.e67d88","version":1,"debugenabled":false,"service_domain":"notify","service":"alexa_media_living_room_echo_dot","entityId":"","data":"{\"message\":\"<voice name=\\\"Joey\\\"><amazon:domain name=\\\"news\\\">Hi Dianna; your tablet is fully charged.</amazon:domain></voice>\",\"data\":{\"type\":\"announce\",\"method\":\"speak\"},\"target\":[\"media_player.living_room_echo_dot\"]}","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":1120,"y":100,"wires":[[]]},{"id":"c0cc25b6.de04d8","type":"api-call-service","z":"798afcff.7da324","name":"📢 Alexa Polly Voice","server":"be196a96.e67d88","version":1,"debugenabled":false,"service_domain":"notify","service":"alexa_media_living_room_echo_dot","entityId":"","data":"{\"message\":\"<voice name=\\\"Polly\\\"><amazon:domain name=\\\"news\\\">Hi Dianna; your tablet is fully charged.</amazon:domain></voice>\",\"data\":{\"type\":\"announce\",\"method\":\"speak\"},\"target\":[\"media_player.living_room_echo_dot\"]}","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":1120,"y":160,"wires":[[]]},{"id":"fe2e369e.147da","type":"api-call-service","z":"798afcff.7da324","name":"📢 Alexa Nicole Voice","server":"be196a96.e67d88","version":1,"debugenabled":false,"service_domain":"notify","service":"alexa_media_living_room_echo_dot","entityId":"","data":"{\"message\":\"<voice name=\\\"Nicole\\\"><amazon:domain name=\\\"news\\\">Hi Dianna; your tablet is fully charged.</amazon:domain></voice>\",\"data\":{\"type\":\"announce\",\"method\":\"speak\"},\"target\":[\"media_player.living_room_echo_dot\"]}","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":1120,"y":280,"wires":[[]]},{"id":"5e56c68c.47f3c","type":"api-call-service","z":"798afcff.7da324","name":"📢 Alexa Matthew Voice","server":"be196a96.e67d88","version":1,"debugenabled":false,"service_domain":"notify","service":"alexa_media_living_room_echo_dot","entityId":"","data":"{\"message\":\"<voice name=\\\"Matthew\\\"><amazon:domain name=\\\"news\\\">Hi Dianna; your tablet is fully charged.</amazon:domain></voice>\",\"data\":{\"type\":\"announce\",\"method\":\"speak\"},\"target\":[\"media_player.living_room_echo_dot\"]}","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":1130,"y":220,"wires":[[]]},{"id":"868c45c3.877978","type":"inject","z":"798afcff.7da324","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":140,"y":660,"wires":[["1e86f303.c994b5"]]},{"id":"c19f3f76.32f2b8","type":"switch","z":"798afcff.7da324","name":"Number","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"1","vt":"str"},{"t":"eq","v":"2","vt":"str"},{"t":"eq","v":"3","vt":"str"},{"t":"eq","v":"4","vt":"str"},{"t":"eq","v":"5","vt":"str"},{"t":"eq","v":"6","vt":"str"}],"checkall":"true","repair":false,"outputs":6,"x":840,"y":600,"wires":[["7b5019a3.561ce"],["1b20567a.738652"],["d1609d1e.4344d8"],["75cd8cae.10601c"],["f6ce0009.1e9508"],["e7fdbd06.7cb0a8"]]},{"id":"83aaa1a8.cfc148","type":"random","z":"798afcff.7da324","name":"Random Number","low":1,"high":"6","inte":"true","property":"payload","x":610,"y":600,"wires":[["c19f3f76.32f2b8"]]},{"id":"7b5019a3.561ce","type":"api-call-service","z":"798afcff.7da324","name":"📢 Alexa Lupe Voice","server":"be196a96.e67d88","version":1,"debugenabled":false,"service_domain":"notify","service":"alexa_media_living_room_echo_dot","entityId":"","data":"{\"message\":\"<voice name=\\\"Lupe\\\"><amazon:domain name=\\\"news\\\">Hi Dianna; your tablet needs charging.</amazon:domain></voice>\",\"data\":{\"type\":\"announce\",\"method\":\"speak\"},\"target\":[\"media_player.living_room_echo_dot\"]}","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":1120,"y":460,"wires":[[]]},{"id":"1b20567a.738652","type":"api-call-service","z":"798afcff.7da324","name":"📢 Alexa Joey Voice","server":"be196a96.e67d88","version":1,"debugenabled":false,"service_domain":"notify","service":"alexa_media_living_room_echo_dot","entityId":"","data":"{\"message\":\"<voice name=\\\"Joey\\\"><amazon:domain name=\\\"news\\\">Hi Dianna; your tablet needs charging</amazon:domain></voice>\",\"data\":{\"type\":\"announce\",\"method\":\"speak\"},\"target\":[\"media_player.living_room_echo_dot\"]}","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":1120,"y":520,"wires":[[]]},{"id":"d1609d1e.4344d8","type":"api-call-service","z":"798afcff.7da324","name":"📢 Alexa Kimberly Voice","server":"be196a96.e67d88","version":1,"debugenabled":false,"service_domain":"notify","service":"alexa_media_living_room_echo_dot","entityId":"","data":"{\"message\":\"<voice name=\\\"Kimberly\\\"><amazon:domain name=\\\"news\\\">Hi Dianna; your tablet needs charging.</amazon:domain></voice>\",\"data\":{\"type\":\"announce\",\"method\":\"speak\"},\"target\":[\"media_player.living_room_echo_dot\"]}","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":1130,"y":580,"wires":[[]]},{"id":"f6ce0009.1e9508","type":"api-call-service","z":"798afcff.7da324","name":"📢 Alexa Nicole Voice","server":"be196a96.e67d88","version":1,"debugenabled":false,"service_domain":"notify","service":"alexa_media_living_room_echo_dot","entityId":"","data":"{\"message\":\"<voice name=\\\"Nicole\\\"><amazon:domain name=\\\"news\\\">Hi Dianna; your tablet needs charging.</amazon:domain></voice>\",\"data\":{\"type\":\"announce\",\"method\":\"speak\"},\"target\":[\"media_player.living_room_echo_dot\"]}","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":1120,"y":700,"wires":[[]]},{"id":"75cd8cae.10601c","type":"api-call-service","z":"798afcff.7da324","name":"📢 Alexa Matthew Voice","server":"be196a96.e67d88","version":1,"debugenabled":false,"service_domain":"notify","service":"alexa_media_living_room_echo_dot","entityId":"","data":"{\"message\":\"<voice name=\\\"Matthew\\\"><amazon:domain name=\\\"news\\\">Hi Dianna; your tablet needs charging.</amazon:domain></voice>\",\"data\":{\"type\":\"announce\",\"method\":\"speak\"},\"target\":[\"media_player.living_room_echo_dot\"]}","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":1130,"y":640,"wires":[[]]},{"id":"e7fdbd06.7cb0a8","type":"api-call-service","z":"798afcff.7da324","name":"📢 Whispering Voice","server":"be196a96.e67d88","version":1,"debugenabled":false,"service_domain":"notify","service":"alexa_media_living_room_echo_dot","entityId":"","data":"{\"message\":\"<amazon:effect name='whispered'>Hi Dianna, your tablet needs charging.</amazon:effect>\",\"data\":{\"type\":\"announce\",\"method\":\"speak\"},\"target\":[\"media_player.living_room_echo_dot\"]}","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":1120,"y":760,"wires":[[]]},{"id":"7d5083f.b8b3b7c","type":"api-call-service","z":"798afcff.7da324","name":"📢 Whispering Voice","server":"be196a96.e67d88","version":1,"debugenabled":false,"service_domain":"notify","service":"alexa_media_living_room_echo_dot","entityId":"","data":"{\"message\":\"<amazon:effect name='whispered'>Hi Dianna, your tablet is fully charged.</amazon:effect>\",\"data\":{\"type\":\"announce\",\"method\":\"speak\"},\"target\":[\"media_player.living_room_echo_dot\"]}","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":1120,"y":340,"wires":[[]]},{"id":"58af2f89.c0f388","type":"inject","z":"798afcff.7da324","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":120,"y":140,"wires":[["9cb0cc9f.d47cb8"]]},{"id":"1078d0f2.7ecba7","type":"comment","z":"798afcff.7da324","name":"Charged","info":"","x":120,"y":100,"wires":[]},{"id":"89fce5cf.59fbc8","type":"comment","z":"798afcff.7da324","name":"Needs Charging","info":"","x":140,"y":620,"wires":[]},{"id":"ceea5ac5.1b1658","type":"server","name":"Home Assistant","addon":true},{"id":"be196a96.e67d88","type":"server","name":"Home Assistant","legacy":false,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true}]

2 Likes