Revised Lutron Radio Ra 2 / Caséta plugin - BETA Test

Posted on
Mon Aug 15, 2016 9:53 am
rapamatic offline
Posts: 276
Joined: Aug 03, 2015
Location: Glencoe, IL

Re: Revised Lutron Radio Ra 2 / Caséta plugin - BETA Test

I just installed several fan controllers and they don't seem to fully working with the latest plugin.

Lutron maps the following fan speeds/percentages:
Off - 0%
Low - 25%
Medium - 50%
Medium High - 75%
High - 100%

Indigo's built in fan levels are:
Off - 0%
Low - 25%
Med - 75%
High - 100%

Whenever the fan is turned on outside of Indigo, however, it shows the fan speed as High in the interface, regardless of the actual speed of the fan. Working the other way, setting Low, Med, or High in Indigo sets the appropriate level in Lutron.

I haven't had a chance to work through the code, but perhaps this is just a simple bug?

Posted on
Mon Aug 15, 2016 10:01 am
FlyingDiver offline
User avatar
Posts: 7189
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: Revised Lutron Radio Ra 2 / Caséta plugin - BETA Test

I didn't touch that code at all, as best I remember. I'll try to take a look and see if I can tell what's going on.

joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177

Posted on
Mon Aug 15, 2016 10:15 am
rapamatic offline
Posts: 276
Joined: Aug 03, 2015
Location: Glencoe, IL

Re: Revised Lutron Radio Ra 2 / Caséta plugin - BETA Test

Looks like the relevant section is around line 540:

Code: Select all
elif id in self.fans:
            fan = self.fans[id]
            if level == '0.00':
               fan.updateStateOnServer("onOffState", False)
            else:
               fan.updateStateOnServer("onOffState", True)
               if level == '25.10':
                  fan.updateStateOnServer("speedIndex", 1)
               elif level == '50.20':
                  fan.updateStateOnServer("speedIndex", 2)
               elif level == '75.30':
                  fan.updateStateOnServer("speedIndex", 2)
               else:
                  fan.updateStateOnServer("speedIndex", 3)
            indigo.server.log(u"Received: Fan " + fan.name + " speed set to " + str(level))
            return


I think the issue is the very precise level checks being made. From what I've seen, the Lutron API returns somewhat random decimal points for dimmer brightness, etc. Perhaps they are encoding some information in there... anyway, looking at the integration protocol, the following % correspond to the following levels:

Levels:
0 =Off
1–25%=Low
26–50%=Medium
56–75%=Medium High
76–100%=High


So perhaps best to change the logic in the code to more like the following:

Code: Select all
elif id in self.fans:
            fan = self.fans[id]
            if level == '0.00':
               fan.updateStateOnServer("onOffState", False)
            else:
               fan.updateStateOnServer("onOffState", True)
               if level <= 25:
                  fan.updateStateOnServer("speedIndex", 1)
               elif level <= 50.:
                  fan.updateStateOnServer("speedIndex", 2)
               elif level <= 75:
                  fan.updateStateOnServer("speedIndex", 2)
               else:
                  fan.updateStateOnServer("speedIndex", 3)
            indigo.server.log(u"Received: Fan " + fan.name + " speed set to " + str(level))
            return


I guess we also have to make a judgment on how to map 4 fan speeds to 3, unless there is a way to customize the fan object type in Indigo to add an additional speed... But I'd be inclined to do it this way, mapping as follows, and basically ignoring the Medium High speed....

Indigo --> Lutron
Low -> Low
Med -> Medium
High -> High

EDIT:

Should probably also change this, around line 968:

Code: Select all
if action.speedControlAction == indigo.kSpeedControlAction.SetSpeedIndex:
         if dev.deviceTypeId == RA_FAN:
            newSpeed = action.actionValue
            fan = dev.pluginProps[PROP_FAN]
            if newSpeed == 0:
               self._sendCommand("#OUTPUT," + fan + ",1,0")
            elif newSpeed == 1:
               self._sendCommand("#OUTPUT," + fan + ",1,25.10")
            elif newSpeed == 2:
               self._sendCommand("#OUTPUT," + fan + ",1,75.30")
            else:
               self._sendCommand("#OUTPUT," + fan + ",1,100")
         indigo.server.log(u"sent \"%s\" %s to %d" % (dev.name, "set fan speed", newSpeed))


