FlyingDiver / Indigo-radiora2

Indigo plugin for Lutron control systems. Works with Radio Ra 2, Radio Ra Select, Homeworks QS, and Caséta
MIT License
6 stars 3 forks source link

Shouldn't turn on light & set brightness #27

Closed rapamatic closed 5 years ago

rapamatic commented 5 years ago

Per my discussions here https://forums.indigodomo.com/viewtopic.php?f=78&t=17432&p=170975 when a light is turned on the plugin should not be turning the device on and then separately setting the brightness of the device. Instead, it should just be setting the brightness.

The fix is just to remove the first update statement that sets the ONOFF state to true, leaving just the statement setting the brightness level.

At least in the plugin version running on my mac, this code starts on line 863, and the line to remove is line 867:

zone = self.dimmers[id]
                if int(level) == 0:
                    zone.updateStateOnServer(ONOFF, False)
                else:
                    zone.updateStateOnServer(ONOFF, True)
                    zone.updateStateOnServer("brightnessLevel", int(level))
                self.logger.debug(u"Received: Dimmer " + zone.name + " level set to " + str(level))

should instead be:

zone = self.dimmers[id]
                if int(level) == 0:
                    zone.updateStateOnServer(ONOFF, False)
                else:
                    zone.updateStateOnServer("brightnessLevel", int(level))
                self.logger.debug(u"Received: Dimmer " + zone.name + " level set to " + str(level))

I don't know if this is the same thing for other device types (fans perhaps, shades unlikely)

FlyingDiver commented 5 years ago

Will look at this when I get home again, which won’t be until Christmas.

joe

On Dec 8, 2018, at 6:16 AM, Ray Kramer notifications@github.com wrote:

Per my discussions here https://forums.indigodomo.com/viewtopic.php?f=78&t=17432&p=170975 when a light is turned on the plugin should not be turning the device on and then separately setting the brightness of the device. Instead, it should just be setting the brightness.

The fix is just to remove the first update statement that sets the ONOFF state to true, leaving just the statement setting the brightness level.

At least in the plugin version running on my mac, this code starts on line 863, and the line to remove is line 867:

zone = self.dimmers[id] if int(level) == 0: zone.updateStateOnServer(ONOFF, False) else: zone.updateStateOnServer(ONOFF, True) zone.updateStateOnServer("brightnessLevel", int(level)) self.logger.debug(u"Received: Dimmer " + zone.name + " level set to " + str(level))

should instead be:

zone = self.dimmers[id] if int(level) == 0: zone.updateStateOnServer(ONOFF, False) else: zone.updateStateOnServer("brightnessLevel", int(level)) self.logger.debug(u"Received: Dimmer " + zone.name + " level set to " + str(level)) I don't know if this is the same thing for other device types (fans perhaps, shades unlikely)

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.

rapamatic commented 5 years ago

Enjoy the diving! I made the change in my local copy of the plugin and it’s working fine.

FlyingDiver commented 5 years ago

You could fork the repo and do a pull request. :)

Sent from my iPhone

On Dec 8, 2018, at 12:28 PM, Ray Kramer notifications@github.com wrote:

Enjoy the diving! I made the change in my local copy of the plugin and it’s working fine.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.

rapamatic commented 5 years ago

I’ll give it a shot. I usually manage to screw up github somehow.

gt3mike commented 5 years ago

What incorrect lighting behavior does this fix? Just curious - I’ve never noticed a problem.

On Sat, Dec 8, 2018 at 8:13 AM Ray Kramer notifications@github.com wrote:

I’ll give it a shot. I usually manage to screw up github somehow.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/FlyingDiver/Indigo-radiora2/issues/27#issuecomment-445466258, or mute the thread https://github.com/notifications/unsubscribe-auth/AhpQiHtKKwG2pZdbLt8MPC4slQN9rj00ks5u29cEgaJpZM4ZJOuQ .

rapamatic commented 5 years ago

It’s a very bizarre edge case. The old code would first turn the light device on, and which point it would show its default brightness (100%). Almost immediately thereafter the code would update the device to the correct brightness. Normally this wouldn’t be an issue, since the device in indigo would only show the incorrect 100% brightness for a split second. However, I had triggers based on lights going to 100%, and they were being falsely triggered by that split second 100% brightness. This change prevents that from happening.

rapamatic commented 5 years ago

You could fork the repo and do a pull request. :)

Alright, just submitted the pull request

FlyingDiver commented 5 years ago

Releasing in 7.2.3