Node Red Room aware Alexa voice commands

@obaldius I sincerely appreciate all the help you’re offering…but the name returned as:

payload: object
data: object
description: object
deviceSerialNumber: “removed”
name: “Echo-Flex01”
deviceType: “removed”
deviceAccountId: null
creationTimestamp: 1610682123906
activityStatus: “SUCCESS”
domainAttributes: null
destinationUserId: “removed”

The same name that I’ve been using?!

I believe this is the last step :crossed_fingers:. Do this:

In the first section, ‘Setting currently listening device’, replace ‘flow.’ with ‘global’ whithin the node ‘Set Echo you’re talking to’:

In the second section do the same whithin the node ‘Echo Device?’

I believe what happened is that you put the first section in a different flow than the second section?

Well I feel like an idiot…Your latest illustration/suggestion highlighted my problem! I assumed that each of the sequences needed to be on their on tab/flow within Node Red. When I combined the two sequences within the same flow it magically started working! lol…I apologize for all the extra work I put you through, but it did help me get a better understanding of NR. Now I’ll start playing with adding my ceiling fans to the equation! Thanks again!!!

1 Like

no problem, I’m glad you got it working. Feel free to come back

1 Like

@obaldius So I got all my room lights configured and working! Thank you…Now onto the ceiling fans. I’d like to do the same approach with the ceiling fans but am wondering if you have a good suggestion for the following:

“Alexa turn the fan on High”
“Alexa turn the fan on Medium”
“Alexa turn the fan on Low”

I can turn the fans on and off and but can’t figure out how to apply percentages based on Hi/Med/Low voice requests…

@mboarman Before trying this. Move all sections to the same flow and change ‘global’ to ‘flow’, the opposite of what you had to do the last time. It’s makes it easier for me to go on.

Regarding the NR flow, read the full post before starting to do anything:

If you want to use only the voice as a trigger:

[{"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"}]

Create an input_number like this:
image

When you make changes in your configuration.yaml (like is the case with the input_number), after restarting HA, don’t forget to restart Node Red as well, otherwise it won’t recognize any change.

Create a light device like this:

Fill “Echo Device?” node, fill the subsequent nodes with your entities, fill the last four nodes with your fan services and put your input_boolean in the beggining. Don’t touch the entity_id template from the last four nodes.

Fill the error nodes with your preferred sentences. I put some examples so you know what to put there.

When you say just “Turn on fan”, it turns it on at low by default. Change it if you like.

You can use the sentences. “Set the fan to level high”, “Set fan to medium”, “turn on fan to low”, “Turn fan to 1”, “set the fan to 2”, “Turn fan to level 3”, “Turn fan on to level 2”, “turn the fan on to 1”, “Put fan at 3” etc etc etc… 1 low, 2 medium, 3 high. Go try them… it should allow saying set/put/turn to minimun, maximum, middle, low, medium, high, 1, 2, 3, spelling level or not… and even more very likely. Pretty flexible I believe, let me know please, I can’t test it out in english.

You can also increase/decrease the fan speed with a voice command saying somehting like “Alexa, increase the fan speed” or “turn up the fan speed”, not sure to be honest… I know how to request that in Spanish, you’ll have to try it out yourself, but it has to work… If you say ‘increase the fan’ and it’s currently running at level 2, it’ll go level 3.

If you want to control your fans from a different trigger besides the voice…

If you want to control your fans, for example, with some switch (like the philips hue dimmer switch) and via Lovelace, or even if you just want to show the correct status of the fan in lovelace, you should better go this route, it’s more polished. If you want to do that you should create a different input_number for every fan. This way you’ll have a beautiful input_number for every fan in lovelace with which you will also be able to control every fan independently and will update their status if you change your fan status from some other trigger. The rest is pretty much the same than the previous example.

For this particular example, it would be input_number.fan_a_speed and input_number.fan_b_speed. Fill the circled nodes with your entities… fan.fan_a = your HA fan entity for the fan in that area, input_number.fan_a_speed = the input number you have created for that particular fan, and so on

