AlexanderBabel / homebridge-broadlink-rm

[This fork supports TV accessories] Broadlink RM Mini and Pro plugin for homebridge: https://github.com/nfarina/homebridge
Apache License 2.0
46 stars 11 forks source link

Add Original Broadlink PR#336 #33

Open mitch7391 opened 4 years ago

mitch7391 commented 4 years ago

I know you said you only support the TV accessory on this fork, but I saw you were willing to add some air con mods someone put forward. Frustratingly the old plugin is no longer supported and a PR on it I need was never merged (#336) is there any chance you could merge it into your fork? There are two parts to it, I’m only after the white colour added to the light.

kiwi-cam commented 4 years ago

Hi @mitch7391 I've added the white code (with one tweak). Could you test by re-installing this plugin using this command (to put the branch direct from git): npm install -g git+https://github.com/AlexanderBabel/homebridge-broadlink-rm#kiwi-cam-whitelight

If you're able to add the white hex code to your config.json and confirm everything works as expected I'll merge this with the master.

mitch7391 commented 4 years ago

@kiwi-cam thanks for giving this a go. I just tried to test it a heap and it worked maybe once or twice by turning white, but not when I would expect it to. After selecting a colour from the colour wheel, I would drop the saturation to the center of the wheel (original PR required under 10% saturation from memory), it would either change to the next closest colour or not change at all. The few times it changed to white were when I was expecting a colour (at high saturation). I am not sure if the fact that I have only configured 5 colours plus white out of my total 16 is affecting it; as the code tries to pick the nearest one configured in the wheel.

kiwi-cam commented 4 years ago

Thanks for the update @mitch7391. I've added some logging to show the hue and saturation it's aiming for, as well as what it's setting. If you're up for it, could you run the command again to install over the top and post your logs showing the hue changes?

mitch7391 commented 4 years ago

@kiwi-cam sorry for the delay, work has been crazy! Ok so I updated and tried again. The order of hues from the colour wheel that I executed were as follows (each at high saturation), started already on white, selected red, selected green, selected white (center of wheel) and selected red again.

What I saw: No change from white, change to green, change to red and change to white.

Logs:

Oct 27 08:15:12 homebridge homebridge[6641]: [10/27/2019, 8:15:12 AM] [Broadlink RM] LightTest setHue: 1 Oct 27 08:15:12 homebridge homebridge[6641]: [10/27/2019, 8:15:12 AM] [Broadlink RM] LightTest setHue: (closest: white) Oct 27 08:15:12 homebridge homebridge[6641]: [10/27/2019, 8:15:12 AM] [Broadlink RM] LightTest sendHex (192.168.0.154; 34:ea:34:99:f1:28) b20e34000d290d290d2a0d2a261026110d2926110d290d2a26110d2a261126110d2926100d290d2a0d290d2a261126110d2a0d290d00019600000000 Oct 27 08:15:12 homebridge homebridge[6641]: [10/27/2019, 8:15:12 AM] [Broadlink RM] LightTest setSaturation: 81

Oct 27 08:15:21 homebridge homebridge[6641]: [10/27/2019, 8:15:21 AM] [Broadlink RM] LightTest setHue: 99 Oct 27 08:15:21 homebridge homebridge[6641]: [10/27/2019, 8:15:21 AM] [Broadlink RM] LightTest setHue: (closest: hue120) Oct 27 08:15:21 homebridge homebridge[6641]: [10/27/2019, 8:15:21 AM] [Broadlink RM] LightTest sendHex (192.168.0.154; 34:ea:34:99:f1:28) b21834000d2a0d2a0d2a0d2a261126110d2a26110d2a0d2a26110d2a261126110d2a26110d2a0d2a0d2a0d2a26110d2a26110d2a0d00019600000000 Oct 27 08:15:21 homebridge homebridge[6641]: [10/27/2019, 8:15:21 AM] [Broadlink RM] LightTest setSaturation: 70

Oct 27 08:15:25 homebridge homebridge[6641]: [10/27/2019, 8:15:25 AM] [Broadlink RM] LightTest setHue: 0 Oct 27 08:15:25 homebridge homebridge[6641]: [10/27/2019, 8:15:25 AM] [Broadlink RM] LightTest setHue: (closest: hue0) Oct 27 08:15:25 homebridge homebridge[6641]: [10/27/2019, 8:15:25 AM] [Broadlink RM] LightTest sendHex (192.168.0.154; 34:ea:34:99:f1:28) b21334000d290d2a0d290d29261126110d2a26100d2a0d2926110d29261126110d2926110d290d2a0d290d2926100d2a0d2926100e00019500000000 Oct 27 08:15:25 homebridge homebridge[6641]: [10/27/2019, 8:15:25 AM] [Broadlink RM] LightTest setSaturation: 0

Oct 27 08:15:30 homebridge homebridge[6641]: [10/27/2019, 8:15:30 AM] [Broadlink RM] LightTest setHue: 7 Oct 27 08:15:30 homebridge homebridge[6641]: [10/27/2019, 8:15:30 AM] [Broadlink RM] LightTest setHue: (closest: white) Oct 27 08:15:30 homebridge homebridge[6641]: [10/27/2019, 8:15:30 AM] [Broadlink RM] LightTest sendHex (192.168.0.154; 34:ea:34:99:f1:28) b20e34000d290d290d2a0d2a261026110d2926110d290d2a26110d2a261126110d2926100d290d2a0d290d2a261126110d2a0d290d00019600000000 Oct 27 08:15:30 homebridge homebridge[6641]: [10/27/2019, 8:15:30 AM] [Broadlink RM] LightTest setSaturation: 78

kiwi-cam commented 4 years ago

Thanks for that @mitch7391. It looks to me like the Saturation value is being set after the Hue. The lines "setSaturation: xx" at the end of the steps appear to match correctly with the next change picking up white.

At the moment the setSaturation function isn't being used so I've moved the logic around "white" there - which makes more sense anyway. Could you run npm install -g git+https://github.com/AlexanderBabel/homebridge-broadlink-rm#kiwi-cam-whitelight, restart homebridge, and try again?

mitch7391 commented 4 years ago

@kiwi-cam just letting you know I haven't forgotten about this one, I just haven't had much time lately to give it a go. Hopefully should be able to do some further testing for in the next few days.

kiwi-cam commented 4 years ago

No pressure @mitch7391 but any updates? Just having a tidy up and I've for a Pull Request all lined up ready to go when/if you give the all clear.

mitch7391 commented 4 years ago

@kiwi-cam I am so sorry for the delay in this, have been hands off homekit for a few weeks. I downloaded the link you provided and gave it a go. Order of hues I attempted (started on white): Red, White, Green, White, Blue and then White. What I saw: No change (from white) Red, Green, Red, Blue and then Red.

Logs:

Nov 26 19:58:59 homebridge homebridge[14205]: [11/26/2019, 7:58:59 PM] [Broadlink RM] LightTest getHue: 0 Nov 26 19:58:59 homebridge homebridge[14205]: [11/26/2019, 7:58:59 PM] [Broadlink RM] LightTest getBrightness: 100 Nov 26 19:58:59 homebridge homebridge[14205]: [11/26/2019, 7:58:59 PM] [Broadlink RM] LightTest getSaturation: 0 Nov 26 19:59:21 homebridge homebridge[14205]: [11/26/2019, 7:59:21 PM] [Broadlink RM] LightTest setHue: 358 Nov 26 19:59:21 homebridge homebridge[14205]: [11/26/2019, 7:59:21 PM] [Broadlink RM] LightTest setHue: (closest: hue300) Nov 26 19:59:21 homebridge homebridge[14205]: [11/26/2019, 7:59:21 PM] [Broadlink RM] LightTest sendHex (192.168.0.154; 34:ea:34:99:f1:28) b21034000e290e290e290e29271027100e2927100e290e2927100e29271027100e2927100e290e290e29271027100e29271027100e00019600000000 Nov 26 19:59:21 homebridge homebridge[14205]: [11/26/2019, 7:59:21 PM] [Broadlink RM] LightTest setSaturation: 90 Nov 26 19:59:21 homebridge homebridge[14205]: [11/26/2019, 7:59:21 PM] [Broadlink RM] LightTest setSaturation: (Updating to : hue:358 saturation:90) Nov 26 19:59:30 homebridge homebridge[14205]: [11/26/2019, 7:59:30 PM] [Broadlink RM] LightTest setHue: 0 Nov 26 19:59:30 homebridge homebridge[14205]: [11/26/2019, 7:59:30 PM] [Broadlink RM] LightTest setHue: (closest: hue0) Nov 26 19:59:30 homebridge homebridge[14205]: [11/26/2019, 7:59:30 PM] [Broadlink RM] LightTest sendHex (192.168.0.154; 34:ea:34:99:f1:28) b21334000d290d2a0d290d29261126110d2a26100d2a0d2926110d29261126110d2926110d290d2a0d290d2926100d2a0d2926100e00019500000000 Nov 26 19:59:30 homebridge homebridge[14205]: [11/26/2019, 7:59:30 PM] [Broadlink RM] LightTest setSaturation: 0 Nov 26 19:59:30 homebridge homebridge[14205]: [11/26/2019, 7:59:30 PM] [Broadlink RM] LightTest setSaturation: (Updating to : hue:0 saturation:0) Nov 26 19:59:30 homebridge homebridge[14205]: [11/26/2019, 7:59:30 PM] [Broadlink RM] LightTest setSaturation: (closest: white) Nov 26 19:59:30 homebridge homebridge[14205]: [11/26/2019, 7:59:30 PM] [Broadlink RM] LightTest sendHex (192.168.0.154; 34:ea:34:99:f1:28) b20e34000d290d290d2a0d2a261026110d2926110d290d2a26110d2a261126110d2926100d290d2a0d290d2a261126110d2a0d290d00019600000000 Nov 26 19:59:34 homebridge homebridge[14205]: [11/26/2019, 7:59:34 PM] [Broadlink RM] LightTest setHue: 121 Nov 26 19:59:34 homebridge homebridge[14205]: [11/26/2019, 7:59:34 PM] [Broadlink RM] LightTest setHue: (closest: hue120) Nov 26 19:59:34 homebridge homebridge[14205]: [11/26/2019, 7:59:34 PM] [Broadlink RM] LightTest sendHex (192.168.0.154; 34:ea:34:99:f1:28) b21834000d2a0d2a0d2a0d2a261126110d2a26110d2a0d2a26110d2a261126110d2a26110d2a0d2a0d2a0d2a26110d2a26110d2a0d00019600000000 Nov 26 19:59:34 homebridge homebridge[14205]: [11/26/2019, 7:59:34 PM] [Broadlink RM] LightTest setSaturation: 61 Nov 26 19:59:34 homebridge homebridge[14205]: [11/26/2019, 7:59:34 PM] [Broadlink RM] LightTest setSaturation: (Updating to : hue:121 saturation:61) Nov 26 19:59:36 homebridge homebridge[14205]: [11/26/2019, 7:59:36 PM] [Broadlink RM] LightTest setHue: 0 Nov 26 19:59:36 homebridge homebridge[14205]: [11/26/2019, 7:59:36 PM] [Broadlink RM] LightTest setHue: (closest: hue0) Nov 26 19:59:36 homebridge homebridge[14205]: [11/26/2019, 7:59:36 PM] [Broadlink RM] LightTest sendHex (192.168.0.154; 34:ea:34:99:f1:28) b21334000d290d2a0d290d29261126110d2a26100d2a0d2926110d29261126110d2926110d290d2a0d290d2926100d2a0d2926100e00019500000000 Nov 26 19:59:36 homebridge homebridge[14205]: [11/26/2019, 7:59:36 PM] [Broadlink RM] LightTest setSaturation: 0 Nov 26 19:59:36 homebridge homebridge[14205]: [11/26/2019, 7:59:36 PM] [Broadlink RM] LightTest setSaturation: (Updating to : hue:0 saturation:0) Nov 26 19:59:36 homebridge homebridge[14205]: [11/26/2019, 7:59:36 PM] [Broadlink RM] LightTest setSaturation: (closest: white) Nov 26 19:59:36 homebridge homebridge[14205]: [11/26/2019, 7:59:36 PM] [Broadlink RM] LightTest sendHex (192.168.0.154; 34:ea:34:99:f1:28) b20e34000d290d290d2a0d2a261026110d2926110d290d2a26110d2a261126110d2926100d290d2a0d290d2a261126110d2a0d290d00019600000000 Nov 26 19:59:39 homebridge homebridge[14205]: [11/26/2019, 7:59:39 PM] [Broadlink RM] LightTest setHue: 232 Nov 26 19:59:39 homebridge homebridge[14205]: [11/26/2019, 7:59:39 PM] [Broadlink RM] LightTest setHue: (closest: hue240) Nov 26 19:59:39 homebridge homebridge[14205]: [11/26/2019, 7:59:39 PM] [Broadlink RM] LightTest sendHex (192.168.0.154; 34:ea:34:99:f1:28) b2002001241125100d2925100d290c2a0c290c2925110c29251125100d0001950c290d290c290c2a251026100c2925110c290c2926100c29261025100c2a25100c290d290d280d2925100d292510260f0d0001960c290c290d290c29261025100d2925100c2a0c2926100c29251026100c2926100d280d290c290d2925100d292510260f0d0001950d290d280d290c29261025100d2826100c2a0c2926100c29251026100c2926100c290d290c290d2925100d282610260f0d0001950d290c2a0c290c29251125100c2926100c290d2925100d29251125100c2925110c290c290d290c2a25100c29261025110c0001960c290c2a0c290c2a251025110c2925110c290c2926100c2a251025110c2925100d290c2a0c290c2a25100c2a251025100d0005dc0000000000000000 Nov 26 19:59:39 homebridge homebridge[14205]: [11/26/2019, 7:59:39 PM] [Broadlink RM] LightTest setSaturation: 70 Nov 26 19:59:39 homebridge homebridge[14205]: [11/26/2019, 7:59:39 PM] [Broadlink RM] LightTest setSaturation: (Updating to : hue:232 saturation:70) Nov 26 19:59:41 homebridge homebridge[14205]: [11/26/2019, 7:59:41 PM] [Broadlink RM] LightTest setHue: 0 Nov 26 19:59:41 homebridge homebridge[14205]: [11/26/2019, 7:59:41 PM] [Broadlink RM] LightTest setHue: (closest: hue0) Nov 26 19:59:41 homebridge homebridge[14205]: [11/26/2019, 7:59:41 PM] [Broadlink RM] LightTest sendHex (192.168.0.154; 34:ea:34:99:f1:28) b21334000d290d2a0d290d29261126110d2a26100d2a0d2926110d29261126110d2926110d290d2a0d290d2926100d2a0d2926100e00019500000000 Nov 26 19:59:41 homebridge homebridge[14205]: [11/26/2019, 7:59:41 PM] [Broadlink RM] LightTest setSaturation: 0 Nov 26 19:59:41 homebridge homebridge[14205]: [11/26/2019, 7:59:41 PM] [Broadlink RM] LightTest setSaturation: (Updating to : hue:0 saturation:0) Nov 26 19:59:41 homebridge homebridge[14205]: [11/26/2019, 7:59:41 PM] [Broadlink RM] LightTest setSaturation: (closest: white) Nov 26 19:59:41 homebridge homebridge[14205]: [11/26/2019, 7:59:41 PM] [Broadlink RM] LightTest sendHex (192.168.0.154; 34:ea:34:99:f1:28) b20e34000d290d290d2a0d2a261026110d2926110d290d2a26110d2a261126110d2926100d290d2a0d290d2a261126110d2a0d290d00019600000000 Nov 26 19:59:47 homebridge homebridge[14205]: [11/26/2019, 7:59:47 PM] [Broadlink RM] Light Up getSwitchState: undefined Nov 26 19:59:47 homebridge homebridge[14205]: [11/26/2019, 7:59:47 PM] [Broadlink RM] Light Down getSwitchState: undefined

mitch7391 commented 4 years ago

Hope this helps!

kiwi-cam commented 4 years ago

Thanks @mitch7391. Sorry, I'm a little confused trying to line up the colour changes with your attempts:

It's like it missed the first White change, then the others went Red instead??

In the logs things look better. You set white: Nov 26 19:59:41 homebridge homebridge[14205]: [11/26/2019, 7:59:41 PM] [Broadlink RM] LightTest setSaturation: (Updating to : hue:0 saturation:0) It runs setSaturation and detects that it's close to white: Nov 26 19:59:41 homebridge homebridge[14205]: [11/26/2019, 7:59:41 PM] [Broadlink RM] LightTest setSaturation: (closest: white) Then sends your "white" hexcode: Nov 26 19:59:41 homebridge homebridge[14205]: [11/26/2019, 7:59:41 PM] [Broadlink RM] LightTest sendHex (192.168.0.154; 34:ea:34:99:f1:28) b20e34000d290d290d2a0d2a261026110d2926110d290d2a26110d2a261126110d2926100d290d2a0d290d2a261126110d2a0d290d00019600000000

Is your white hexcode definitely correct... not Red?

mitch7391 commented 4 years ago

Don’t worry @kiwi-cam I am very confused too because the results I get are inconsistent at times, sometimes it makes no change (like it missed the change altogether). But yes the whites I tried to set that time between each hue set it to red each time instead of white (like it latched the colour I first attempted but it missed); tonight when I get home from work, I will re-learn my red and white codes to rule this out as an issue. However, I have not had an issue with the colours when I have each colour as a simple switch.

mitch7391 commented 4 years ago

@kiwi-cam i have double checked my learned codes and tested again in the same order and got the similar results. It is really weird but sometimes it seems it has a hard time differentiating between red and white (and their codes are completely different). Sometimes white would execute when I wanted it to, other times it would turn red. Sometimes when setting saturation to low from blue or green, it would turn red for a second and then turn white, but it was not always consistent with repeated tests.