Node Red Room aware Alexa voice commands

@mboarman if you are using LIFX bulbs or philips hue, leave the last section as it is. Otherwise, replace the end of the flow with the following:

https://paste.ubuntu.com/p/WgtY9YR5xX/

I just removed all transitions so it doesn’t yield errors

Ok, so I snuck home for lunch and played around with it and I made some progress as you can see by the reporting until the nodes.

However it still seems to be broken somewhere…My next question is should I be putting the HA entity (switch.basement_03) in the Edit change node or the Alexa device name (Basement 03)? I tried it both ways and neither worked.

cap3

You can. It will only work for turn on/off as you might expect. You have to put the domain. switch.basement_03 instead of Basement 03

I see where the confusion comes from. You only have to put the name of your devices as they show in your Alexa app only for your Amazon Echo devices. The rest of devices must be put as you would in YAML.

Are you sure you put your Alexa devices correctly in the “Echo Device?” node? you have to manually bind every Echo Device output with its entities node and in that picture I see you’re still using my bindings.

@mboarman look, given that this is your first Node Red attempt, start very simply. Import the following and try to achieve that.

[{"id":"c3666738.e13d28","type":"switch","z":"3b79b439.8b759c","name":"Action?","property":"command","propertyType":"msg","rules":[{"t":"eq","v":"TurnOnRequest","vt":"str"},{"t":"eq","v":"TurnOffRequest","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":460,"y":220,"wires":[["f2fa5eab.b0949"],["46fe46c.e31a2b8"]]},{"id":"f2fa5eab.b0949","type":"api-call-service","z":"3b79b439.8b759c","name":"on","server":"9405c3fe.d0a6c","version":1,"debugenabled":false,"service_domain":"homeassistant","service":"turn_on","entityId":"{{entity_id}}","data":"","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":670,"y":200,"wires":[[]]},{"id":"46fe46c.e31a2b8","type":"api-call-service","z":"3b79b439.8b759c","name":"off","server":"9405c3fe.d0a6c","version":1,"debugenabled":false,"service_domain":"homeassistant","service":"turn_off","entityId":"{{entity_id}}","data":"","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":670,"y":240,"wires":[[]]},{"id":"2b7e6df.15df192","type":"change","z":"3b79b439.8b759c","name":"","rules":[{"t":"set","p":"entity_id","pt":"msg","to":"switch.basement_03","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":335,"y":220,"wires":[["c3666738.e13d28"]],"l":false},{"id":"fe460e47.79895","type":"switch","z":"3b79b439.8b759c","name":"Echo Device?","property":"echodevice","propertyType":"flow","rules":[{"t":"eq","v":"Your Echo Device as in Alexa app","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":180,"y":220,"wires":[["2b7e6df.15df192"]]},{"id":"9405c3fe.d0a6c","type":"server","z":"","name":"Home Assistant","addon":true}]

Get it working and you’ll move from there

Ok well I trimmed down your flow to makes things a bit simpler:

cap01

…and I’m not sure if I’ve made progress or not…lol…It dawned on me that the light I was trying to control is actually a switch. So I created a new “switch” device in the Alexa Home Skill Bridge:

I changed the device to switch:

cap03

Changed the Edit Switch node to match the name of the Alexa Device (as named in the app)

cap04

changed the entity_id to match the switch in Home Assistant: (note this is the correct entity_id, the one I posted earlier was a typo)

cap05

I edited the actions to remove everything but “on” and “off”

cap06

and wired them to the two respective nodes:

Now when I say “Alexa, turn the light on”, I get the message returned from Alexa stating that the light isn’t responding…please check the network connection or power supply.

ThoughtS?

first of all, remove the “Data” from both ‘on’ and ‘off’ nodes. I mean remove “{“transition”: “0.5”}” and “{“transition”: “1”}”. Secondly, are you sure you set the proper HA entity? because last time it was switch.basement_03 and now I see it is switch.switch_basement_03. You needn’t change Light for switch but given that you did that, what happens when you say “Alexa, turn on the switch” or turn off?

I assume you deleted the device light and created a device switch, that’s why Alexa complains the light isn’t responding… you still haven’t deleted it from your Alexa app

@obaldius I attempted to do a friend request on Discord, but I may have screwed that up too! Nevertheless, I believe I’ve narrowed my problem down to the “Echo Device” node. If I connect a wire from the Input on node to the switch node:

The light turn on and off as expected. But when I have it running through the Echo Device Node it seems to terminate at that node:

cap-device

I’ve checked the name of my Echo Device (at least 50 times) and it’s an identical match to the app. I’m seeing no errors in the NR debug report while it’s running and I’ve even switched it to another echo device to test with the same negative results. Any ideas?

No problem, we’ll get there, just slower. Do this. Chain a debug node like in the picture. Be sure to select ‘complete msg object’ under the debug node. Deploy.

Open the right side menu and click on the beetle/roach on the top (debug). Make sure Echo-Flex01 is the only echo listening to you and say “Alexa, (whatever you like)”. Something like this will show up in the bottom of the debug menu.

unfold the last message, the second one, by clicking the black triangles. The name of your device will be under payload/name. Copy and paste that name in your “Echo Device?” node.

@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.