Attribute Comparison Missing Greater Than/Less Than

I'm new to Rule Machine and have searched for a similar question but not found it yet. I'm using the OpenWeatherMap device and want to create a condition where a light comes on earlier in the evening if the "cloudiness" attribute is 85-100%. The problem is when I choose the "cloudiness" attribute I don't get a comparison option in the drop down for > or <, etc. I just have =, !=, changed, contains, and empty. How would I go about setting this trigger if the attribute is >= to 85? Thanks!

What driver are you using? My hunch is that the driver is creating the attribute as a String type instead of a numeric type, so RM won't give you the numeric operators. The only driver I can find (this one) doesn't look like it would be doing that from a cursory glance at the code, but I didn't really dive in, so I might be missing something but am also not inclined to try if that's not the one. :slight_smile:

Thanks for the quick reply! I believe it is a built in driver. To set it up in "Devices" I just added a new virtual device and selected "OpenWeatherMap" from the list. I have not yet installed any custom drivers.

Decided to try the driver you mentioned and that did indeed allow me to use the operators I was looking for. Thank you!

1 Like

I came across this post because I'm also trying to do the same thing... use cloudiness in a rule machine condition via >= comparison. The built in driver seems to be using the wrong type. Hopefully we can get a bug filed, should be a simple fix.

I was about to type exactly the same post as @scelfo. Trying to use cloudiness as well. +1 for a fix here!

Is the code for the built in weather driver available for us to modify anywhere?

Thanks

After posting earlier today, I figured out two workarounds.

  1. Same as was suggested earlier... install the OpenWeatherMap-Alerts user app which correctly uses a Number for the "cloud" property (same value as the "cloudiness" property on the OpenWeatherMap system app).

  2. Create a new Number type Global Variable (i.e. "cloud-cover") and then a Rule that triggers on Custom Attribute changed for cloudiness attribute of OpenWeatherMap. The action for the rule is to set the Variable value to the cloudiness attribute of OpenWeatherMap. The variable assignment works fine, presumably Hubitat is converting the String type to a Number type under the hood.

I'm going to stick with option #2 (global variable copied from the system OpenWeatherMap cloudiness) to keep things simple (no extra user app). The global variable is also nice because I'm reading it from a few different rules and there's less to duplicate across rules.

I'm not sure who wrote this particular driver, but I know @bravenel has done a lot of the LAN ones, so I'll tag him here to see if he has any ideas. (To summarize the above: the built-in OpenWeatherMap driver appears to be reporting the cloudiness attribute as a string instead of a numeric type, which I'm assuming is unintentional, though I don't know the full gamut of reporting possibilities for this value...)