Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Maybe possible to understand differences between power on and regulate #10

Closed
Barabba11 opened this issue Jan 28, 2019 · 16 comments
Closed

Comments

@Barabba11
Copy link

Hi since wongnam closed the previous issue, where I posted this discussion and since my old issue is closed I open a new one, hopefully there may be a soltion, which I saw in a video on Youtube, here is the post:

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

@datech
Copy link
Owner

datech commented Jan 28, 2019

The package used is the video is node-red-contrib-alexa-local. The attribute "on_off_command" is additionally added by the dev team and it is not send by Alexa.

The solution I've proposed will do the same thing, but outside of the hub. Just create a new function node and use the JavaScript code listed above. It will add isOnChanged attribute to the message.

flow
function

@Barabba11
Copy link
Author

I understand what you mean, already thought about that, but my hope rised again when I saw the video.
I think it is related to the device Alexa is thinking to drive, you used the libary of a device which should receive on and bri as a start, but this may not fulfill all devices. For example now I'm including shutters on node red, and I guess there is a device for controlling shutters that Alexa recognize like that, and she will support the movement directions, up and down.
In the same way there may be devices already alexa knows and that support fifferent commands for power on and intensity, movements etc. Can you please check if there are other libraries that can be implemented? As now it appear "rigid" and the simbol in Alexa app is always a light..
Thank you

@datech
Copy link
Owner

datech commented Jan 28, 2019

Unfortunately, the light device that I've chosen to simulate is currently the best option as it supports power, color, and brightness attributes.

Here is list of voice commands that can be used.

  • Alexa, turn on/off {light}
  • Alexa, Set {light} to 50%
  • Alexa, turn my {light} light green
  • Alexa, set the {light} light to orange
  • Alexa, make the {light} warmer
  • Alexa, brighten {light} to 60 percent
  • Alexa, dim the {light} lights
  • Alexa, {light} lights fifty
  • Alexa, {light} lights fifty percent

@Barabba11
Copy link
Author

Ok we got then where is coming the limitation :)
DO you have maybe plans to add other devices? Is that difficult?

@datech
Copy link
Owner

datech commented Jan 28, 2019

If there is way to add a new device type that can support more features I will add it in the future version, but currently this is the best one without using Alexa skills.

@Barabba11
Copy link
Author

May this be useful?

https://pypi.org/project/fauxmo/0.3.2/

@Barabba11
Copy link
Author

Have you checked it maybe? Seems a good base

@datech
Copy link
Owner

datech commented Jan 30, 2019

node-red-contrib-wemo-emulator package already implemented Wemo devices.

This package simpulate Philips Hue hub which supports mainly bulbs.

@Barabba11
Copy link
Author

thank you for reply, I saw it creates ports up than 1024, and Echo puls works only with 80, and on 80 I have your server.. I also would like to avoid destroy what I did now just for test it on the port 80..
Do you think it is possible to include this into your module?
Thank you

@datech
Copy link
Owner

datech commented Feb 1, 2019

I'm not sure I understand your issue. You can link multiple devices to Amazon Echo Hub node, like this:

Usage screenshot

@Barabba11
Copy link
Author

datech yes it is clear, but you know I'm always hoping you can include in your module different devices, so we can have from alexa different commands, like the only switch on (different object than adjust brightness), move up or down for the shutters/blinds, have "stop" command for the shutters..
If this Wemo library is already development and need only few modifications to be included in your module.. why not trying?
The reason is simple, alexa look for devices only on port 80, and now I have your http server using the port 80 and I can't put another module listening on that port.. I hope you understand what I mean.

Another question, the son of this friend has Alexa too now, and lives next to him (they share LAN), I would like to add to Node Red also his devices, but they should have the same name ("Alexa, turn the living room off"), it would be great to disable temporary all modules of the Alexa1 and let Alexa2 discover the new devices, how this can be possible in your opinion? Node Red is supporting multiple "boards"? I don't think so..
Thank you!

@datech
Copy link
Owner

datech commented Feb 3, 2019

I’m still investigating a way to add support for more commands without using additional skills.
The library you have mentioned is written in Python. Node-Red and this module use JavaScript. Anyway, I'm not aware of possibility to use Wemo thermostat for example without using Alexa skill. The Wemo device that can be used without Alexa skill is a smart plug, which is already implemented by wemo-emulator module.

it would be great to disable temporary all modules of the Alexa1 and let Alexa2 discover the new devices, how this can be possible in your opinion?

Have you tried to disable the flow? Edit flow -> set status to disable

@Barabba11
Copy link
Author

Can I have then 2 flows, and enable one only, let alexa2 discover, and enable back flow1? Does your http server deny Alexa2 find the Alexa2 devices if flow is disabled? And after can flow 1 and 2 work simultaneously?
The easiest way would be disable the devices in the flow, and put new ones, if you may introduce a "disable" option in the node config (where I write name and topic) it would be nice, thank you!

About wemo, I read there is a shutter control also. The smart plug is useless, since your module does it already. Anyway you may think to run the python script externally and interface with it, I think you did the same with http server..
I hope..
Thanks for research, I'm trying to help you with that too, maybe there are already available code/scripts for other local devices that Alexa can recognise without skills..

@datech
Copy link
Owner

datech commented Feb 4, 2019

Yes, you can have multiple flows and enable only those you need. You can have Amazon Echo Hub added on each flow and you can have multiple Amazon Echo Hubs running on different ports

@Barabba11
Copy link
Author

sorry how can I have Echo Hup running on different ports if alexa just connect to the port 80? I can't map 2 ports on the same 80..
May I kindly ask you to add a feature to disable the device? Thank you!

@datech
Copy link
Owner

datech commented Feb 5, 2019

Feature request was created #17

@datech datech closed this as completed Feb 5, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants