Indigo / Node-Red / Alexa

Posted on
Sun Jan 10, 2021 10:25 am
bking77 offline
Posts: 13
Joined: Nov 15, 2018

Re: Indigo / Node-Red / Alexa

Hi all, I've been struggling with this for days. I'm trying the Alexa skill approach and have Node-red and the Alexa part working fine. The problem is with the Indigo device nodes. I can't get the 'Itemname' dropdown to populate with my devices. I've setup the controller properties but everytime I hit the Deploy button the Indigo log says:

WebServer access denied "http://localhost:8176/" from bking1 @ 127.0.0.1

and when clicking on the 'Itemname" dropdown, the Terminal window says:

getting devices
Error: Bad request, answer is empty
at HTTPDigest._handleResponse (/Users/Marie/.node-red/node_modules/request-digest/request-digest.es5.js:66:33)
at Request._callback (/Users/Marie/.node-red/node_modules/request-digest/request-digest.es5.js:59:31)
at self.callback (/Users/Marie/.node-red/node_modules/request/request.js:185:22)
at Request.emit (events.js:315:20)
at Request.onRequestError (/Users/Marie/.node-red/node_modules/request/request.js:877:8)
at ClientRequest.emit (events.js:315:20)
at Socket.socketErrorListener (_http_client.js:469:9)
at Socket.emit (events.js:315:20)
at emitErrorNT (internal/streams/destroy.js:106:8)
at emitErrorCloseNT (internal/streams/destroy.js:74:3)
at processTicksAndRejections (internal/process/task_queues.js:80:21)

Node-red can't seem to get access to my Indigo server. Has anyone else had this problem? Any suggestions? I'm a novice at this stuff.

Thanks,
Bill

Posted on
Sun Jan 10, 2021 10:35 am
siclark offline
Posts: 1960
Joined: Jun 13, 2017
Location: UK

Re: Indigo / Node-Red / Alexa

Can you connect to indigo via indigo touch?

Posted on
Sun Jan 10, 2021 3:25 pm
bking77 offline
Posts: 13
Joined: Nov 15, 2018

Re: Indigo / Node-Red / Alexa

I don't use Indigo Touch but I can connect to the Indigo server with Domotics Pad. Thanks

Posted on
Sun Jan 10, 2021 3:41 pm
siclark offline
Posts: 1960
Joined: Jun 13, 2017
Location: UK

Re: Indigo / Node-Red / Alexa

There is clearly a connection issue. You won’t be able to pull back the indigo device names until indigo allows the connection. Are the details definitely correct?

Posted on
Sun Jan 10, 2021 3:58 pm
bking77 offline
Posts: 13
Joined: Nov 15, 2018

Re: Indigo / Node-Red / Alexa

I believe so. Any idea why the indigo server would not allow a connection? I've tried with user and password, and without, and it doesn't make any difference.

Posted on
Sun Jan 10, 2021 4:19 pm
siclark offline
Posts: 1960
Joined: Jun 13, 2017
Location: UK

Re: Indigo / Node-Red / Alexa

It will definitely need password. I connect to local host 8176.

Posted on
Sun Jan 10, 2021 5:08 pm
bking77 offline
Posts: 13
Joined: Nov 15, 2018

Re: Indigo / Node-Red / Alexa

It's working! I had the wrong password, uh. Thanks for your help!

Posted on
Sat Jan 30, 2021 4:51 pm
gsbrewer offline
Posts: 28
Joined: Jan 22, 2016
Location: Livermore, CA

Re: Indigo / Node-Red / Alexa

Has anyone ever get Alexa to display the proper state of a simple device (like a light) after issuing the command for on/off? Im using Node-Red SmartHome version, and all the devices are working well, but the Alexa App and the echo show never update properly. I turned off auto acknowledge and Im acknowledging in an "Alexa smart home v3 rest" node (and Alexa is happy with that) but I assume there is something that I need to do in the msg.. I just don't what it is. Any help is appreciated.

