Conditions use alphanumeric comparison?

Posted on
Tue Jul 03, 2018 11:05 am
Argelix offline
Posts: 10
Joined: Dec 08, 2016

Conditions use alphanumeric comparison?

Hi,

I tried to use SuperConditions, reading the azimuth device state from Cynical Weather. Thought I was going crazy when I couldn't get it to work, until I turned on debugging:

EPS - Super Conditions Debug Checking if device state 'azimuth' value of '79.03' is greater than '110.00'
EPS - Super Conditions Debug Condition 3 returned [1, 0]

Obviously this is a very unexpected result, once I changed my comparison value to 99.0 it did work. I assume this is because the comparison is comparing these as strings; is there a way I can make the comparison as numbers? Or is there something else I am missing?

I did read the "known issue" about this in Changes.MD, but I did put "110.00" as a comparison value (also tried "110.0"), so for some reason this doesn't work for me. If I read conditions.py correctly (I know very little python) it looks like it does just a (lowercase) string comparison, which would not work if the number of digits is different...

Posted on
Tue Jul 03, 2018 11:58 am
Colorado4Wheeler offline
User avatar
Posts: 2794
Joined: Jul 20, 2009
Location: Colorado

Re: Conditions use alphanumeric comparison?

Hmm, interesting. Can you do a screenshot so I can try to exactly replicate what you are doing? I'm sure I can find what the issue is and fix it.

My Modest Contributions to Indigo:

HomeKit Bridge | Device Extensions | Security Manager | LCD Creator | Room-O-Matic | Smart Dimmer | Scene Toggle | Powermiser | Homebridge Buddy

Check Them Out Here

Posted on
Tue Jul 03, 2018 12:38 pm
Argelix offline
Posts: 10
Joined: Dec 08, 2016

Re: Conditions use alphanumeric comparison?

Not that easy, sun has moved on, other conditions fail by now :-) I do have another failed condition now; it gets to the right conclusion, but one condition is wrong, the log gives this result:

Checking if device state 'height' value of '8.81' is greater than '15.0'
EPS - Super Conditions Debug Condition 3 returned [1, 0]

It supports my theory that its just a string comparison, starting at the first char, "8" is greater that "1"...
Attachments
Screen Shot 2018-07-03 at 20.33.03.png
Screen Shot 2018-07-03 at 20.33.03.png (80.24 KiB) Viewed 1394 times

Posted on
Tue Jul 03, 2018 1:24 pm
Colorado4Wheeler offline
User avatar
Posts: 2794
Joined: Jul 20, 2009
Location: Colorado

Re: Conditions use alphanumeric comparison?

Ok, I just posted an update on the Plugin Store that should resolve this issue. I tested against your identical scenario and it now works fine (and my testing results started out the same as yours). I modified all operators to use the new formula but haven't tested every iteration of it. This is one of the plugins on my very long list of plugins to overhaul into my new plugin systems.

Try it and let me know!

My Modest Contributions to Indigo:

HomeKit Bridge | Device Extensions | Security Manager | LCD Creator | Room-O-Matic | Smart Dimmer | Scene Toggle | Powermiser | Homebridge Buddy

Check Them Out Here

Posted on
Tue Jul 03, 2018 1:35 pm
Argelix offline
Posts: 10
Joined: Dec 08, 2016

Re: Conditions use alphanumeric comparison?

Whoa, that was fast! Ofc, sun has moved on even more, so the last failure didn't fail anymore... Got a new one though:

EPS - Super Conditions Debug Checking if device state 'azimuth' value of '113.37' is greater than '99.00'
EPS - Super Conditions Debug Condition 3 returned [1, 0]

That would have failed earlier, I believe...

Thanks for the quick fix!

Posted on
Tue Jul 03, 2018 1:41 pm
Colorado4Wheeler offline
User avatar
Posts: 2794
Joined: Jul 20, 2009
Location: Colorado

Re: Conditions use alphanumeric comparison?

That's on the new version? While my test is using a variable value the computation is identical.

Code: Select all
   EPS - Super Conditions Debug    Checking conditions on 'Non Indigo Device Object'
   EPS - Super Conditions Debug       Condition is set to alltrue, testing condition(s)
   EPS - Super Conditions Debug       Checking if variable 'testFloatVar' value of '113.37' is greater than '99'
   EPS - Super Conditions Debug       Condition 1 returned [1, 0]
   EPS - Super Conditions Debug       Conditions returning true: 1, returning false: 0


Screen Shot 2018-07-03 at 1.39.57 PM.png
Screen Shot 2018-07-03 at 1.39.57 PM.png (84.14 KiB) Viewed 1370 times

My Modest Contributions to Indigo:

HomeKit Bridge | Device Extensions | Security Manager | LCD Creator | Room-O-Matic | Smart Dimmer | Scene Toggle | Powermiser | Homebridge Buddy

Check Them Out Here

Posted on
Tue Jul 03, 2018 1:47 pm
Argelix offline
Posts: 10
Joined: Dec 08, 2016

Re: Conditions use alphanumeric comparison?

Oops sorry, that gave the wrong impression; it would have failed on the earlier version, the new version does it correctly.

Posted on
Tue Jul 03, 2018 1:48 pm
Colorado4Wheeler offline
User avatar
Posts: 2794
Joined: Jul 20, 2009
Location: Colorado

Re: Conditions use alphanumeric comparison?

Whew, I was wondering how that could have been possible! Glad it's working. Hopefully a big update will be in the next couple of months as I slowly get all my plugins revamped.

My Modest Contributions to Indigo:

HomeKit Bridge | Device Extensions | Security Manager | LCD Creator | Room-O-Matic | Smart Dimmer | Scene Toggle | Powermiser | Homebridge Buddy

Check Them Out Here

Posted on
Fri May 03, 2019 4:54 pm
joshh385 offline
Posts: 24
Joined: Jan 04, 2019

Re: Conditions use alphanumeric comparison?

Sorry to resurrect an old thread but I am running into something similar here with the latest version from the plugin store.
I have some Sensibo AC controllers and setup some basic conditions to change the mode across fan/heat/cool based on some temperature ranges.
I'm attaching a screenshot of the log showing this - but I have a condition setup to switch the unit to fan only mode if the temp is between 20.5 and 21.6 C. Similarly, it will switch to cool if the temp is above 21.9 and heat if it is less than 20. The temp value changed to 21.4 and the conditions were evaluated, and they all returned false.
Attachments
SensiboCondition.png
SensiboCondition.png (385.51 KiB) Viewed 913 times

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 1 guest