Coder Social home page Coder Social logo

Comments (41)

datech avatar datech commented on September 16, 2024 2

@wongnam I think, I've managed to fix it in version 0.1.6.

from node-red-contrib-amazon-echo.

datech avatar datech commented on September 16, 2024 1

@wongnam Thanks for helping me fix these issues.

from node-red-contrib-amazon-echo.

Barabba11 avatar Barabba11 commented on September 16, 2024

Already solved, read the next issue "Does it work with Echo Plus?"

from node-red-contrib-amazon-echo.

datech avatar datech commented on September 16, 2024

I will document it

from node-red-contrib-amazon-echo.

wongnam avatar wongnam commented on September 16, 2024

@datech I will test 1st gen Echo Dot this night then will feedback to you soon.

from node-red-contrib-amazon-echo.

wongnam avatar wongnam commented on September 16, 2024

Amazon Echo HUB nodes are unable to detect by Echo Dot 1gen and Echo Dot 2nd gen.
Note that:
1- I try to use port 8000 (>1024) => no working
2- I use NAT to redirect port 80 to 8000 => Only work for Echo Dot 3rd gen

from node-red-contrib-amazon-echo.

datech avatar datech commented on September 16, 2024

Thanks for checking this out.

Port forwarding will not work for 1st and 2nd as Alexa will always try to connect to the hub port in this case port 8000. The 3rd generation is ignoring the port configuration and is trying to connect to port 80. That's why forwarding is working.

Any chance to test 1st and 2nd gen with hub on port 80?

from node-red-contrib-amazon-echo.

wongnam avatar wongnam commented on September 16, 2024

I don't want to access user as root. Any better solution? Thanks

from node-red-contrib-amazon-echo.

datech avatar datech commented on September 16, 2024

Docker container running with root, but it has to share the host network, otherwise hub will not be discovered. But this will take more time to setup. Thanks anyway.

I will try to buy a 2nd gen Echo to see what might be the issue.

from node-red-contrib-amazon-echo.

Barabba11 avatar Barabba11 commented on September 16, 2024

you don't need to access as root, just execute the command I suggested with sudo.. that's all

from node-red-contrib-amazon-echo.

wongnam avatar wongnam commented on September 16, 2024

@Barabba11 Perhaps you do understand my issue, the issue is happen on Echo Dot 1st Gen and Echo Dot 2nd Gen, do you have tried these models?

from node-red-contrib-amazon-echo.

wongnam avatar wongnam commented on September 16, 2024

Docker container running with root, but it has to share the host network, otherwise hub will not be discovered. But this will take more time to setup. Thanks anyway.

I will try to buy a 2nd gen Echo to see what might be the issue.

@datech I will setup another new set of fresh Pi 3B and let it access root for Node-red and your Echo Node +port:80 and see what is happen with Echo Dot 1st and 2nd Gen.. will revert you back the result.

from node-red-contrib-amazon-echo.

Barabba11 avatar Barabba11 commented on September 16, 2024

It would be better not run node red with root, I had lot of troubles. Creators also told to avoid it

from node-red-contrib-amazon-echo.

datech avatar datech commented on September 16, 2024

Wiki page for Troubleshooting

from node-red-contrib-amazon-echo.

Barabba11 avatar Barabba11 commented on September 16, 2024

In my experience I saw routers that block broadcast in the LAN (so WiFi too), if the hosts can't ARP each other nothing will work. I suggest you to use a 3rd device in the same network (for example your phone) and ping both node red and Echo device.
Useful is to test if port 80 is opened is TCPTEST for Windows

from node-red-contrib-amazon-echo.

wongnam avatar wongnam commented on September 16, 2024

@datech I tried the new node ver 0.1.5 that a Echo Dot 1st Gen can discover the Amazon-Echo-Hub node at port 8000 now, but the command "ON" is always equal to "false" even i say turn "on" or turn "off". #4

update: Echo Dot 3rd Gen is work with the node without issue at port 80 NAT to 8000.

see my screen shot:
image

from node-red-contrib-amazon-echo.

datech avatar datech commented on September 16, 2024

Thanks, @wongnam.

Would it be possible to sniff the HTTP traffic to see the requests sent to the hub? I would suggest to use Wireshark on Windows or tcpdump on Linux.

from node-red-contrib-amazon-echo.

Barabba11 avatar Barabba11 commented on September 16, 2024

Seeing a video recently I discovered that this message may be generated when there is not a specific "switch on" command is told Alexa, this was my question about how to identify the request "switch it on" from "regulate it at.. ", which haven't been asnwered. Tomorrow I'll tr to figure it ut myself.

