Possible Bug when using Required Expression with Custom Attribute

I think I found a small bug in Rule Machine when using custom attribute in both the required expression and the trigger field. I had set up a rule to control my deck awning and open it when conditions were acceptable. In order to only run the rule when needed I had set up a set of required conditions that included one custom attribute from my Tempest Wether Station (precipitation). The trigger I set for the rule was when the wind speed (also a custom attribute for the same device) is less than 5 MPH for 15 minutes. See the below screen shot for the rule.

I turned on all logging, but there were no log entries for this rule after initialization. I spent some time trying different things and stumbled across the fact the rule worked when I deleted the precipitation condition from the required expression. That was the only change I made. All logging started working and the rule functioned as expected.

As a final experiment I then went and changed the required expresssoin one more time and added a new condition using the custom attribute of the device, but this time with a number value rather than a text field. When I did I saw the logging was using the custom attribute field from required expression (feels like temp) as the metric for the trigger (wind speed). See attached for the rule and the log entry that resulted for the rule.

FYI - there are other rules that monitor for other conditions such as lightning, wind, and precipitation that compliment this one, so all conditions that control the awning aren't in the rule (in case the list of parameters the rule is monitoring seem a little limited).

I understood that a custom rule variable can’t be used in required expressions, so I’m surprised it worked during the final experiment…

Devices don't have variables, at least not anything usable by apps like rules. Are you using "Custom Attribute"? Not trying to be picky about nomenclature but just figure out the problem, since local (rule) variables will not work for required expressions. I can't think of any reason a custom attribute wouldn't.

2 Likes

Sorry - yes I meant custom attribute. That isnt picky at all. Sorry for the confusion. I went back and editor the original post to clarify this. Thanks for the catch.

A number of versions ago I reported a bug when using a custom attribute as a trigger, with the ‘and stays that way’. I found that although the logs for my rule reported ‘failed to stay’, the actions continued regardless. It was acknowledged as a bug and that it would be fixed in the next version. I never saw a corresponding mention of the fix in the release notes of later versions (and was a little scared to query it……..)