originallyus / node-red-contrib-alexa-local

An easy-to-use NodeRED node for adding Alexa capability to NodeRED. NO Alexa Skills required.
107 stars 25 forks source link

How to get a dimming level? #44

Closed SteveRMann closed 6 years ago

SteveRMann commented 6 years ago

This node works fine for "on" and "off". "Alexa, turn red on" and "Alexa, turn red off" ("Red" is the name of the node) both return an "on" or "off" payload:

{"on":true,"on_off_command":true,"payload":"on","change_direction":0,"bri":100,"bri_normalized":1,"device_name":"Red","light_id":"6011dc4ea15ca4","port":43967,"_msgid":"d238236a.62d75"}

But I can't figure out how to send a dimming level. When I say "Alexa, set red to 50%", Alexa first asks what device, then replies "I don't know how to set Red to that setting".

Guidance would be appreciated.

burleanu commented 6 years ago

Please can we have an example how to use the "bri: " value. Not enough experienced with coding.

Can you put also put what you have on the screenshots as node red flows for easy import. This way we can use it as inspiration. Or explanation how to make the "format dimming value". For the simple ON and OFF it was easy because it use the "payload" but how to use the other value is a bit hard for a new comer. Thanks!

SteveRMann commented 6 years ago

The problem is not in using the value. It's just JSON formatted data. My problem is that the samples on the git show the user setting a light to a dimming value- and that doesn't seem to work with this node.

This node does work, but it's a bit more work to set up: https://www.npmjs.com/package/node-red-contrib-alexa-home-skill

burleanu commented 6 years ago

If no one was willing to give an example I did try to make one that read the value from for "bri:" With this I see it have a normal behavior. If somebody want to correct or do something new can. Please also show to me too how ..... For the moment is working the same the one you mention above.

One nice thing will be to be able to see it also in the Alexa app, but it looks like the creator don't want to change this behavior. Maybe someone can teach me how to change this fixed value that Alexa see as default. I understand the reason why the creator want to be like this for increase/decrease value (even those are doing only 25 and 75%), but.... I think is more nice to have a real feedback from the app, because this way even when not at home you can see if you forgot a light on or off (for example). I don't know if he is reading this but i suggest to add a field inside the node-red configuration and there to insert the value for the increase/decrease light or temperature (depending for what is use the node).

[{"id":"e464d08a.30bfe","type":"http request","z":"f5b8c643.50fd38","name":"","method":"GET","ret":"txt","url":"http://192.168.178.22/led/{{payload}}","tls":"","x":689.1001205444336,"y":39.00000762939453,"wires":[[]]},{"id":"e55b62f2.4798e","type":"alexa-local","z":"f5b8c643.50fd38","devicename":"Light","inputtrigger":true,"x":139.1000099182129,"y":53.000003814697266,"wires":[["d28b77f3.ba64f8"]]},{"id":"d28b77f3.ba64f8","type":"function","z":"f5b8c643.50fd38","name":"format value bri","func":"var newMsg = {payload :msg.bri };\nreturn newMsg;","outputs":1,"noerr":0,"x":442,"y":62,"wires":[["e464d08a.30bfe"]]}]

SteveRMann commented 6 years ago

The problem is not /getting /the dim value, it's /setting /it that doesn't work.

Steve Mann

On 1/17/2018 3:04 PM, burleanu wrote:

If no one was willing to give an example I did try to make one that read the value from for "bri:" With this I see it have a normal behavior. If somebody want to correct or do something new can. Please also show to me too how ..... For the moment is working the same the one you mention above.

One nice thing will be to be able to see it also in the Alexa app, but it looks like the creator don't want to change this behavior. Maybe someone can teach me how to change this fixed value that Alexa see as default. I understand the reason why the creator want to be like this for increase/decrease value (even those are doing only 25 and 75%), but.... I think is more nice to have a real feedback from the app, because this way even when not at home you can see if you forgot a light on or off (for example). I don't know if he is reading this but i suggest to add a field inside the node-red configuration and there to insert the value for the increase/decrease light or temperature (depending for what is use the node).

[{"id":"e464d08a.30bfe","type":"http request","z":"f5b8c643.50fd38","name":"","method":"GET","ret":"txt","url":"http://192.168.178.22/led/{{payload}}","tls":"","x":689.1001205444336,"y":39.00000762939453,"wires":[[]]},{"id":"e55b62f2.4798e","type":"alexa-local","z":"f5b8c643.50fd38","devicename":"Light","inputtrigger":true,"x":139.1000099182129,"y":53.000003814697266,"wires":[["d28b77f3.ba64f8"]]},{"id":"d28b77f3.ba64f8","type":"function","z":"f5b8c643.50fd38","name":"format value bri","func":"var newMsg = {payload :msg.bri };\nreturn newMsg;","outputs":1,"noerr":0,"x":442,"y":62,"wires":[["e464d08a.30bfe"]]}]

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/originallyus/node-red-contrib-alexa-local/issues/44#issuecomment-358427178, or mute the thread https://github.com/notifications/unsubscribe-auth/AHt3IUqE8Q4R5GSMYvDRlQgIVVoPXLDrks5tLlJXgaJpZM4RVeqE.

burleanu commented 6 years ago

Now I understand what you mean. Have you try to give the node the name "Red Light" instead of just "Red". Also from the Alexa app are you able to change the brightness? Maybe you are using an older version of this node or other things. In my case is working fine, identical like the other node-red you mentioned above. The only issue I still have is to get the real time feedback inside the Alexa app, but that's when the creator of the node wants to implement....

torinnguyen commented 6 years ago

@SteveRMann most probably Alexa does not like the name 'red', please troubleshoot with something other names.

The documentation of the node already explains how to send a value into the node. image

torinnguyen commented 6 years ago

@burleanu the on/off state shown in Alexa app was implemented incorrectly. This has been fixed in latest version. However, the brightness shown in Alexa app is always 49%. This is still intentional.

It's Alexa who decides to increase/decrease the values by 25%, so I had to implemented 49% specifically to detect such voice command from users.

You can make use of 'bri' and 'change_direction' in the output with your custom logics to decide how much to increase/decrease the brightness of your physical device. Remember to pump 'bri' it back to Alexa node when you're done.

thePhilipp commented 6 years ago

The input is not the problem. For example, when i use the dim slider in the Alexa app, the value of the Alexa node shows the right value directly under the Node. But the payload from the output is always "on" or "off". But for dimming my RGB Stripes via mqtt i need a number between 0-100

islaeh commented 5 years ago

@thePhilipp You need to look for msg.bri instead of msg.payload