By now I would ask datech if the object that we see in the screenshot is exacty what ouptus Alexa or it is somehow manipulated by your module (interpreter). Kindly let us know that, thank you

from node-red-contrib-amazon-echo.

datech avatar datech commented on September 16, 2024

@Barabba11, that's why I prefer to use Alexa mobile app to test the setup. if it is working I can start using the voice commands.

I was thinking that I've managed to answer on your question about setting the brightness and power state. Alexa will send all commands one by one and you have to be able to distinguish between: Turn On and Set brightness to 10% for example. If the device is turned off and you ask Alexa to set the brightness, Echo will first send a turn on command to the hub. So, If you have saved the old brightness value you can compare it with the new one.

I've used the following code in a function node to check if power state is changed.

var state = context.get('state');

if ( state !== undefined && state.on != msg.on ) {
  msg.isOnChanged = true;
} else {
  msg.isOnChanged = false; 
}

context.set('state', msg);

return msg;

This will add isOnChanged in the message if "on" attribute is changed. Hope this helps

Message "on", "bri", "hue", "sat" and "ct" attributes are coming from Alexa and completely represent what Alexa is asking the hub to set.

from node-red-contrib-amazon-echo.

Barabba11 avatar Barabba11 commented on September 16, 2024

Are them separate commands and you assemply all of the in an unique object? I will try with the app too..

from node-red-contrib-amazon-echo.

wongnam avatar wongnam commented on September 16, 2024

Thanks, @wongnam.

Would it be possible to sniff the HTTP traffic to see the requests sent to the hub? I would suggest to use Wireshark on Windows or tcpdump on Linux.

@datech I installed it on a windows pc, my Echo Hub is on a RPI but i don't know how to use for this case.

from node-red-contrib-amazon-echo.

wongnam avatar wongnam commented on September 16, 2024

@datech version 0.1.6 is not being seen in Node-red palette.

from node-red-contrib-amazon-echo.

datech avatar datech commented on September 16, 2024

@wongnam I've just released it. It takes some time for Node-Red palette to be updated.

from node-red-contrib-amazon-echo.

wongnam avatar wongnam commented on September 16, 2024

@datech It can turn on and off now but a new issue is happen, it's no color capabilities for me to setting the color and temperature now.

from node-red-contrib-amazon-echo.

datech avatar datech commented on September 16, 2024

@wongnam Is it with Dot 2? Do you have any debug messages in the Node-Red console?

from node-red-contrib-amazon-echo.

wongnam avatar wongnam commented on September 16, 2024

@datech if I tried it with Dot 1 and Dot 2 and Alexa App are the same situation.
update debug:
1/28/2019, 8:58:54 AMnode: 204e0e5a.1c23d2 newplug : msg : Object { on: true, bri: 130, hue: 21845, sat: 254, ct: 199 … } 1/28/2019, 8:58:57 AMnode: 204e0e5a.1c23d2 newplug : msg : Object { on: true, bri: 196, hue: 21845, sat: 254, ct: 199 … } 1/28/2019, 8:59:00 AMnode: 204e0e5a.1c23d2 newplug : msg : Object { on: false, bri: 196, hue: 21845, sat: 254, ct: 199 … }
when i try it with Dot 3 that it can set color as normal even in Aleax app.

(Just for notice: Each time i test it with a new Echo Dot that i have to delete the device in Alexa app and discovery again. i think it's normal and make sense. but when i mix Dot 1,2,3 together i don't know know which it lies with.)

from node-red-contrib-amazon-echo.

datech avatar datech commented on September 16, 2024

@wongnam What about the Node-Red console?
Is there anything like this:

28 Jan 10:22:29 - [debug] Request body: {"bri":128}
28 Jan 10:22:35 - [debug] Request body: {"hue":0,"sat":254}
28 Jan 10:22:57 - [debug] Request body: {"on":false}

from node-red-contrib-amazon-echo.

wongnam avatar wongnam commented on September 16, 2024

How to go to this console, let me know please. Thanks.

from node-red-contrib-amazon-echo.

datech avatar datech commented on September 16, 2024

It depends on way you are using Node-Red. How did you start the Node-Red?
When you start Node-Red command line these messages will be printed there.

Here is the example output after starting the node-red command:

Welcome to Node-RED
===================

