Closed tribbles3 closed 5 years ago
damn it ... no user in the request :(
@derSebbl Can you try version 1.1.2 with Environment variable ALEXA_PORT=80 and maybe also without this set?
ALEXA_PORT=80 npm start
does the job ...
With command:
node-red start
It's still stuck at:
[debug] Alexa Controller/0 - Handling setup request
With ALEXA_PORT=80 node-red start I get:
29 Aug 14:02:48 - Error: listen EACCES: permission denied 0.0.0.0:80
at Server.setupListenHandle [as _listen2] (net.js:1211:19)
at listenInCluster (net.js:1276:12)
at Server.listen (net.js:1364:7)
at AlexaHub.createServer (/home/seb/Downloads/node-red-contrib-alexa-home-1.1.2/alexa/alexa-hub.js:29:33)
at new AlexaHub (/home/seb/Downloads/node-red-contrib-alexa-home-1.1.2/alexa/alexa-hub.js:20:8)
at new AlexaHomeController (/home/seb/Downloads/node-red-contrib-alexa-home-1.1.2/alexa/alexa-home-controller.js:27:20)
at Object.createNode (/usr/lib/node_modules/node-red/node_modules/@node-red/runtime/lib/nodes/flows/util.js:483:31)
at Flow.start (/usr/lib/node_modules/node-red/node_modules/@node-red/runtime/lib/nodes/flows/Flow.js:176:44)
at start (/usr/lib/node_modules/node-red/node_modules/@node-red/runtime/lib/nodes/flows/index.js:329:33)
at /usr/lib/node_modules/node-red/node_modules/@node-red/runtime/lib/nodes/flows/index.js:196:21
This is the same error message as in this module: https://github.com/datech/node-red-contrib-amazon-echo/wiki/Troubleshooting
Port 80 does not seem to be available for non root users, so using this module with Echo Gen 3 still requires port forwarding. The following works:
sudo iptables -t nat -I PREROUTING -p tcp --dport 80 -j REDIRECT --to-ports 8080
ALEXA_PORT=8080 node-red start
(Instead of 8080, any port above 1024 is suitable)@derSebbl yes because of that i did not change the default port. ports < 1024 can only used by root or with some extra settings.
So the fix works for you when also making the alexa available on port 80?
Yes, username is not undefined anymore. The fix regarding the username was copied from the https://github.com/datech/node-red-contrib-amazon-echo repository, it's using the exact same username.
So using version 1.1.2 with port forwarding like this is working:
sudo iptables -t nat -I PREROUTING -p tcp --dport 80 -j REDIRECT --to-ports 8080
ALEXA_PORT=8080 node-red start
Thanks for your effort
Edit:
It's also possible to just forward port 80 to 60000 with
sudo iptables -t nat -I PREROUTING -p tcp --dport 80 -j REDIRECT --to-ports 60000
and then start node-red normally, without using the explicit "ALEXA_PORT" variable.
Edit: It might be useful to add this information to README.md for users which are having this issue with Gen 3 devices.
Please consider that any changes to iptables are not presistent, after reboot you have to forward the port again, or use iptables-save
as described here: https://www.poftut.com/how-to-save-and-restore-iptables-rules-permanently-in-ubuntu-centos-fedora-debian-kali-mint/
@derSebbl yes i cloned the username but it would be possible to persist the later used username - somehow ... but this would require that i purchase a gen3 device :(
I gonna do a change of the readme.
@mabunixda
@nepeee which node/npm version are you using?
I had node.js 8.5.x before, updated everything now i have: node.js v11.15.0 npm 6.11.2 node-red v0.20.7 alexa-home 1.1.2 Echo Dot gen2 with sw version 645583020 After the update the web server on port 60000 started to respond.
I also needed to add the iptables rule for port 80, before that the pairing process stopped at the 'Handling setup request' part.
It's still not working, now i got the following the node-red log:
30 Aug 20:15:47 - [info] [alexa-home-controller:Alexa Controller] 60000/GET -> /alexa-home/setup.xml 30 Aug 20:15:47 - [debug] Alexa Controller/0 - Handling setup request 30 Aug 20:15:47 - [info] [alexa-home-controller:Alexa Controller] 60000/POST -> /api 30 Aug 20:15:47 - [debug] [alexa-home-controller:Alexa Controller] Request body: {"devicetype":"Echo"} 30 Aug 20:15:47 - [debug] Alexa Controller/0 - Handling registration request 30 Aug 20:15:47 - [info] [alexa-home-controller:Alexa Controller] 60000/GET -> /api/c6260f982b43a226b5542b967f612ce/lights 30 Aug 20:15:47 - [debug] Alexa Controller/0 - handling api item list request: lights 30 Aug 20:15:47 - [debug] Alexa Controller/0 - starting at 0 till 30 at #1 30 Aug 20:15:47 - [debug] Alexa ControllerNaN0 - listing c6260f982b43a226b5542b967f612ce #1 api information to ::ffff:192.168.0.206 30 Aug 20:15:52 - [info] [alexa-home-controller:Alexa Controller] 60000/POST -> /api 30 Aug 20:15:52 - [debug] [alexa-home-controller:Alexa Controller] Request body: {"devicetype":"Echo"} 30 Aug 20:15:52 - [debug] Alexa Controller/0 - Handling registration request 30 Aug 20:15:52 - [info] [alexa-home-controller:Alexa Controller] 60000/GET -> /api/c6260f982b43a226b5542b967f612ce/lights 30 Aug 20:15:52 - [debug] Alexa Controller/0 - handling api item list request: lights 30 Aug 20:15:52 - [debug] Alexa Controller/0 - starting at 0 till 30 at #1 30 Aug 20:15:52 - [debug] Alexa ControllerNaN0 - listing c6260f982b43a226b5542b967f612ce #1 api information to ::ffff:192.168.0.206
And keeps repeating until no new device found by the dot. The "Alexa ControllerNaN0" line looks suspicious.
Complete http trafic on 80 and 60000: https://pastebin.com/raw/C6yFNxg3
Update: I tested the node-red-contrib-amazon-echo it works on port 80 with root and also with the iptables redirect.
@nepeee could you please post the content of: http://localhost:60000/api/c6260f982b43a226b5542b967f612ce/lights (Or your machine's IP instead of localhost)
After that, please try the following steps:
The "Alexa ControllerNaN0" part is only a bug in logging, it does not affect the behaviour of this module.
@nepeee could you please post the content of: http://localhost:60000/api/c6260f982b43a226b5542b967f612ce/lights (Or your machine's IP instead of localhost)
It's in the linked pastebin log:
{ "4e18ce048a2e88": { "state": { "on": false, "bri": 0, "hue": 0, "sat": 254, "effect": "none", "xy": [ 0.0, 0.0 ], "ct": 199, "colormode": "ct", "reachable": true }, "swupdate": { "state": "noupdates", "lastinstall": "2019-08-30T20:56:30" }, "type": "Extended color light", "name": "Light", "modelid": "LCT007", "manufacturername": "Philips", "productname": "Hue color lamp", "swversion": "5.105.0.21169" }, "last": {} }
After that, please try the following steps:
* delete "alexa home controller" node from your flow * create a new "alexa home controller" node * add a new "alexa home" node in node-red, name it * search again. Please post the output of that. Is anything different?
Already did this before the pastebin log is captured.
What I did to get it working, because mentioned solution did not help me:
@holomekc Would you mind telling exactly what you changed where? I would like to try this also. Thank you!
From one day to the other, all of the sudden all my nodes stopped working and Alexa tells me the devices are not responding.
Yeah i removed many information to Strip the Output to a Wirkung Minimum of gen2 devices. On monday i geht my funded gen3 device and will start to Test and fix
Can you Update the issue AS already requested Witz the information and i gonna fix this for all
Am 31. Aug. 2019, 16:22, um 16:22, holomekc notifications@github.com schrieb:
What I did to get it working, because mentioned solution did not help me:
- port 80 and redirection was not necessary
- changed code so that alwas http is used. Https was not working because I use self-signed ones
- changed templates for list and get-state -- removed last:{} and created a dummy entry with a stupid name which I do not use -- added uniqueid and more fields by checking actual hue devices and comparing the values.
-- You are receiving this because you were mentioned. Reply to this email directly or view it on GitHub: https://github.com/mabunixda/node-red-contrib-alexa-home/issues/16#issuecomment-526834394
Hi sry for my late response but i was on the road for 6h...
...alexa/templates/items/list.json c6cb6810029ef: is basically a replacement for last:{} and of a different type so that alexa does understand it but you cannot really do something with it. I copied it from my osram plugs.
{
{{#lights}}
"{{ id }}": {
"state": {
"on": {{ on }},
"bri": {{ bri }},
"hue": {{ hue }},
"sat": {{ sat }},
"effect": "none",
"xy": [
0.0,
0.0
],
"ct": {{ ct }},
"colormode": "{{ colormode }}",
"reachable": true,
"alert": "none",
"mode": "homeautomation"
},
"swupdate": {
"state": "noupdates",
"lastinstall": null
},
"type": "Extended color light",
"name": "{{ name }}",
"modelid": "LCT007",
"manufacturername": "Philips",
"productname": "Hue color lamp",
"capabilities": {
"certified": true,
"control": {
"mindimlevel": 5000,
"maxlumen": 600,
"colorgamuttype": "B",
"colorgamut": [
[
0.675,
0.322
],
[
0.409,
0.518
],
[
0.167,
0.04
]
],
"ct": {
"min": 153,
"max": 500
}
},
"config": {
"archetype": "sultanbulb",
"function": "mixed",
"direction": "omnidirectional"
},
"streaming": {
"renderer": true,
"proxy": false
}
},
"config": {
"archetype": "classicbulb",
"function": "functional",
"direction": "omnidirectional"
},
"uniqueid": "00:11:22:33:44:55:66:77-88",
"swversion": "5.105.0.21169"
},
{{/lights}}
"c6cb6810029ef": {
"state": {
"on": false,
"alert": "none",
"mode": "homeautomation",
"reachable": false
},
"swupdate": {
"state": "notupdatable",
"lastinstall": null
},
"type": "On/Off plug-in unit",
"name": "IgnoreMe",
"modelid": "Plug 01",
"manufacturername": "NodeRed",
"productname": "On/Off plug",
"capabilities": {
"certified": false,
"control": {},
"streaming": {
"renderer": false,
"proxy": false
}
},
"config": {
"archetype": "classicbulb",
"function": "functional",
"direction": "omnidirectional"
},
"swversion": "V1.04.12",
"uniqueid": "aa:aa:aa:aa:aa:aa:aa:00-99"
}
}
...alexa/templates/items/get-state.json Hmm not sure what i changed. Sry only have an ipad here.. i think i only added alert. But i am not sure if this was necessary. I think this is just from my try-and-error approach.
{
"state": {
"on": {{ on }},
"bri": {{ bri }},
"hue": {{ hue }},
"sat": {{ sat }},
"effect": "none",
"xy": [
0.0,
0.0
],
"ct": {{ ct }},
"alert": "none",
"colormode": "{{ colormode }}",
"mode": "homeautomation",
"reachable": true
},
"swupdate": {
"state": "noupdates",
"lastinstall": "{{ date }}"
},
"type": "Color Temperature Light",
"name": "{{ name }}",
"modelid": "LTW011",
"swversion": "1.29.0_r21169"
}
Regarding https and http i just removed the check for node-red settings and set http fix.
Edit: sry for the many edits. I hate typing on an ipad...
Fixed it based on the node-red-contrib-alexa-home json templates and @holomekc comment. No need for dummy items:
list.json:
{
{{#lights}}
"{{ id }}": {
"state": {
"on": {{ on }},
"bri": {{ bri }},
"hue": {{ hue }},
"sat": {{ sat }},
"effect": "none",
"xy": [
0.0,
0.0
],
"ct": {{ ct }},
"colormode": "{{ colormode }}",
"reachable": true,
"alert":"none",
"mode":"homeautomation"
},
"swupdate": {
"state": "noupdates",
"lastinstall": "{{ date }}"
},
"type": "Extended color light",
"name": "{{ name }}",
"modelid": "LCT007",
"manufacturername": "Philips",
"productname": "Hue color lamp",
"swversion": "5.105.0.21169",
"capabilities":{
"certified":true,
"control":{
"mindimlevel":5000,
"maxlumen":600,
"colorgamuttype":"B",
"colorgamut":[[0.675,0.322],[0.409,0.518],[0.167,0.04]],
"ct":{"min":153,"max":500}
},
"streaming":{
"renderer":true,
"proxy":false
}
},
"config":{
"archetype":"sultanbulb",
"function":"mixed",
"direction":"omnidirectional"
},
"uniqueid":"00:11:22:33:44:55:66:77-88"
}
{{/lights}}
}
get-state.json:
{
"state": {
"on": {{ on }},
"bri": {{ bri }},
"hue": {{ hue }},
"sat": {{ sat }},
"effect": "none",
"xy": [
{{x}},
{{y}}
],
"ct": {{ ct }},
"alert": "none",
"colormode": "{{ colormode }}",
"mode": "homeautomation",
"reachable": true
},
"swupdate": {
"state": "noupdates",
"lastinstall": "{{ date }}"
},
"type": "Color Temperature Light",
"name": "{{ name }}",
"modelid": "LTW011",
"swversion": "1.29.0_r21169"
}
Everything works well for me except i got a "Device doesn't support requested value" label for the light in the android alexa app. (does not affect operation) The port redirect is still required for me.
Update, the "Device doesn't support requested value" warning in the app is fixed by me see the "Android Alexa app incorrectly shows off state after the light is turned on" issue.
Posting this here because it looks like the other issue thread has been closed.
I did the latest update and can longer access any of the nodes/devices. I tried discovering devices, nothing was found and then I tried creating a new device and that was not discovered either. I noticed that none of the nodes are displaying any status information under the node whereas before the was status information.