Previous post became obsolete, this method is working as of 04/07/2021
7/7/2021 - Both node-red-contrib-alexa-remote2-applestrudel and Alexa Media Player seem to have problems getting Alexa events consistently. It’s not terrible, but maybe 1 out of 10 times the “Currently listening device” flow won’t do its job. It’s not a problem of the flow itself, those issues will be resolved at some point with updates for those two components
With Alexa Media Player
- You need to create an input_boolean.room_aware.
- You need to have Alexa Media Player component installed.
- You will need node-red-contrib-amazon-echo.
Currently listening device
This flow gets the currently listening device and stores it in a flow variable.
[{"id":"a68fa6c.573dd58","type":"comment","z":"877467b7.3b2fb8","name":"Setting currently listening device","info":"","x":1570,"y":100,"wires":[]},{"id":"ae2bdde6.40c2d","type":"api-call-service","z":"877467b7.3b2fb8","name":"input on","server":"9405c3fe.d0a6c","version":1,"debugenabled":false,"service_domain":"homeassistant","service":"turn_on","entityId":"input_boolean.room_aware","data":"","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":2080,"y":200,"wires":[["5ac29017.2a519"]]},{"id":"346e8b21.278eb4","type":"api-call-service","z":"877467b7.3b2fb8","name":"input off","server":"9405c3fe.d0a6c","version":1,"debugenabled":false,"service_domain":"homeassistant","service":"turn_off","entityId":"input_boolean.room_aware","data":"","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":2280,"y":200,"wires":[[]]},{"id":"65eeb9ff.f15568","type":"change","z":"877467b7.3b2fb8","name":"","rules":[{"t":"delete","p":"payload","pt":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":1975,"y":200,"wires":[["ae2bdde6.40c2d"]],"l":false},{"id":"5ac29017.2a519","type":"trigger","z":"877467b7.3b2fb8","name":"","op1":"","op2":"0","op1type":"nul","op2type":"str","duration":"10","extend":true,"overrideDelay":false,"units":"s","reset":"","bytopic":"all","topic":"topic","outputs":1,"x":2175,"y":200,"wires":[["346e8b21.278eb4"]],"l":false},{"id":"27051631.2b3b9a","type":"server-events","z":"877467b7.3b2fb8","name":"Alexa media player","server":"9405c3fe.d0a6c","event_type":"state_changed","exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"waitForRunning":true,"x":1530,"y":200,"wires":[["c5030371.c4747"]]},{"id":"c5030371.c4747","type":"switch","z":"877467b7.3b2fb8","name":"","property":"payload.event.new_state.attributes.last_called","propertyType":"msg","rules":[{"t":"true"}],"checkall":"true","repair":false,"outputs":1,"x":1675,"y":200,"wires":[["6bc78314.18073c"]],"l":false},{"id":"6bc78314.18073c","type":"change","z":"877467b7.3b2fb8","name":"Set Echo you're talking to","rules":[{"t":"set","p":"echodevice","pt":"flow","to":"payload.event.new_state.attributes.friendly_name","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":1830,"y":200,"wires":[["65eeb9ff.f15568"]]},{"id":"9405c3fe.d0a6c","type":"server","name":"Home Assistant","addon":true}]
It works better than using the yaml based last called sensor as a condition since the input boolean allows the other flows to continue when and only when the last called device has been surely retrieved. Something similar could be achieved with a yaml automation though. It’s very hard, if not impossible, to run into false positives, like lights from other rooms turning on by mistake due to the last called sensor not updating fast enough.
Just copy and paste this part and put it in the same board/flow as the next part.
Room aware lights
[{"id":"401c9a3e.0b2e34","type":"link in","z":"877467b7.3b2fb8","name":"Amazon Echo Hub in","links":["61cde6c.c6ddf18"],"x":95,"y":740,"wires":[["fbab8f8.37d637","990d39ad.bd6c28"]]},{"id":"fbab8f8.37d637","type":"amazon-echo-device","z":"877467b7.3b2fb8","name":"La luz","topic":"","x":190,"y":720,"wires":[["707cfe18.c0ef"]]},{"id":"990d39ad.bd6c28","type":"amazon-echo-device","z":"877467b7.3b2fb8","name":"Luz","topic":"","x":190,"y":760,"wires":[["707cfe18.c0ef"]]},{"id":"8fb91032.8dfb1","type":"ha-wait-until","z":"877467b7.3b2fb8","name":"","server":"9405c3fe.d0a6c","outputs":2,"entityId":"input_boolean.room_aware","entityIdFilterType":"exact","property":"state","comparator":"is","value":"on","valueType":"str","timeout":"10","timeoutType":"num","timeoutUnits":"seconds","entityLocation":"","entityLocationType":"none","checkCurrentState":true,"blockInputOverrides":true,"x":335,"y":740,"wires":[["e15e9fef.f41b7","173d7bed.7a57a4"],[]],"l":false},{"id":"e15e9fef.f41b7","type":"api-call-service","z":"877467b7.3b2fb8","name":"input off","server":"9405c3fe.d0a6c","version":1,"debugenabled":false,"service_domain":"homeassistant","service":"turn_off","entityId":"input_boolean.room_aware","data":"","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":340,"y":680,"wires":[[]]},{"id":"707cfe18.c0ef","type":"trigger","z":"877467b7.3b2fb8","name":"","op1":"","op2":"","op1type":"nul","op2type":"payl","duration":"150","extend":true,"overrideDelay":false,"units":"ms","reset":"","bytopic":"all","topic":"topic","outputs":1,"x":275,"y":740,"wires":[["8fb91032.8dfb1"]],"l":false},{"id":"27b89df.7955a62","type":"change","z":"877467b7.3b2fb8","name":"","rules":[{"t":"delete","p":"payload","pt":"msg"},{"t":"change","p":"meta.input.on","pt":"msg","from":"true","fromt":"bool","to":"turn_on","tot":"str"},{"t":"change","p":"meta.input.on","pt":"msg","from":"false","fromt":"bool","to":"turn_off","tot":"str"},{"t":"set","p":"service","pt":"msg","to":"meta.input.on","tot":"msg"},{"t":"change","p":"meta.input.hue","pt":"msg","from":"meta.input.hue","fromt":"msg","to":"rgb","tot":"msg"},{"t":"set","p":"payload.data.rgb_color","pt":"msg","to":"meta.input.hue","tot":"msg"},{"t":"change","p":"meta.input.ct","pt":"msg","from":"meta.input.ct","fromt":"msg","to":"ct","tot":"msg"},{"t":"set","p":"payload.data.color_temp","pt":"msg","to":"$number(meta.input.ct) - 34","tot":"jsonata"},{"t":"change","p":"meta.input.bri","pt":"msg","from":"meta.input.bri","fromt":"msg","to":"percentage","tot":"msg"},{"t":"set","p":"payload.data.brightness_pct","pt":"msg","to":"meta.input.bri","tot":"msg"},{"t":"set","p":"payload.data.transition","pt":"msg","to":"1","tot":"num"}],"action":"","property":"","from":"","to":"","reg":false,"x":600,"y":740,"wires":[["6ecb103a.29f2e"]]},{"id":"6ecb103a.29f2e","type":"api-call-service","z":"877467b7.3b2fb8","name":"Light","server":"9405c3fe.d0a6c","version":1,"debugenabled":false,"service_domain":"light","service":"{{service}}","entityId":"{{entity_id}}","data":"","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":750,"y":740,"wires":[[]]},{"id":"cff52c1.92fb6d","type":"comment","z":"877467b7.3b2fb8","name":"Lights","info":"","x":130,"y":600,"wires":[]},{"id":"173d7bed.7a57a4","type":"change","z":"877467b7.3b2fb8","name":"Set entity","rules":[{"t":"set","p":"entity_id","pt":"msg","to":"echodevice","tot":"flow"},{"t":"change","p":"entity_id","pt":"msg","from":"Echo device 1","fromt":"str","to":"light.light_1","tot":"str"},{"t":"change","p":"entity_id","pt":"msg","from":"Echo device 2","fromt":"str","to":"light.light_2, light.light_3","tot":"str"},{"t":"change","p":"entity_id","pt":"msg","from":"Echo device 3","fromt":"str","to":"light.light_4","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":440,"y":740,"wires":[["27b89df.7955a62"]]},{"id":"9405c3fe.d0a6c","type":"server","name":"Home Assistant","addon":true}]
This is an example with lights. You should create two devices with node-red-contrib-amazon-echo, light & the light (and even lights and the lights if you use them) as creating all of them increases compatibility.
Under Set entity, set your entity or comma sepparated string of entities related to each echo device. Echo devices should be typed exactly as they show up in your Alexa app.
Done! It should be working by now, you needn’t do anything else
You can change the transition whithin the later change node, you can find it in the bottom of the list.
-----------------------------------------------------------------------------------------------------------------------------------------
You should use node-red-contrib-alexa-remote2-applestrudel for the first section, cakebaked is obsolete
If you preffer it:
[{"id":"ee3c5fed.ec2e1","type":"alexa-remote-event","z":"877467b7.3b2fb8","name":"On device activity","account":"7c02d978.c2de98","event":"ws-device-activity","x":180,"y":240,"wires":[["85e53f62.7a3eb"]]},{"id":"4ac2d190.b7afa","type":"change","z":"877467b7.3b2fb8","name":"Set Echo you're talking to","rules":[{"t":"set","p":"echoDeviceSerial","pt":"global","to":"payload.deviceSerialNumber","tot":"msg"},{"t":"set","p":"echodevice","pt":"global","to":"payload.name","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":590,"y":240,"wires":[["33080b5e.c00114"]]},{"id":"aa7c9bb4.102938","type":"api-call-service","z":"877467b7.3b2fb8","name":"input on","server":"9405c3fe.d0a6c","version":5,"debugenabled":false,"domain":"homeassistant","service":"turn_on","areaId":[],"deviceId":[],"entityId":["input_boolean.room_aware"],"data":"","dataType":"json","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":840,"y":240,"wires":[["972b78be.7156a8"]]},{"id":"51080f6c.28cb3","type":"api-call-service","z":"877467b7.3b2fb8","name":"input off","server":"9405c3fe.d0a6c","version":5,"debugenabled":false,"domain":"homeassistant","service":"turn_off","areaId":[],"deviceId":[],"entityId":["input_boolean.room_aware"],"data":"","dataType":"json","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1060,"y":240,"wires":[[]]},{"id":"33080b5e.c00114","type":"change","z":"877467b7.3b2fb8","name":"","rules":[{"t":"delete","p":"payload","pt":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":735,"y":240,"wires":[["aa7c9bb4.102938"]],"l":false},{"id":"972b78be.7156a8","type":"trigger","z":"877467b7.3b2fb8","name":"","op1":"","op2":"0","op1type":"nul","op2type":"str","duration":"10","extend":true,"overrideDelay":false,"units":"s","reset":"","bytopic":"all","topic":"topic","outputs":1,"x":935,"y":240,"wires":[["51080f6c.28cb3"]],"l":false},{"id":"85e53f62.7a3eb","type":"switch","z":"877467b7.3b2fb8","name":"","property":"payload.data.utteranceType","propertyType":"msg","rules":[{"t":"eq","v":"GENERAL","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":355,"y":240,"wires":[["4ac2d190.b7afa"]],"l":false},{"id":"7c02d978.c2de98","type":"alexa-remote-account","name":"","authMethod":"proxy","proxyOwnIp":"192.168.1.29","proxyPort":"1234","cookieFile":"/config/.storage/authentication","refreshInterval":"3","alexaServiceHost":"alexa.amazon.es","pushDispatchHost":"","amazonPage":"amazon.es","acceptLanguage":"es-ES","onKeywordInLanguage":"on","userAgent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/15.5 Safari/605.1.15","usePushConnection":"on","autoInit":"on"},{"id":"9405c3fe.d0a6c","type":"server","name":"Home Assistant","version":5,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true,"heartbeat":false,"heartbeatInterval":30,"areaSelector":"friendlyName","deviceSelector":"friendlyName","entitySelector":"friendlyName","statusSeparator":"at: ","statusYear":"hidden","statusMonth":"short","statusDay":"numeric","statusHourCycle":"h23","statusTimeFormat":"h:m","enableGlobalContextStore":true}]
-----------------------------------------------------------------------------------------------------------------------------------------
You can more easily integrate other types of devices using node-red-contrib-alexa-home-skill
EXAMPLE WITH FANS.
This one could easily be done with the other too
[{"id":"d24786c2.2b4078","type":"ha-wait-until","z":"7fd466a.0d41e98","name":"","server":"9405c3fe.d0a6c","outputs":2,"entityId":"input_boolean.room_aware","entityIdFilterType":"exact","property":"state","comparator":"is","value":"on","valueType":"str","timeout":"7","timeoutType":"num","timeoutUnits":"seconds","entityLocation":"","entityLocationType":"none","checkCurrentState":true,"blockInputOverrides":true,"x":155,"y":360,"wires":[["5e8b78b5.d8bcb8","ac4bf641.625088"],[]],"l":false},{"id":"5e8b78b5.d8bcb8","type":"api-call-service","z":"7fd466a.0d41e98","name":"input off","server":"9405c3fe.d0a6c","version":1,"debugenabled":false,"service_domain":"homeassistant","service":"turn_off","entityId":"input_boolean.room_aware","data":"","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":240,"y":300,"wires":[[]]},{"id":"ac4bf641.625088","type":"switch","z":"7fd466a.0d41e98","name":"Echo Device?","property":"echodevice","propertyType":"flow","rules":[{"t":"eq","v":"Echo Dot","vt":"str"},{"t":"eq","v":"Your second echo device","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":340,"y":360,"wires":[["1a625271.e3916e"],["e9e83113.14e01"]]},{"id":"8e574cf9.a11f3","type":"switch","z":"7fd466a.0d41e98","name":"Action?","property":"command","propertyType":"msg","rules":[{"t":"eq","v":"SetPercentageRequest","vt":"str"},{"t":"eq","v":"TurnOnRequest","vt":"str"},{"t":"eq","v":"TurnOffRequest","vt":"str"},{"t":"eq","v":"IncrementPercentageRequest","vt":"str"},{"t":"eq","v":"DecrementPercentageRequest","vt":"str"}],"checkall":"true","repair":false,"outputs":5,"x":580,"y":360,"wires":[["65b4f64a.d1d5b8"],["14703901.766ae7"],["13ac203c.68ec6"],["7e5a04cb.9a9f2c"],["9e782d2e.9e2bd"]]},{"id":"1a625271.e3916e","type":"change","z":"7fd466a.0d41e98","name":"","rules":[{"t":"set","p":"fan_entity_id","pt":"flow","to":"fan.fan1","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":475,"y":340,"wires":[["8e574cf9.a11f3"]],"l":false},{"id":"14703901.766ae7","type":"api-call-service","z":"7fd466a.0d41e98","name":"Turn on","server":"9405c3fe.d0a6c","version":1,"debugenabled":false,"service_domain":"input_number","service":"set_value","entityId":"input_number.fan_speed","data":"{\"value\": \"1.0\"}","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":840,"y":400,"wires":[[]]},{"id":"13ac203c.68ec6","type":"api-call-service","z":"7fd466a.0d41e98","name":"Turn off","server":"9405c3fe.d0a6c","version":1,"debugenabled":false,"service_domain":"input_number","service":"set_value","entityId":"input_number.fan_speed","data":"{\"value\": \"0.0\"}","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":840,"y":440,"wires":[[]]},{"id":"a7c20b40.946118","type":"api-call-service","z":"7fd466a.0d41e98","name":"Increment","server":"9405c3fe.d0a6c","version":1,"debugenabled":false,"service_domain":"input_number","service":"increment","entityId":"input_number.fan_speed","data":"","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":840,"y":480,"wires":[[]]},{"id":"e8be74b9.b74d38","type":"api-call-service","z":"7fd466a.0d41e98","name":"Decrement","server":"9405c3fe.d0a6c","version":1,"debugenabled":false,"service_domain":"input_number","service":"decrement","entityId":"input_number.fan_speed","data":"","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":850,"y":560,"wires":[[]]},{"id":"af5a9dc0.9e30d","type":"api-call-service","z":"7fd466a.0d41e98","name":"Set","server":"9405c3fe.d0a6c","version":1,"debugenabled":false,"service_domain":"input_number","service":"set_value","entityId":"input_number.fan_speed","data":"{\"value\": \"{{payload}}\"}","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":950,"y":300,"wires":[[]]},{"id":"f0fcb16e.3ffae","type":"server-state-changed","z":"7fd466a.0d41e98","name":"Input number","server":"9405c3fe.d0a6c","version":1,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"input_number.fan_speed","entityidfiltertype":"exact","outputinitially":false,"state_type":"num","haltifstate":"","halt_if_type":"str","halt_if_compare":"is","outputs":1,"output_only_on_state_change":true,"for":0,"forType":"num","forUnits":"minutes","ignorePrevStateNull":false,"ignorePrevStateUnknown":false,"ignorePrevStateUnavailable":false,"ignoreCurrentStateUnknown":false,"ignoreCurrentStateUnavailable":false,"x":1150,"y":380,"wires":[["f844bb4f.cd2b58"]]},{"id":"f844bb4f.cd2b58","type":"switch","z":"7fd466a.0d41e98","name":"Speed","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"0.0","vt":"str"},{"t":"eq","v":"1.0","vt":"str"},{"t":"eq","v":"2.0","vt":"str"},{"t":"eq","v":"3.0","vt":"str"}],"checkall":"true","repair":false,"outputs":4,"x":1300,"y":380,"wires":[["1b08a13.0f5815f"],["5771095d.b318e8"],["c9d0473e.5a0db8"],["a9472270.22ffb"]]},{"id":"1b08a13.0f5815f","type":"api-call-service","z":"7fd466a.0d41e98","name":"Turn off fan","server":"9405c3fe.d0a6c","version":1,"debugenabled":false,"service_domain":"","service":"","entityId":"{{flow.fan_entity_id}}","data":"","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":1470,"y":320,"wires":[[]]},{"id":"5771095d.b318e8","type":"api-call-service","z":"7fd466a.0d41e98","name":"Fan to low","server":"9405c3fe.d0a6c","version":1,"debugenabled":false,"service_domain":"","service":"","entityId":"{{flow.fan_entity_id}}","data":"","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":1470,"y":360,"wires":[[]]},{"id":"c9d0473e.5a0db8","type":"api-call-service","z":"7fd466a.0d41e98","name":"Fan to medium","server":"9405c3fe.d0a6c","version":1,"debugenabled":false,"service_domain":"","service":"","entityId":"{{flow.fan_entity_id}}","data":"","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":1480,"y":400,"wires":[[]]},{"id":"a9472270.22ffb","type":"api-call-service","z":"7fd466a.0d41e98","name":"Fan to high","server":"9405c3fe.d0a6c","version":1,"debugenabled":false,"service_domain":"","service":"","entityId":"{{flow.fan_entity_id}}","data":"","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":1470,"y":440,"wires":[[]]},{"id":"e9e83113.14e01","type":"change","z":"7fd466a.0d41e98","name":"","rules":[{"t":"set","p":"fan_entity_id","pt":"flow","to":"fan.fan2","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":475,"y":380,"wires":[["8e574cf9.a11f3"]],"l":false},{"id":"65b4f64a.d1d5b8","type":"switch","z":"7fd466a.0d41e98","name":"","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"10","vt":"num"},{"t":"eq","v":"50","vt":"num"},{"t":"eq","v":"100","vt":"num"},{"t":"eq","v":"0","vt":"str"},{"t":"eq","v":"1","vt":"str"},{"t":"eq","v":"2","vt":"str"},{"t":"eq","v":"3","vt":"str"},{"t":"else"}],"checkall":"false","repair":false,"outputs":8,"x":735,"y":280,"wires":[["1f92e528.7d35ab"],["b6a40d99.4da3b"],["ad727808.dc1588"],["af5a9dc0.9e30d"],["af5a9dc0.9e30d"],["af5a9dc0.9e30d"],["af5a9dc0.9e30d"],["58b1adfd.85ae74"]],"l":false},{"id":"1f92e528.7d35ab","type":"change","z":"7fd466a.0d41e98","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"1","tot":"num"}],"action":"","property":"","from":"","to":"","reg":false,"x":815,"y":180,"wires":[["af5a9dc0.9e30d"]],"l":false},{"id":"b6a40d99.4da3b","type":"change","z":"7fd466a.0d41e98","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"2","tot":"num"}],"action":"","property":"","from":"","to":"","reg":false,"x":815,"y":220,"wires":[["af5a9dc0.9e30d"]],"l":false},{"id":"ad727808.dc1588","type":"change","z":"7fd466a.0d41e98","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"3","tot":"num"}],"action":"","property":"","from":"","to":"","reg":false,"x":815,"y":260,"wires":[["af5a9dc0.9e30d"]],"l":false},{"id":"7e5a04cb.9a9f2c","type":"api-current-state","z":"7fd466a.0d41e98","name":"","server":"9405c3fe.d0a6c","version":1,"outputs":2,"halt_if":"2","halt_if_type":"num","halt_if_compare":"lte","override_topic":false,"entity_id":"input_number.fan_speed","state_type":"num","state_location":"","override_payload":"none","entity_location":"","override_data":"none","blockInputOverrides":false,"x":735,"y":500,"wires":[["a7c20b40.946118"],["773c7f48.b1978"]],"l":false},{"id":"773c7f48.b1978","type":"alexa-remote-routine","z":"7fd466a.0d41e98","name":"Error max","account":"85bd714f.ef94d","routineNode":{"type":"speak","payload":{"type":"regular","text":{"type":"str","value":"Fan is already set to high"},"devices":{"type":"flow","value":"echoDeviceSerial"}}},"x":840,"y":520,"wires":[[]]},{"id":"9e782d2e.9e2bd","type":"api-current-state","z":"7fd466a.0d41e98","name":"","server":"9405c3fe.d0a6c","version":1,"outputs":2,"halt_if":"2","halt_if_type":"num","halt_if_compare":"gte","override_topic":false,"entity_id":"input_number.fan_speed","state_type":"num","state_location":"","override_payload":"none","entity_location":"","override_data":"none","blockInputOverrides":false,"x":735,"y":580,"wires":[["e8be74b9.b74d38"],["38a6e3a4.8ce39c"]],"l":false},{"id":"38a6e3a4.8ce39c","type":"alexa-remote-routine","z":"7fd466a.0d41e98","name":"Error min","account":"85bd714f.ef94d","routineNode":{"type":"speak","payload":{"type":"regular","text":{"type":"str","value":"Fan is already set to low"},"devices":{"type":"flow","value":"echoDeviceSerial"}}},"x":840,"y":600,"wires":[[]]},{"id":"58b1adfd.85ae74","type":"alexa-remote-routine","z":"7fd466a.0d41e98","name":"Error","account":"85bd714f.ef94d","routineNode":{"type":"speak","payload":{"type":"regular","text":{"type":"str","value":"Fan doesn't operate under this parameter"},"devices":{"type":"flow","value":"echoDeviceSerial"}}},"x":830,"y":340,"wires":[[]]},{"id":"9405c3fe.d0a6c","type":"server","name":"Home Assistant","addon":true},{"id":"85bd714f.ef94d","type":"alexa-remote-account","name":"","authMethod":"proxy","proxyOwnIp":"localhost","proxyPort":"3456","cookieFile":"","refreshInterval":"3","alexaServiceHost":"pitangui.amazon.com","amazonPage":"amazon.es","acceptLanguage":"","userAgent":"","useWsMqtt":"on","autoInit":"on"}]
-----------------------------------------------------------------------------------------------------------------------------------------
EXAMPLE WITH THERMOSTAT.
[{"id":"5ff3cc29.ad7c04","type":"comment","z":"5701b8c7.b4f238","name":"Thermostat example","info":"","x":150,"y":260,"wires":[]},{"id":"ae3dd514.a53828","type":"switch","z":"5701b8c7.b4f238","name":"Echo Device?","property":"echodevice","propertyType":"flow","rules":[{"t":"eq","v":"First Echo Device","vt":"str"},{"t":"eq","v":"Second Echo Device","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":600,"y":380,"wires":[["53c34aa7.c4ca24"],["c146961e.7d4a48"]]},{"id":"35d04e69.baf142","type":"switch","z":"5701b8c7.b4f238","name":"Action?","property":"command","propertyType":"msg","rules":[{"t":"eq","v":"TurnOnRequest","vt":"str"},{"t":"eq","v":"TurnOffRequest","vt":"str"},{"t":"eq","v":"SetTargetTemperatureRequest","vt":"str"},{"t":"eq","v":"IncrementTargetTemperatureRequest","vt":"str"},{"t":"eq","v":"DecrementTargetTemperatureRequest","vt":"str"},{"t":"eq","v":"GetTemperatureReadingRequest","vt":"str"}],"checkall":"true","repair":false,"outputs":6,"x":880,"y":380,"wires":[["40f34c09.465034"],["71f4af2b.79088"],["54ae0cad.eedd44"],["76a4c33a.7bad1c"],["76a4c33a.7bad1c"],["e7562823.136188"]],"outputLabels":["On","Off","Set","Increment","Decrement","Get temperature"]},{"id":"53c34aa7.c4ca24","type":"change","z":"5701b8c7.b4f238","name":"","rules":[{"t":"set","p":"entity_id","pt":"msg","to":"Climate device entity related to first Echo device","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":735,"y":360,"wires":[["35d04e69.baf142"]],"l":false},{"id":"c146961e.7d4a48","type":"change","z":"5701b8c7.b4f238","name":"","rules":[{"t":"set","p":"entity_id","pt":"msg","to":"Climate device entity related to second Echo device","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":735,"y":400,"wires":[["35d04e69.baf142"]],"l":false},{"id":"38dae152.1018ce","type":"ha-wait-until","z":"5701b8c7.b4f238","name":"","server":"9405c3fe.d0a6c","outputs":2,"entityId":"input_boolean.your_input","entityIdFilterType":"exact","property":"state","comparator":"is","value":"on","valueType":"str","timeout":"7","timeoutType":"num","timeoutUnits":"seconds","entityLocation":"","entityLocationType":"none","checkCurrentState":true,"blockInputOverrides":true,"x":235,"y":380,"wires":[["9f8c8be7.b582c8","3204e684.0d4daa"],[]],"l":false},{"id":"9f8c8be7.b582c8","type":"api-call-service","z":"5701b8c7.b4f238","name":"input off","server":"9405c3fe.d0a6c","version":1,"debugenabled":false,"service_domain":"homeassistant","service":"turn_off","entityId":"input_boolean.your_input","data":"","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":320,"y":320,"wires":[[]]},{"id":"40f34c09.465034","type":"api-call-service","z":"5701b8c7.b4f238","name":"On","server":"9405c3fe.d0a6c","version":1,"debugenabled":false,"service_domain":"climate","service":"turn_on","entityId":"{{entity_id}}","data":"","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":1190,"y":280,"wires":[["191b3b50.76cf05"]]},{"id":"71f4af2b.79088","type":"api-call-service","z":"5701b8c7.b4f238","name":"Off","server":"9405c3fe.d0a6c","version":1,"debugenabled":false,"service_domain":"climate","service":"turn_off","entityId":"{{entity_id}}","data":"","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":1190,"y":320,"wires":[["191b3b50.76cf05"]]},{"id":"54ae0cad.eedd44","type":"api-call-service","z":"5701b8c7.b4f238","name":"Set temp","server":"9405c3fe.d0a6c","version":1,"debugenabled":false,"service_domain":"climate","service":"set_temperature","entityId":"{{entity_id}}","data":"{\"temperature\":\"{{payload}}\"}","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":1200,"y":360,"wires":[["795bd974.53ec38"]]},{"id":"df8aff82.fcdbb","type":"alexa-home-resp","z":"5701b8c7.b4f238","x":1500,"y":440,"wires":[]},{"id":"191b3b50.76cf05","type":"change","z":"5701b8c7.b4f238","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"true","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":1295,"y":300,"wires":[["df8aff82.fcdbb"]],"l":false},{"id":"795bd974.53ec38","type":"function","z":"5701b8c7.b4f238","name":"","func":"if (msg.payload < msg.min || msg.payload > msg.max) {\n var range = {\n min: msg.min,\n max: msg.max\n }\n msg.payload = false;\n msg.extra = range;\n \n\n} else {\n msg.extra = {\n targetTemperature: {\n value: msg.payload\n }\n };\n msg.payload = true;\n}\n \nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":1295,"y":360,"wires":[["df8aff82.fcdbb"]],"l":false},{"id":"76a4c33a.7bad1c","type":"api-current-state","z":"5701b8c7.b4f238","name":"","server":"9405c3fe.d0a6c","version":1,"outputs":1,"halt_if":"","halt_if_type":"str","halt_if_compare":"is","override_topic":false,"entity_id":"{{entity_id}}","state_type":"str","state_location":"climate","override_payload":"msg","entity_location":"climateData","override_data":"msg","blockInputOverrides":false,"x":1035,"y":400,"wires":[["5c880bc6.0dd234"]],"l":false},{"id":"5c880bc6.0dd234","type":"change","z":"5701b8c7.b4f238","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"$number(msg.climateData.attributes.temperature) + $number(msg.payload)","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":1095,"y":400,"wires":[["54ae0cad.eedd44"]],"l":false},{"id":"27886eb0.d6df82","type":"function","z":"5701b8c7.b4f238","name":"","func":"msg.extra = {\n \"temperatureReading\": {\n \"value\": msg.climateData.attributes.current_temperature\n },\n \"applianceResponseTimestamp\": new Date().toISOString()\n};\nmsg.payload = true;\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":1095,"y":440,"wires":[["df8aff82.fcdbb"]],"l":false},{"id":"e7562823.136188","type":"api-current-state","z":"5701b8c7.b4f238","name":"","server":"9405c3fe.d0a6c","version":1,"outputs":1,"halt_if":"","halt_if_type":"str","halt_if_compare":"is","override_topic":false,"entity_id":"{{entity_id}}","state_type":"str","state_location":"climate","override_payload":"msg","entity_location":"climateData","override_data":"msg","blockInputOverrides":false,"x":1035,"y":440,"wires":[["27886eb0.d6df82"]],"l":false},{"id":"3204e684.0d4daa","type":"change","z":"5701b8c7.b4f238","name":"min & max","rules":[{"t":"set","p":"min","pt":"msg","to":"5.0","tot":"num"},{"t":"set","p":"max","pt":"msg","to":"25.0","tot":"num"}],"action":"","property":"","from":"","to":"","reg":false,"x":410,"y":380,"wires":[["ae3dd514.a53828"]]},{"id":"9405c3fe.d0a6c","type":"server","name":"Home Assistant","addon":true}]
Disable “Auto Acknowledge” from your device node.
Fill input nodes with your input.
Fill “min & max” node with your device’s minimum and maximum working temperatures.
Fill “Echo Device?” node with your Echo devices
Fill the subsequent nodes with your entities related to each Echo device
-----------------------------------------------------------------------------------------------------------------------------------------
Other great alternative for creating virtual devices
node-red-contrib-virtual-smart-home
Only 7 virtual devices allowed in its free mode. 1€ a month for the PRO plan. It does support a great number devices to chose among though:
- Blinds
- Color Changing Light Bulb
- Contact Sensor
- Dimmable Light Bulb
- Dimmer Switch
- Entertainment Device
- Fan
- Garage Door Opener (en-US locale only)
- Lock
- Motion Sensor
- Plug
- Switch
- Scene
- Temperature Sensor
- Thermostat
-----------------------------------------------------------------------------------------------------------------------------------------
Other ideas
You can even say “Alexa, turn on Eurosport” and get the propper broadlink/TV to act .
You can request “Alexa, what’s the humidity?” and get alexa to respond with the humidity value of the area you are in through the device you made your request.
“Alexa, turn off the room”
“Alexa, close the shutter”
“Alexa, set the shutter to 35%”
etc etc
Just get rid of naming the area of the device you want to interact with like “Alexa, close the shutter of the living room”, the flow does the work for you.