senorshaun / homebridge-radiora2

Lutron RadioRA2 plugin for homebridge
MIT License
10 stars 5 forks source link

Light bulb dimming flashes to 100% #32

Closed rainesb closed 1 year ago

rainesb commented 1 year ago

Amazing Plug-in! One minor bug - Dragging the Dimmer Slider in the Apple HomeKit app on my phone or iPad, somehow causes the plug-in to go to 100% (full on) in between the intended values. for instance one drag on the slider Generated this in the logs in HomeBridge:

[3/19/2023, 11:56:10 AM] [RadioRA2] #OUTPUT,12,1,100

[3/19/2023, 11:56:10 AM] [RadioRA2] ~DEVICE,1,114,9,0 [3/19/2023, 11:56:10 AM] [RadioRA2] ~DEVICE,1,117,9,0 [3/19/2023, 11:56:10 AM] [RadioRA2] ~OUTPUT,12,1,100.00 [3/19/2023, 11:56:10 AM] [RadioRA2] [Master Bedroom] Brightness set to 100.00% [3/19/2023, 11:56:10 AM] [RadioRA2] ~OUTPUT,12,29,6 [3/19/2023, 11:56:10 AM] [RadioRA2] ~OUTPUT,12,30,1,100.00 [3/19/2023, 11:56:10 AM] [RadioRA2] ~DEVICE,1,101,9,1 [3/19/2023, 11:56:11 AM] [RadioRA2] ~OUTPUT,12,1,34.00 [3/19/2023, 11:56:11 AM] [RadioRA2] [Master Bedroom] Brightness set to 34.00% [3/19/2023, 11:56:11 AM] [RadioRA2] ~OUTPUT,12,29,6 [3/19/2023, 11:56:11 AM] [RadioRA2] ~OUTPUT,12,30,1,34.00 [3/19/2023, 11:56:11 AM] [RadioRA2] ~DEVICE,1,101,9,0 [3/19/2023, 11:56:11 AM] [RadioRA2] ~OUTPUT,12,1,100.00 [3/19/2023, 11:56:11 AM] [RadioRA2] [Master Bedroom] Brightness set to 100.00% [3/19/2023, 11:56:11 AM] [RadioRA2] ~OUTPUT,12,29,6 [3/19/2023, 11:56:12 AM] [RadioRA2] ~OUTPUT,12,30,1,100.00 [3/19/2023, 11:56:12 AM] [RadioRA2] ~DEVICE,1,101,9,1 [3/19/2023, 11:56:12 AM] [RadioRA2] ~DEVICE,1,101,9,0 [3/19/2023, 11:56:12 AM] [RadioRA2] ~OUTPUT,12,1,36.00 [3/19/2023, 11:56:12 AM] [RadioRA2] [Master Bedroom] Brightness set to 36.00% [3/19/2023, 11:56:12 AM] [RadioRA2] ~OUTPUT,12,29,6

What's extra annoying is that that was 'one' movement of my finger near about 35%, Apple HomeKit app seems to set 34%, and then a moment later 36%, but the lights flash to 100% before the 34% and then the 36%.

This 100% flash even happens when I use an Apple HomeKit Scene to set the dimmer to 25% - but only happens once. (Trying to set up my lights come on at like 25% before my alarm clock,but that 'flash' isn't the gentle wake-up I'd want. I see a couple static '100's near the end of "lightbulb.js" lines 89 and 91 that look promising, but I don't know JavaScript enough to know for sure? If I was smarter I might try changing those to 33 and 66 in my own copy and see if the 100 flash becomes either a 33 or 66 flash and then putz from there?

rainesb commented 1 year ago

Fussing at it - figured out how to edit the .js files on my synology server so I can play around. None of what I was doing had any effect on the issue (of course). But I realized it's not a '100%' bounce, but rather the Apple HomeKit app must be sending 2 commands when input is registered. one is 'Turn on' and then the next is 'set dim to ___' so whatever the 'on' vale for the light is set to in the plug in is where the light 'bounces to'?

I tested this out by setting one of my lights default 'on value' to 71 and then that's what the logs show it 'bouncing to'...

Screenshot 2023-03-19 at 2 49 00 PM Screenshot 2023-03-19 at 2 45 59 PM

hopefully there's a simple/easy way to solve for this, in the mean time I can at least set the default 'on' value to be like 33% and the bounce won't be as terrible?

senorshaun commented 1 year ago

This is fixed in 1.7.3. On Value should only be used when you tap the icon to turn on. When swiping to set a level from off, homekit sends both an on and a brightness command. I'm now filtering out the on command if I a brightness command is also sent