Medium should be set to 50%, not 75%, to be consistent,,, And I would probably not do the weird decimals, so newSpeed 1 -> 25, NewSpeed 2 -> 50...

Posted on
Tue Aug 16, 2016 5:07 pm
RatRanch offline
Posts: 68
Joined: Sep 25, 2013

Re: Revised Lutron Radio Ra 2 / Caséta plugin - BETA Test

rapamatic wrote:
I just installed several fan controllers and they don't seem to fully working with the latest plugin.

Lutron maps the following fan speeds/percentages:
Off - 0%
Low - 25%
Medium - 50%
Medium High - 75%
High - 100%

Indigo's built in fan levels are:
Off - 0%
Low - 25%
Med - 75%
High - 100%

Whenever the fan is turned on outside of Indigo, however, it shows the fan speed as High in the interface, regardless of the actual speed of the fan. Working the other way, setting Low, Med, or High in Indigo sets the appropriate level in Lutron.

I haven't had a chance to work through the code, but perhaps this is just a simple bug?


Bug replicated. Mine doing the same thing. Used to work (the fan control switches would reliably return the same decimal values each time).

-Jim

Posted on
Tue Aug 16, 2016 9:00 pm
rapamatic offline
Posts: 276
Joined: Aug 03, 2015
Location: Glencoe, IL

Re: Revised Lutron Radio Ra 2 / Caséta plugin - BETA Test

I just submitted a pull request with the changes as I discussed above

Posted on
Tue Aug 16, 2016 10:25 pm
rapamatic offline
Posts: 276
Joined: Aug 03, 2015
Location: Glencoe, IL

Re: Revised Lutron Radio Ra 2 / Caséta plugin - BETA Test

Busy night for me - I just added the ability to have keypad button press triggers - so far its working for me. I added it to my pull request.

This has enabled me to create triggers for double taps on keypad buttons, which is pretty cool.

Posted on
Wed Aug 17, 2016 5:47 am
RatRanch offline
Posts: 68
Joined: Sep 25, 2013

Re: Revised Lutron Radio Ra 2 / Caséta plugin - BETA Test

RatRanch wrote:
rapamatic wrote:
I just installed several fan controllers and they don't seem to fully working with the latest plugin.

Lutron maps the following fan speeds/percentages:
Off - 0%
Low - 25%
Medium - 50%
Medium High - 75%
High - 100%

Indigo's built in fan levels are:
Off - 0%
Low - 25%
Med - 75%
High - 100%

Whenever the fan is turned on outside of Indigo, however, it shows the fan speed as High in the interface, regardless of the actual speed of the fan. Working the other way, setting Low, Med, or High in Indigo sets the appropriate level in Lutron.

I haven't had a chance to work through the code, but perhaps this is just a simple bug?


Bug replicated. Mine doing the same thing. Used to work (the fan control switches would reliably return the same decimal values each time).

-Jim


Checked the debug log. It looks like a recent RA2 firmware update changed the values that the fan controls return. I am now seeing High = 100, Medium-High = 75.69, Medium = 50.59, and Low = 25.49. Agree that the plugin code should be revised to check for ranges instead of looking for specific decimal values.

IMHO, when we map 4 Lutron fan speeds to 4 Indigo fan speeds, it would be better to leave the current mapping of Indigo "Medium" to Lutron "Medium-High". This is a more useful speed than Lutron "Medium", which drives a fan at a very similar speed to Lutron "Low".

-Jim

Posted on
Wed Aug 17, 2016 5:53 am
rapamatic offline
Posts: 276
Joined: Aug 03, 2015
Location: Glencoe, IL

