Alexa doesn't make difference between "switch on" and "regulate"

#1

Hi, I'm testing Alexa the firt time and suddenly noticed that the message payload I receive is the same, if I say switch on or regulate. In particular the switch on command cause me a trouble, I don't know how to get that (since packets are equal) and it contains the amount of brightness Alexa remember from the last time, and not actually what is present or I want.
For example my lights are off but were set at 20%, alexa remembers 100% from yesterday, after I used my phone to regulate them, if I switch them off and copy Alexa value I"lll have them 100%.
The same for the TV volume I think..

I would love to receive from Alexa what she actully heard, is that possible? Thank you

#2

There is no easy way for Alexa to know that you have changed the brightness if you are using a separate app to control the lights. You could use persistent variables in your Node-Red flow to keep track of it though. If you want to receive what Alexa THOUGHT she heard you will have to use the developer Amazon AWS website and develop your own code, which also entails opening your node-red system to the internet over HTTPS.

1 Like
#3

thank you, so you are confirming me there is no way (without amazon development) to receive different messages between "Alexa turn on" and "Alexa regulate at..".
I don't preteng Alexa know the local settings but that it produces me two different commands, yes. There are many data on the payload, they could easly add the difference, for example word said

#4

You haven't said which of the Alexa nodes you are using.
If you are asking a question about how a node works you really need to specify which node you mean.

If you are using node-red-contrib-alexa-home-skill all the commands that the node supports are listed.
https://alexa-node-red.bm.hardill.me.uk/docs

1 Like
#5

Sorry, I was meaning a general question about the payload ALexa generate, if it is like that and we can't walkarount that..
I've a Echo Plus, I'm using node-red-contrib-amazon-echo 0.1.4
I'm not going to use skill and cloud on internet, everthing should keep local..
Thank you for support )

#6

How do you plan to use Alexa and keep everything local?
Alexa listens to the keyword and then streams the audio to the cloud.

1 Like
#7

I really don't know how Alexa works, I mean Node Red will not comunicate to internet. Actually it works with node-red-contrib-amazon-echo 0.1.4, only that Alexa send the value of dimmer even if i say "switch on" and there is no difference into the paload between "switch it on" and "regulate it to 80%". How can I distinguish the two commands?
Thank you

#8

I don't use that node so can't help you. If you don't think the instructions for that node are clear I would suggest you contact the author by opening an issue on the nodes github page.

But if you are using Alexa there has to be a connection to the internet, that is how Alexa works.

1 Like
#9

I asked him already, thanks ) Maybe someone has experience with Alexa and can confirm the two payloads are identical, or hopefully differ each other about something. Thank you all for support )

#10

I've never heard of that node, either.
I use node-red-contrib-alexa-local here. The only responses this node gives are "ON", "OFF", and "BRI", but it's dumbed-down enough for me to use.

#11

So you don't have any difference between "switch it on" and "regulate it to 80%" (if the previuos setting was 80% of course). Thanks

#12

Like I said, node-red-contrib-alexa-local provides "ON", "OFF" and "BRI". It neither needs to know or cares what the prior state is.

I have a light at the landing at the top of my stairs. Setting the brightness is a bit more complex, but here is how I did it:

If I want it dim, I'll say "Alexa, set landing light to 50%", and the node gives me a JSON reply of:

{"on":true,"bri":50,"from":"::ffff:192.168.1.42","on_off_command":false,"payload":"on","change_direction":0,"bri_normalized":0.5,"device_name":"Landing Light","light_id":"704fb13452d8d","port":42732,"_msgid":"e20dc070.4defa"}

So the first thing I do is map 0-100 (from Alexa) to 0-255 (for the Z-Wave light).
Next, I use a switch node to decide if the command is "on", "off" or "bri". If it's "on" or "off" then another switch node sends it to the on or off call service node.
If is a brightness command, I use a function to put the brightness and entity_id into the payload:

msg.payload = {"data":{"entity_id":"light.landing","brightness":msg.bri}};
return msg;

Which is then sent to a call service node.

I am NOT an expert and there is likely a more elegant way to accomplish this, but this works.