andrei-tatar / node-red-contrib-nora

Node Red Google Home integration
74 stars 25 forks source link

Light Node doesn't output a command corrctly #18

Closed Mahdi-Fatemi closed 5 years ago

Mahdi-Fatemi commented 5 years ago

Hi, I'm using Nora to control a light remotely by google home app on my iPhone6. the problem is when I try to turn on the light (when msg.payload.on is false) by changing the brightness on the circle of the app that shows the brightness, the nora light node doesn't output the the correct message in both output ways. when the object output is selected, it return this as the payload: {"on":false, "brightness": [the number that selected from the app]} and when the number output is selected, it returns 0 as the payload both of the above ways will not turn on the light. I tried to use google assistant to see my problem get fixed or not, here is the story of problem in google assistant: The light was off, I told google assistant "set the light to 80%", google assistant responded this way: "ok, the light is set to 80%" then the app showed me the orange circle raising to 80% which means the output message should contain the object having on:true,brightness:# or the brightness number as the payload. but it contains on:false,brightness:# or 0 as the payload. this problem only occurs when I want to turn on the light by changing the brightness and won't happen when I tap at the center of circle to turn it on.

andrei-tatar commented 5 years ago

I also noticed you can't turn the light on at a certain brightness from the Google Assistant, unfortunately that's not something I can change. I only forward the state update I receive from google. You can add a function node in between that sets on to true state when the brightness changes or open an issue at google assistant (there might be a related one already).

Mahdi-Fatemi commented 5 years ago

I also noticed you can't turn the light on at a certain brightness from the Google Assistant, unfortunately that's not something I can change. I only forward the state update I receive from google. You can add a function node in between that sets on to true state when the brightness changes or open an issue at google assistant (there might be a related one already).

hey andrei-tatar, first of all thank you for your great reply and also for the code. yeah this idea reached to my mind too but it leads to another problem, here's the story: I told myself when light is off , google home will send command only and only if the command purpose is turning on the light, so I put a function after light node to check if the previous state of light was off, at this case we can consider the command is sent to turn on the light no matter the msg.payload.on is false or true, I tested it and it worked well with commands related to a single light. the problem begins when you add the light to a room containing another lights (a room with several dimming lights). imagine you have set light1 to 10%, light2 to 50% and light3 is off. when you turn of the room lights (all together by tapping once on "off" command below the room in google home app), all the three nora light nodes will output a message separately, light1 & light2 will turn off as expected but since the light3 was off and we assume that the new message wants to turn on the light3 and it will turn on. so group commands won't work correctly this way.

I am surprised that Google Home contains such an embarrassing bug, how can I report that ? can we hope that it will get fixed in the next update ?