Posted on
Sat Jan 30, 2021 4:54 pm
siclark offline
Posts: 1960
Joined: Jun 13, 2017
Location: UK

Re: Indigo / Node-Red / Alexa

You can use a input time node, purple one maybe, it’s been a while since I used it , to automate pushing updates back to Alexa. Just don’t set it up to be too frequent. I have temperatures updating back into Alexa app.

Posted on
Sat Jan 30, 2021 5:14 pm
gsbrewer offline
Posts: 28
Joined: Jan 22, 2016
Location: Livermore, CA

Re: Indigo / Node-Red / Alexa

I saw that earlier up the thread... It's not a command-response sort of thing? What is the state node used for (I have one at the end of the flow). I'll look more closely at the timer thing.

Posted on
Sat Jan 30, 2021 8:02 pm
gsbrewer offline
Posts: 28
Joined: Jan 22, 2016
Location: Livermore, CA

Re: Indigo / Node-Red / Alexa

OK. You don't need a recurring tickle so much... It actually works on the Echo app, just not on the echo Show (which is where I was doing my testing. You don't even need an "Alexa Smart Home Response" node, just a state node. Im working with an Insteon dimmer, so I have to deal with On/Off and Dim level, so the logic looks like the picture below, and it all works fine.
Attachments
Screen Shot .png
Screen Shot .png (430.17 KiB) Viewed 5441 times

Posted on
Sat Jan 30, 2021 8:48 pm
whmoorejr offline
User avatar
Posts: 762
Joined: Jan 15, 2013
Location: Houston, TX

Re: Indigo / Node-Red / Alexa

gsbrewer wrote:
Has anyone ever get Alexa to display the proper state of a simple device (like a light) after issuing the command for on/off? Im using Node-Red SmartHome version, and all the devices are working well, but the Alexa App and the echo show never update properly. I turned off auto acknowledge and Im acknowledging in an "Alexa smart home v3 rest" node (and Alexa is happy with that) but I assume there is something that I need to do in the msg.. I just don't what it is. Any help is appreciated.


Yes, the trick is the Function node between indigo and the Alexa device (Which it looks like you got figured out). That puts the payload into a format that Alexa understands. I typically don't use an Alexa device to see if something is on or not.... so the only thing I have that updates the Alexa states is motion. I specifically chose motion so I could initiate a routine. It's not a motion sensor that triggers, it's a HTTP Put command in an Action from Indigo... so it can be whatever. Then on the Alexa side, I can create a routine based on motion to do whatever.

Motion Function for Alexa:
Code: Select all
[{"id":"4c09d0d7.1dda98","type":"function","z":"a4cd1693.e6598","name":"Translate for Alexa Motion","func":"// Motion State\nif (msg.payload == \"ON\") {\n    return { \"payload\" : { \"state\" : { \"motion\" : \"DETECTED\" } }, \"acknowledge\" : true };\n}\nelse if (msg.payload == \"OFF\") {\n    return { \"payload\" : { \"state\" : { \"motion\" : \"NOT_DETECTED\" } }, \"acknowledge\" : true };\n}","outputs":1,"noerr":0,"initialize":"","finalize":"","x":310,"y":580,"wires":[[]]}]

Screen Shot 2021-01-30 at 8.43.56 PM.png
Screen Shot 2021-01-30 at 8.43.56 PM.png (95.03 KiB) Viewed 5431 times

