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

String to Float error in logs #5

Closed mlamoure closed 7 years ago

mlamoure commented 7 years ago

I occasionally find this in my logs. It does not seem to be blocking any functionality.

Lutron RRA2/Caséta Error Error in plugin execution runConcurrentThread:

Traceback (most recent call last): File "plugin.py", line 366, in runConcurrentThread File "plugin.py", line 530, in _processCommand File "plugin.py", line 568, in _cmdOutputChange ValueError: could not convert string to float: GNET> 0.00

Lutron RRA2/Caséta Error plugin runConcurrentThread function returned or failed (will attempt again in 10 seconds)

mlamoure commented 7 years ago

FlyingDiver,

I've self-fixed this error which seems to be stable for me for the past 10+ days. I'm not exactly sure why a non numeric value would be sent through the _cmdOutputChange function, but based on the error in the indigo log, that's what I assumed was happening and so I adjusted to meet this condition. Let me know what you think.

I added to the _cmdOutputChange function after the level variable is assigned a check for the value:

            if not self.is_number(level):
                return

and my definition of is_number:

    def is_number(self, s):
        try:
            float(s)
            return True
        except ValueError:
            return False  
FlyingDiver commented 7 years ago

I implemented a slightly different fix in 7.0.3, which is marked pre-release. Can you test?

mlamoure commented 7 years ago

Yes, installed it and will let you know. Thanks!

mlamoure commented 7 years ago

Very stable so far. Thanks again for the plugin.

FlyingDiver commented 7 years ago

Releasing 7.0.3.