[{"id":"febc6066.c0042","type":"ha-wait-until","z":"aa0dd480.eaf6b8","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":215,"y":280,"wires":[["7f84133e.dc2c1c","1007ff23.6f91f1"],[]],"l":false},{"id":"7f84133e.dc2c1c","type":"api-call-service","z":"aa0dd480.eaf6b8","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":300,"y":220,"wires":[[]]},{"id":"1007ff23.6f91f1","type":"switch","z":"aa0dd480.eaf6b8","name":"Echo Device?","property":"echodevice","propertyType":"flow","rules":[{"t":"eq","v":"Your first echo device","vt":"str"},{"t":"eq","v":"Your second echo device","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":400,"y":280,"wires":[["14888679.21ceda"],["54c31035.d84fe"]]},{"id":"389446ae.f6a69a","type":"switch","z":"aa0dd480.eaf6b8","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":640,"y":280,"wires":[["7a78f168.77e15"],["ed0ac782.3f17e8"],["7f3fdf0d.fc843"],["9834f63a.639718"],["c6f36ac2.c06a38"]]},{"id":"14888679.21ceda","type":"change","z":"aa0dd480.eaf6b8","name":"","rules":[{"t":"set","p":"input","pt":"msg","to":"input_number.fan_a_speed","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":535,"y":260,"wires":[["389446ae.f6a69a"]],"l":false},{"id":"ed0ac782.3f17e8","type":"api-call-service","z":"aa0dd480.eaf6b8","name":"Turn on","server":"9405c3fe.d0a6c","version":1,"debugenabled":false,"service_domain":"input_number","service":"set_value","entityId":"{{input}}","data":"{\"value\": \"1.0\"}","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":900,"y":320,"wires":[[]]},{"id":"7f3fdf0d.fc843","type":"api-call-service","z":"aa0dd480.eaf6b8","name":"Turn off","server":"9405c3fe.d0a6c","version":1,"debugenabled":false,"service_domain":"input_number","service":"set_value","entityId":"{{input}}","data":"{\"value\": \"0.0\"}","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":900,"y":360,"wires":[[]]},{"id":"48c0fbb6.a29374","type":"api-call-service","z":"aa0dd480.eaf6b8","name":"Increment","server":"9405c3fe.d0a6c","version":1,"debugenabled":false,"service_domain":"input_number","service":"increment","entityId":"{{input}}","data":"","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":900,"y":400,"wires":[[]]},{"id":"98adbd5f.0c565","type":"api-call-service","z":"aa0dd480.eaf6b8","name":"Decrement","server":"9405c3fe.d0a6c","version":1,"debugenabled":false,"service_domain":"input_number","service":"decrement","entityId":"{{input}}","data":"","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":910,"y":480,"wires":[[]]},{"id":"1c16cf99.dbabf","type":"api-call-service","z":"aa0dd480.eaf6b8","name":"Set","server":"9405c3fe.d0a6c","version":1,"debugenabled":false,"service_domain":"input_number","service":"set_value","entityId":"{{input}}","data":"{\"value\": \"{{payload}}\"}","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":1010,"y":220,"wires":[[]]},{"id":"1efb6d35.61bfe3","type":"server-state-changed","z":"aa0dd480.eaf6b8","name":"Input Fan A","server":"9405c3fe.d0a6c","version":1,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"input_number.fan_a_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":1210,"y":260,"wires":[["34c50dbf.7c9252"]]},{"id":"f98505f6.d7c748","type":"switch","z":"aa0dd480.eaf6b8","name":"Speed","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"0.0","vt":"num"},{"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":1430,"y":300,"wires":[["bfec10b1.642bd"],["1d77ceb7.207a01"],["d31716e3.461c38"],["9d42a8a6.a6ed38"]]},{"id":"bfec10b1.642bd","type":"api-call-service","z":"aa0dd480.eaf6b8","name":"Turn off fan","server":"9405c3fe.d0a6c","version":1,"debugenabled":false,"service_domain":"","service":"","entityId":"{{fan_entity_id}}","data":"","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":1600,"y":240,"wires":[[]]},{"id":"1d77ceb7.207a01","type":"api-call-service","z":"aa0dd480.eaf6b8","name":"Fan to low","server":"9405c3fe.d0a6c","version":1,"debugenabled":false,"service_domain":"","service":"","entityId":"{{fan_entity_id}}","data":"","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":1600,"y":280,"wires":[[]]},{"id":"d31716e3.461c38","type":"api-call-service","z":"aa0dd480.eaf6b8","name":"Fan to medium","server":"9405c3fe.d0a6c","version":1,"debugenabled":false,"service_domain":"","service":"","entityId":"{{fan_entity_id}}","data":"","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":1610,"y":320,"wires":[[]]},{"id":"9d42a8a6.a6ed38","type":"api-call-service","z":"aa0dd480.eaf6b8","name":"Fan to high","server":"9405c3fe.d0a6c","version":1,"debugenabled":false,"service_domain":"","service":"","entityId":"{{fan_entity_id}}","data":"","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":1600,"y":360,"wires":[[]]},{"id":"54c31035.d84fe","type":"change","z":"aa0dd480.eaf6b8","name":"","rules":[{"t":"set","p":"input","pt":"msg","to":"input_number.fan_b_speed","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":535,"y":300,"wires":[["389446ae.f6a69a"]],"l":false},{"id":"7a78f168.77e15","type":"switch","z":"aa0dd480.eaf6b8","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":795,"y":200,"wires":[["29028810.49f9a8"],["deb2a51b.b338d8"],["5a7bf75c.3cc748"],["1c16cf99.dbabf"],["1c16cf99.dbabf"],["1c16cf99.dbabf"],["1c16cf99.dbabf"],["85d02415.d15008"]],"l":false},{"id":"29028810.49f9a8","type":"change","z":"aa0dd480.eaf6b8","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"1","tot":"num"}],"action":"","property":"","from":"","to":"","reg":false,"x":875,"y":100,"wires":[["1c16cf99.dbabf"]],"l":false},{"id":"deb2a51b.b338d8","type":"change","z":"aa0dd480.eaf6b8","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"2","tot":"num"}],"action":"","property":"","from":"","to":"","reg":false,"x":875,"y":140,"wires":[["1c16cf99.dbabf"]],"l":false},{"id":"5a7bf75c.3cc748","type":"change","z":"aa0dd480.eaf6b8","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"3","tot":"num"}],"action":"","property":"","from":"","to":"","reg":false,"x":875,"y":180,"wires":[["1c16cf99.dbabf"]],"l":false},{"id":"9834f63a.639718","type":"api-current-state","z":"aa0dd480.eaf6b8","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}}","state_type":"num","state_location":"","override_payload":"none","entity_location":"","override_data":"none","blockInputOverrides":false,"x":795,"y":420,"wires":[["48c0fbb6.a29374"],["3f8461fc.567ece"]],"l":false},{"id":"3f8461fc.567ece","type":"alexa-remote-routine","z":"aa0dd480.eaf6b8","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":900,"y":440,"wires":[[]]},{"id":"c6f36ac2.c06a38","type":"api-current-state","z":"aa0dd480.eaf6b8","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}}","state_type":"num","state_location":"","override_payload":"none","entity_location":"","override_data":"none","blockInputOverrides":false,"x":795,"y":500,"wires":[["98adbd5f.0c565"],["49889962.b65508"]],"l":false},{"id":"49889962.b65508","type":"alexa-remote-routine","z":"aa0dd480.eaf6b8","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":900,"y":520,"wires":[[]]},{"id":"85d02415.d15008","type":"alexa-remote-routine","z":"aa0dd480.eaf6b8","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":890,"y":260,"wires":[[]]},{"id":"62433f5c.d585","type":"comment","z":"aa0dd480.eaf6b8","name":"Fans","info":"","x":1190,"y":160,"wires":[]},{"id":"48f7dd5f.8073a4","type":"server-state-changed","z":"aa0dd480.eaf6b8","name":"Input Fan B","server":"9405c3fe.d0a6c","version":1,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"input_number.fan_b_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":1210,"y":340,"wires":[["ea868d81.04fcf"]]},{"id":"34c50dbf.7c9252","type":"change","z":"aa0dd480.eaf6b8","name":"","rules":[{"t":"set","p":"fan_entity_id","pt":"msg","to":"fan.fan_a","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1315,"y":260,"wires":[["f98505f6.d7c748"]],"l":false},{"id":"ea868d81.04fcf","type":"change","z":"aa0dd480.eaf6b8","name":"","rules":[{"t":"set","p":"fan_entity_id","pt":"msg","to":"fan.fan_b","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1315,"y":340,"wires":[["f98505f6.d7c748"]],"l":false},{"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"}]

That pretty much does it

@obaldius Thank you so much! It would have taken me weeks (if ever) to get to this point. I think I have everything setup correctly, but I’m getting an error at the Fun to low service node…I’m pretty sure I’m not passing along the data correctly. Any suggestions?

Medium and high work? I don’t think this has nothing to do with with the flow… Did you go first option or second option? what’s the error saying? Try saying different requests to set it to low

@mboarman there was a little mistake, change that, just in case:

The flow only turns the fan off…I’m pretty sure my issue is passing the data string along correctly in the service node. If I understand correctly I need to send the following to the entity in JSON:

service: fan.set_speed
speed: low (or medium / or high)

I’m just not sure if: {“speed” : “low”}

is accurate as the flow is showing an API error when executed

Make sure you put the correct entity_id in the required nodes and make sure Node Red is aware of that entity (when you type it, if it is aware, it will suggest to autocomplete).

It needn’t be low/medium/high, it’s fan dependent. You can learn your commands checking the device under developer tools/states/speed_list or fan_speed_list… something like that must show up like in the pictures below

You assumed it had fan speeds but it doesn’t, does it? :sweat_smile:

@obaldius Ok! I got one fan almost working! It will:
Turn On
Set Fan to Low and High
Turn Off

But it appears that Alexa doesn’t know the word “Medium”, so it won’t trigger the correct sequence.

Create two devices, ‘Fan’ and ‘The fan’. That sometimes solves those issues… increases compatibility with the sentences.

Thanks for the suggestion, but it appears “medium” is not part of Alexa’s vocabulary…I’m wondering if it’s possible to have Node Red analyze the voice prompt specifically for the word “medium” instead of the cloud trying to process it?

A straightforward workaround is to create a routine in Alexa app for that sentence. In the action section put your device ‘Fan’ to on and brightness 2. Not ideal but it’ll do it for now. In spanish it works great

In spanish it does work saying “Set the fan to medium level”. Does Alexa complain when you try that request or is it just that it doesn’t set the fan to medium?

Do increase/decrease work?

I thought about that, but I have have 3 fans in the house and I haven’t figured how to get Alexa to control them based on Room Aware until I found this flow…If I say Alexa set fan to “medium” it will trigger all three fans in the house.

I was looking at this post: Approaches to room aware voice commands for Alexa with Node-Red

and it looks like he uses NR to break out the voice command for medium and route it correctly. Could that be incorporated into this sequence?

If you check the cons, they say alexa complains… she will set the fan to the appropiate level but she’ll complain that fan cannot do that or something of the sort. If you do what I told you, create a routine, the apropiate fan will turn on and Alexa won’t complain

The routine must be if I say ‘set the fan to medium’ then the virtual device fan you created (not the actual fan) turns on and level 2. I have couple of routines like this and they still function according to the room, just try it out

Btw, put very different names to your other fans to avoid confusions to alexa. I mean, the actual fans, if they appear in the Alexa app, rename them to something very different.

Hmmmm…I’m sitting here trying to think this through…If I create a virtual fan call: “SpeedFan1” and create a routine in Alexa That says: “Alexa, set Fan to Medium” to set the fan speed to 2 on “SpeedFan1"”…Won’t that same routine trigger from any Alexa device in the house instead of that particular room like the NR flow?

I know this will work for that fan, but I’m confused if I create another routine for another fan “SpeedFan2” how Alexa will know the difference based on Room aware?

Wait, don’t create anything, you already have everything you need, just read carefully. You already have two created devices right? or one, I dunno.

Fan
The fan

right? Create a routine in the Alexa app that, when you say ‘Alexa, set fan to medium’ then in the action section, either the device ‘Fan’ or ‘The fan’, which you have already created, turns on at brightness 2%.

You needn’t create no more devices, delete those

Is pretty simple, you are overdoing it. Just follow what I say and see what happens

By changing the device ‘Fan’ state in the Alexa app, you’re actually triggering the NR flow, which takes care of the room selection