Or here is the whole flow that I use:
Code: Select all
[{"id":"a4cd1693.e6598","type":"tab","label":"Routine Relays","disabled":false,"info":""},{"id":"4470dc4.1ffe324","type":"debug","z":"a4cd1693.e6598","name":"","active":true,"tosidebar":true,"console":true,"tostatus":true,"complete":"payload","targetType":"msg","x":360,"y":160,"wires":[]},{"id":"aed4cd13.bf9f68","type":"http in","z":"a4cd1693.e6598","name":"Relay","url":"/Relay","method":"get","upload":false,"swaggerDoc":"","x":70,"y":280,"wires":[["4470dc4.1ffe324","ccd8c2a7.6e61b8","93ba7b6c.51a7c8"]]},{"id":"ccd8c2a7.6e61b8","type":"http response","z":"a4cd1693.e6598","name":"","statusCode":"","headers":{},"x":390,"y":380,"wires":[]},{"id":"93ba7b6c.51a7c8","type":"json","z":"a4cd1693.e6598","name":"","property":"payload","action":"","pretty":false,"x":250,"y":280,"wires":[["660a605a.0cd18"]]},{"id":"660a605a.0cd18","type":"switch","z":"a4cd1693.e6598","name":"","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"{\"one\":\"on\"}","vt":"str"},{"t":"eq","v":"{\"one\":\"off\"}","vt":"str"},{"t":"eq","v":"{\"two\":\"on\"}","vt":"str"},{"t":"eq","v":"{\"two\":\"off\"}","vt":"str"},{"t":"eq","v":"{\"three\":\"on\"}","vt":"str"},{"t":"eq","v":"{\"three\":\"off\"}","vt":"str"},{"t":"eq","v":"{\"four\":\"on\"}","vt":"str"},{"t":"eq","v":"{\"four\":\"off\"}","vt":"str"},{"t":"eq","v":"{\"five\":\"on\"}","vt":"str"},{"t":"eq","v":"{\"five\":\"off\"}","vt":"str"}],"checkall":"true","repair":false,"outputs":10,"x":390,"y":280,"wires":[["ce7d1a4b.191cc"],["f5586c5c.85c908"],["ea842d36.e1ad68"],["90fcb45d.c6d298"],["54d36ba8.735cfc"],["f83c682.6994b18"],["3bbb0c22.abda4c"],["9378792c.55c678"],["9df8d79c.1ee2e8"],["bd9313e5.39cdc8"]]},{"id":"ce7d1a4b.191cc","type":"change","z":"a4cd1693.e6598","name":"ON","rules":[{"t":"set","p":"payload","pt":"msg","to":"ON","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":590,"y":60,"wires":[["aea40ccc.c3a1a"]]},{"id":"f5586c5c.85c908","type":"change","z":"a4cd1693.e6598","name":"OFF","rules":[{"t":"set","p":"payload","pt":"msg","to":"OFF","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":590,"y":100,"wires":[["aea40ccc.c3a1a"]]},{"id":"aea40ccc.c3a1a","type":"function","z":"a4cd1693.e6598","name":"Translate for Alexa Motion","func":"// Motion State\nif (msg.payload == \"ON\") {\n    return { \"payload\" : { \"state\" : { \"motion\" : \"DETECTED\" } }, \"acknowledge\" : true };\n}\nelse if (msg.payload == \"OFF\") {\n    return { \"payload\" : { \"state\" : { \"motion\" : \"NOT_DETECTED\" } }, \"acknowledge\" : true };\n}","outputs":1,"noerr":0,"initialize":"","finalize":"","x":770,"y":80,"wires":[["e8f6cc20.d4f878","a1699d50.d555b8"]]},{"id":"e8f6cc20.d4f878","type":"debug","z":"a4cd1693.e6598","name":"","active":true,"tosidebar":true,"console":true,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"payload","statusType":"auto","x":1000,"y":100,"wires":[]},{"id":"a1699d50.d555b8","type":"alexa-smart-home-v3-state","z":"a4cd1693.e6598","conf":"5da0db12.ace44c","device":"13105","name":"Relay_One","x":990,"y":60,"wires":[]},{"id":"ea842d36.e1ad68","type":"change","z":"a4cd1693.e6598","name":"ON","rules":[{"t":"set","p":"payload","pt":"msg","to":"ON","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":590,"y":160,"wires":[["d432350.c439248"]]},{"id":"90fcb45d.c6d298","type":"change","z":"a4cd1693.e6598","name":"OFF","rules":[{"t":"set","p":"payload","pt":"msg","to":"OFF","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":590,"y":200,"wires":[["d432350.c439248"]]},{"id":"d432350.c439248","type":"function","z":"a4cd1693.e6598","name":"Translate for Alexa Motion","func":"// Motion State\nif (msg.payload == \"ON\") {\n    return { \"payload\" : { \"state\" : { \"motion\" : \"DETECTED\" } }, \"acknowledge\" : true };\n}\nelse if (msg.payload == \"OFF\") {\n    return { \"payload\" : { \"state\" : { \"motion\" : \"NOT_DETECTED\" } }, \"acknowledge\" : true };\n}","outputs":1,"noerr":0,"x":770,"y":180,"wires":[["c8d2edbd.b698e8","6a62e72.e83b018"]]},{"id":"c8d2edbd.b698e8","type":"debug","z":"a4cd1693.e6598","name":"","active":true,"tosidebar":true,"console":true,"tostatus":true,"complete":"payload","targetType":"msg","x":1000,"y":200,"wires":[]},{"id":"6a62e72.e83b018","type":"alexa-smart-home-v3-state","z":"a4cd1693.e6598","conf":"5da0db12.ace44c","device":"13106","name":"Relay_Two","x":990,"y":160,"wires":[]},{"id":"54d36ba8.735cfc","type":"change","z":"a4cd1693.e6598","name":"ON","rules":[{"t":"set","p":"payload","pt":"msg","to":"ON","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":590,"y":260,"wires":[["af8b4242.b80278"]]},{"id":"f83c682.6994b18","type":"change","z":"a4cd1693.e6598","name":"OFF","rules":[{"t":"set","p":"payload","pt":"msg","to":"OFF","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":590,"y":300,"wires":[["af8b4242.b80278"]]},{"id":"af8b4242.b80278","type":"function","z":"a4cd1693.e6598","name":"Translate for Alexa Motion","func":"// Motion State\nif (msg.payload == \"ON\") {\n    return { \"payload\" : { \"state\" : { \"motion\" : \"DETECTED\" } }, \"acknowledge\" : true };\n}\nelse if (msg.payload == \"OFF\") {\n    return { \"payload\" : { \"state\" : { \"motion\" : \"NOT_DETECTED\" } }, \"acknowledge\" : true };\n}","outputs":1,"noerr":0,"x":770,"y":280,"wires":[["60b61cc6.195084","fad6976b.23bfc8"]]},{"id":"60b61cc6.195084","type":"debug","z":"a4cd1693.e6598","name":"","active":true,"tosidebar":true,"console":true,"tostatus":true,"complete":"payload","targetType":"msg","x":1000,"y":300,"wires":[]},{"id":"fad6976b.23bfc8","type":"alexa-smart-home-v3-state","z":"a4cd1693.e6598","conf":"5da0db12.ace44c","device":"13107","name":"Relay_Three","x":990,"y":260,"wires":[]},{"id":"3bbb0c22.abda4c","type":"change","z":"a4cd1693.e6598","name":"ON","rules":[{"t":"set","p":"payload","pt":"msg","to":"ON","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":590,"y":360,"wires":[["b34de8a1.65444"]]},{"id":"9378792c.55c678","type":"change","z":"a4cd1693.e6598","name":"OFF","rules":[{"t":"set","p":"payload","pt":"msg","to":"OFF","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":590,"y":400,"wires":[["b34de8a1.65444"]]},{"id":"b34de8a1.65444","type":"function","z":"a4cd1693.e6598","name":"Translate for Alexa Motion","func":"// Motion State\nif (msg.payload == \"ON\") {\n    return { \"payload\" : { \"state\" : { \"motion\" : \"DETECTED\" } }, \"acknowledge\" : true };\n}\nelse if (msg.payload == \"OFF\") {\n    return { \"payload\" : { \"state\" : { \"motion\" : \"NOT_DETECTED\" } }, \"acknowledge\" : true };\n}","outputs":1,"noerr":0,"x":770,"y":380,"wires":[["3cfe7ffc.d366","da14bdd8.1d419"]]},{"id":"3cfe7ffc.d366","type":"debug","z":"a4cd1693.e6598","name":"","active":true,"tosidebar":true,"console":true,"tostatus":true,"complete":"payload","targetType":"msg","x":1000,"y":400,"wires":[]},{"id":"da14bdd8.1d419","type":"alexa-smart-home-v3-state","z":"a4cd1693.e6598","conf":"5da0db12.ace44c","device":"13108","name":"Relay_Four","x":990,"y":360,"wires":[]},{"id":"9df8d79c.1ee2e8","type":"change","z":"a4cd1693.e6598","name":"ON","rules":[{"t":"set","p":"payload","pt":"msg","to":"ON","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":590,"y":460,"wires":[["cdfdd755.2201b8"]]},{"id":"bd9313e5.39cdc8","type":"change","z":"a4cd1693.e6598","name":"OFF","rules":[{"t":"set","p":"payload","pt":"msg","to":"OFF","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":590,"y":500,"wires":[["cdfdd755.2201b8"]]},{"id":"cdfdd755.2201b8","type":"function","z":"a4cd1693.e6598","name":"Translate for Alexa Motion","func":"// Motion State\nif (msg.payload == \"ON\") {\n    return { \"payload\" : { \"state\" : { \"motion\" : \"DETECTED\" } }, \"acknowledge\" : true };\n}\nelse if (msg.payload == \"OFF\") {\n    return { \"payload\" : { \"state\" : { \"motion\" : \"NOT_DETECTED\" } }, \"acknowledge\" : true };\n}","outputs":1,"noerr":0,"x":770,"y":480,"wires":[["27c9c11.92ecd3e","a07c90a9.340f18"]]},{"id":"27c9c11.92ecd3e","type":"debug","z":"a4cd1693.e6598","name":"","active":true,"tosidebar":true,"console":true,"tostatus":true,"complete":"payload","targetType":"msg","x":1000,"y":500,"wires":[]},{"id":"a07c90a9.340f18","type":"alexa-smart-home-v3-state","z":"a4cd1693.e6598","conf":"5da0db12.ace44c","device":"13109","name":"Relay_Five","x":990,"y":460,"wires":[]},{"id":"5da0db12.ace44c","type":"alexa-smart-home-v3-conf","username":"yourUserName","mqttserver":"mq-red.cb-net.co.uk","webapiurl":"red.cb-net.co.uk","contextName":"memory"}]

Bill
My Plugin: My People

Posted on
Sat Jan 30, 2021 11:24 pm
gsbrewer offline
Posts: 28
Joined: Jan 22, 2016
Location: Livermore, CA

Re: Indigo / Node-Red / Alexa

Thanks for the response. It took a lot of trial and error because I couldn't find where the Alexa message format is documented. Have you seen anything that lists all the primary object types and what we are supposed to respond to in Alexa vanacular? Thanks again.

Posted on
Sun Jan 31, 2021 10:11 am
whmoorejr offline
User avatar
Posts: 762
Joined: Jan 15, 2013
Location: Houston, TX

Re: Indigo / Node-Red / Alexa

gsbrewer wrote:
Thanks for the response. It took a lot of trial and error because I couldn't find where the Alexa message format is documented. Have you seen anything that lists all the primary object types and what we are supposed to respond to in Alexa vanacular? Thanks again.


I didn't before, I just happed to find that when looking specifically for motion... looking now I found a couple things in the Alexa SDK documentation that may provide some insight as to what Alexa is looking to see....
General Home Automation Devices (Look at all the stuff under the "Smart Home Skill APIs": https://developer.amazon.com/en-US/docs/alexa/device-apis/alexa-automationmanagement.html

Smart Home Security Skills (motion, locks, doorbells, etc.): https://developer.amazon.com/en-US/docs/alexa/device-apis/overview-smart-home-security.html

It's not a perfect fit, but I think the verbiage is tucked in there.

When it comes to node-red, I'm totally guessing at most of it... but I haven't broken anything yet, so I'm good.

Bill
My Plugin: My People

Who is online

Users browsing this forum: No registered users and 4 guests