25 Jan 20:25:10 - [info] Node-RED version: v0.19.5
25 Jan 20:25:10 - [info] Node.js  version: v11.7.0
25 Jan 20:25:10 - [info] Linux 4.15.0-29-generic x64 LE
25 Jan 20:25:10 - [info] Loading palette nodes
25 Jan 20:25:10 - [debug] Module: node-red-contrib-amazon-echo 0.1.4
25 Jan 20:25:10 - [debug]         /home/vagrant/.node-red/node_modules/node-red-contrib-amazon-echo
25 Jan 20:25:10 - [debug] Module: node-red-node-email 0.1.29
25 Jan 20:25:10 - [debug]         /usr/lib/node_modules/node-red/node_modules/node-red-node-email
25 Jan 20:25:10 - [debug] Module: node-red-node-feedparser 0.1.14
25 Jan 20:25:10 - [debug]         /usr/lib/node_modules/node-red/node_modules/node-red-node-feedparser
25 Jan 20:25:10 - [debug] Module: node-red-node-rbe 0.2.4
25 Jan 20:25:10 - [debug]         /usr/lib/node_modules/node-red/node_modules/node-red-node-rbe
25 Jan 20:25:10 - [debug] Module: node-red-node-twitter 1.1.4
25 Jan 20:25:10 - [debug]         /usr/lib/node_modules/node-red/node_modules/node-red-node-twitter
25 Jan 20:25:11 - [warn] rpi-gpio : Raspberry Pi specific node set inactive
25 Jan 20:25:11 - [warn] rpi-gpio : Cannot find Pi RPi.GPIO python library
25 Jan 20:25:11 - [info] Settings file  : /home/vagrant/.node-red/settings.js
25 Jan 20:25:11 - [info] Context store  : 'default' [module=memory]
25 Jan 20:25:11 - [info] User directory : /home/vagrant/.node-red
25 Jan 20:25:11 - [warn] Projects disabled : editorTheme.projects.enabled=false
25 Jan 20:25:11 - [info] Flows file     : /home/vagrant/.node-red/flows_vagrant.json
25 Jan 20:25:11 - [debug] loaded flow revision: 0ef50f34a6320182092e53a47e7c8ac5
25 Jan 20:25:11 - [debug] red/runtime/nodes/credentials.load : user provided key
25 Jan 20:25:11 - [debug] red/runtime/nodes/credentials.load : default key present. Will migrate
25 Jan 20:25:11 - [debug] red/runtime/nodes/credentials.load : keyType=user
25 Jan 20:25:11 - [info] Starting flows
25 Jan 20:25:11 - [debug] red/nodes/flows.start : starting flow : global
25 Jan 20:25:11 - [debug] red/nodes/flows.start : not starting disabled flow : 68b5755a.958bec
25 Jan 20:25:11 - [debug] red/nodes/flows.start : starting flow : 1966cd69.3766d3
25 Jan 20:25:11 - [info] Started flows
25 Jan 20:25:11 - [info] Server now running at http://127.0.0.1:1880/
25 Jan 20:25:17 - [debug] Request body: {"on":true}
25 Jan 20:25:23 - [debug] Request body: {"bri":128}
25 Jan 20:25:27 - [debug] Request body: {"on":false}

from node-red-contrib-amazon-echo.

wongnam avatar wongnam commented on September 16, 2024

from node-red-contrib-amazon-echo.

datech avatar datech commented on September 16, 2024

Run the command node-red-log

from node-red-contrib-amazon-echo.

wongnam avatar wongnam commented on September 16, 2024

@datech below is my log.

28 Jan 20:55:57 - [info] Starting flows
28 Jan 20:55:57 - [debug] red/nodes/flows.start : starting flow : global
28 Jan 20:55:57 - [debug] red/nodes/flows.start : starting flow : 2786eff5.1677
28 Jan 20:55:58 - [info] Started flows
28 Jan 20:55:58 - [info] Server now running at http://127.0.0.1:1880/
28 Jan 20:56:18 - [debug] Request body: {"on":true}
28 Jan 20:56:34 - [debug] Request body: {"on":false}

from node-red-contrib-amazon-echo.

datech avatar datech commented on September 16, 2024
28 Jan 20:56:18 - [debug] Request body: {"on":true} 

This is turn on command

28 Jan 20:56:34 - [debug] Request body: {"on":false}

And this is turn off command, but I don't see any request for setting the brightness.

from node-red-contrib-amazon-echo.

wongnam avatar wongnam commented on September 16, 2024