Re: Revised Lutron Radio Ra 2 / Caséta plugin - BETA Test

RatRanch wrote:
IMHO, when we map 4 Lutron fan speeds to 4 Indigo fan speeds, it would be better to leave the current mapping of Indigo "Medium" to Lutron "Medium-High". This is a more useful speed than Lutron "Medium", which drives a fan at a very similar speed to Lutron "Low".

-Jim


Since I don't have a strong feeling I'll change it back to the way you had coded it. I'll update my pull request this morning. If you or anyone wants to try my code, you can grab it from my pull request, which is visible on the GitHub page where Joe keeps the code.


Sent from my iPhone using Tapatalk

Posted on
Wed Aug 17, 2016 6:47 am
FlyingDiver offline
User avatar
Posts: 7189
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: Revised Lutron Radio Ra 2 / Caséta plugin - BETA Test

Merged changes into master branch, with some updates mostly to debug logging statements. Published as actual release.

https://github.com/FlyingDiver/Indigo-r ... v2.3.0.zip

joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177

Posted on
Wed Aug 17, 2016 11:22 am
RatRanch offline
Posts: 68
Joined: Sep 25, 2013

Re: Revised Lutron Radio Ra 2 / Caséta plugin - BETA Test

FlyingDiver wrote:
Merged changes into master branch, with some updates mostly to debug logging statements. Published as actual release.

https://github.com/FlyingDiver/Indigo-r ... v2.3.0.zip


Thanks for your work on this guys! Fan controls working normally again.

I'm encountering two new problems after updating:

1. Response to status messages over a serial connection are now extremely slow (it takes a second or two for device changes to update the gui or log and several minutes to perform a query all devices). I don't notice any difference in latency using an IP connection.

2. Getting this error logged during startup: "Error: Moved Permanently". I think this has something to do with the plugin update location.

Thanks,
-Jim

Posted on
Wed Aug 17, 2016 1:43 pm
FlyingDiver offline
User avatar
Posts: 7189
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: Revised Lutron Radio Ra 2 / Caséta plugin - BETA Test

I don't know what's going on with the serial updates. I only use IP. Is there anything interesting in a debug log?

I fixed the repository name in this release: https://github.com/FlyingDiver/Indigo-r ... v2.3.1.zip

Update manually to v2.3.1 and that should take care of it from now on.

joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177

Posted on
Wed Aug 17, 2016 5:17 pm
RatRanch offline
Posts: 68
Joined: Sep 25, 2013

Re: Revised Lutron Radio Ra 2 / Caséta plugin - BETA Test

FlyingDiver wrote:
I don't know what's going on with the serial updates. I only use IP. Is there anything interesting in a debug log?

I fixed the repository name in this release: https://github.com/FlyingDiver/Indigo-r ... v2.3.1.zip

Update manually to v2.3.1 and that should take care of it from now on.


Okay, here's the problem with serial. On line 370, we have:

Code: Select all
self.sleep(.1)


During normalization of the IP and serial communication code, this IP-specific delay got moved into the general receive loop. I did some quick testing, and IP communication seems to still work fine with this line disabled.

Would you please move this up above line 353 if it is actually necessary for IP communication?

Thanks,
-Jim

Posted on
Wed Aug 17, 2016 6:28 pm
FlyingDiver offline
User avatar
Posts: 7189
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: Revised Lutron Radio Ra 2 / Caséta plugin - BETA Test

My bad. I refactored that code incorrectly. V2.3.2 has been posted, and updater should work from v2.3.1.

joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177

Posted on
Wed Aug 17, 2016 6:50 pm
rapamatic offline
Posts: 276
Joined: Aug 03, 2015
Location: Glencoe, IL

Re: Revised Lutron Radio Ra 2 / Caséta plugin - BETA Test

There's also a bug in all the trigger code where it only checks the first of any type of trigger. I will submit a pull request in a little bit.


Sent from my iPhone using Tapatalk

Who is online

Users browsing this forum: No registered users and 1 guest