28 Jan 21:03:22 - [info] Starting flows
28 Jan 21:03:22 - [debug] red/nodes/flows.start : starting flow : global
28 Jan 21:03:22 - [debug] red/nodes/flows.start : starting flow : 2786eff5.1677
28 Jan 21:03:23 - [info] Started flows
28 Jan 21:03:23 - [info] Server now running at http://127.0.0.1:1880/
28 Jan 21:04:33 - [debug] Request body: {"on":true}
28 Jan 21:04:38 - [debug] Request body: {"on":false}
28 Jan 21:04:41 - [debug] Request body: {"on":true,"bri":58}
28 Jan 21:04:46 - [debug] Request body: {"on":false}
28 Jan 21:04:48 - [debug] Request body: {"on":true}
28 Jan 21:04:50 - [debug] Request body: {"on":true,"bri":178}
28 Jan 21:04:54 - [debug] Request body: {"on":false}

image
image

from node-red-contrib-amazon-echo.

datech avatar datech commented on September 16, 2024

So, the issue is that color capabilities are missing and setting the brightness is working correctly?

from node-red-contrib-amazon-echo.

wongnam avatar wongnam commented on September 16, 2024

So, the issue is that color capabilities are missing and setting the brightness is working correctly?

Yes, you are right.

from node-red-contrib-amazon-echo.

Barabba11 avatar Barabba11 commented on September 16, 2024

@Barabba11, that's why I prefer to use Alexa mobile app to test the setup. if it is working I can start using the voice commands.

I was thinking that I've managed to answer on your question about setting the brightness and power state. Alexa will send all commands one by one and you have to be able to distinguish between: Turn On and Set brightness to 10% for example. If the device is turned off and you ask Alexa to set the brightness, Echo will first send a turn on command to the hub. So, If you have saved the old brightness value you can compare it with the new one.

I've used the following code in a function node to check if power state is changed.

var state = context.get('state');

if ( state !== undefined && state.on != msg.on ) {
  msg.isOnChanged = true;
} else {
  msg.isOnChanged = false; 
}

context.set('state', msg);

return msg;

This will add isOnChanged in the message if "on" attribute is changed. Hope this helps

Message "on", "bri", "hue", "sat" and "ct" attributes are coming from Alexa and completely represent what Alexa is asking the hub to set.

Hi mate, thnx for reply, pls look this video at about 3:19, how he gests from Alexa this "on_off_command : false", I don't have this label, I have only on:true and it is true also when I change only brightness. I've updated to 0.16. Thank you
https://www.youtube.com/watch?v=4QfoXdcfqKI

what I have
object
on: true
bri: 203
hue: 0
sat: 254
ct: 199
colormode: "ct"
payload: "on"
deviceid: "a5449f04d59f48"

from node-red-contrib-amazon-echo.

datech avatar datech commented on September 16, 2024

@wongnam I'm not sure, but it might be related to the Echo device firmware version.

Here is how to updated it if you haven't done it already:
https://www.amazon.com/gp/help/customer/display.html?nodeId=202168870

Latest version for Echo Dot 2nd gen is 628568520
https://www.amazon.com/gp/help/customer/display.html?nodeId=201602210

from node-red-contrib-amazon-echo.

wongnam avatar wongnam commented on September 16, 2024

Ok, Thank you very much.

My Summary:

  1. Wiki to fix "Error: listen EACCES: permission denied 0.0.0.0:80" issue.
    Solution:

Another solution:

  • for Echo Dot 1 or Echo Dot 2 : Amazon-Echo-Hub use port: >1024
  • for Echo Dot 3 : Amazon-Echo-Hub use port:>1024 and use NAT port:80 to port:>1024 eg: port:8000
    • to checked it the port is in use already: sudo iptables -L -n (it was empty, so ok I proceeded)
    • to added a listening port: sudo iptables -I INPUT 1 -p tcp --dport 80 -j ACCEPT
    • sudo iptables -A PREROUTING -t nat -i eth0 -p tcp --dport 80 -j REDIRECT --to-port 8000
    • To save the table and have them automatically after reboot: sudo apt-get install iptables-persistent

2- Can "Amazon Echo Hub" node work with HTTPS enabled Node-Red? Yes
3- Can "Amazon Echo Hub" node work if I have Echo or Echo Dot with multi generation

  • Echo Dot 1st gen -> Yes, but color capabilities are missing, maybe relate to Echo itself. (I think this node probably works with the Amazon Echo 1st gen)
  • Echo Dot 2nd gen -> Yes, but color capabilities are missing, maybe relate to Echo itself.
  • Echo Dot 3rd gen -> Yes. Full function.

from node-red-contrib-amazon-echo.

wongnam avatar wongnam commented on September 16, 2024

@datech As my issue is fixed. I close the case now. Thanks.
@Barabba11 Hi, Please raise your issue with a new topic. Thanks.

from node-red-contrib-amazon-echo.

wongnam avatar wongnam commented on September 16, 2024

link to @Barabba11 new topic #10

from node-red-contrib-amazon-echo.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.