Rule Machine custom attribute bug

I have that one too - what attribute are you trying to use? Iā€™ll give it a try to see if I have the same issue.

Ah, you're fast... I just changed my response completely. I thought I was using custom attributes previously for that driver but I was using it for a different driver and turning things on for the Logitech driver.

I'm trying to use custom attribute "bulb1Level". However, I'm experiencing the issue with every custom attribute so you can try any other one also.

1 Like

When I experienced this, the developer joined the conversation and if I remember correctly, he was able to update the driver so that it would work.

Iā€™ll see if I can find the thread again... (might not be as fast doing that... :wink:)

Would you mind taking a screenshot of the rule, specifically the point where you are having an issue? I tried to reproduce, but I think Iā€™m missing something...

Actually, I think I figured out the issue. The developer used "Integer" to define the type of the attribute (for bulb1Level, bulb2Level, socket1Level and socket2Level). Looks like Hubitat doesn't recognize that and requires it to be "Number" or "Decimal". I just changed it to "Number" and it seems to be working fine now!

1 Like

Yup! As I recall, that is how the issue needed to be resolved. Youā€™re good!

Tagging @ogiewon in case he wants to update this in the driver, if he feel like it, for the other users.

2 Likes

Thanks for your help man! @ogiewon please would you mind changing the type of the attribute in your code. Thanks

1 Like

This keeps coming up. The valid types for attributes are Number, String, and Enum.

Not Boolean, Integer, Decimal...

1 Like

Right?

Hey, how about a new feature when saving code - search for ā€œBoolean, Integer and Decimalā€ and throw a warning. :wink: (not being serious...)

The Logitech Harmony Hub Parent driver has been updated in my GitHub repository. I guess I need to review community pull requests more carefully. Thank you for the feedback!

3 Likes

Not to be pedantic, but there are a few more valid types per the documentation:

https://docs.hubitat.com/index.php?title=Attribute_Object

dataType - String: The type of data that is stored in this attribute, possible values are (ENUM, STRING, DYNAMIC_ENUM, JSON_OBJECT, NUMBER, DATE, VECTOR3).

But definitely no boolean, integer, or decimal listed. :slight_smile:

2 Likes

Don't let that stop you.... :laughing:

6 Likes

Can't really argue that, now can I? :laughing:

At least I'm self aware of my annoying tendencies. lol That has to count for something, right?

(also, sometimes I think I point out things like that as a passive aggressive way of verifying the documentation is correct)

2 Likes

OK, I was avoiding being pedantic before. But, to honor your sentiment:

Rule-4.1 also recognizes STRING_ENUM, JSON_OBJECT and VECTOR3. These are treated as ENUM, STRING and VECTOR3 respectively. It does not presently recognize DYNAMIC_ENUM or DATE.

I should spend a few minutes to make Rule more gracefully deal with non-supported attribute types, although my passive aggressive side likes throwing an error at those who tempt the fates with unsupported attribute types. It's a good mechanism for getting driver devs to be notified they have an issue.

2 Likes

For the sake of users, would be great if there was a way to identify the issue quickly (like an error message when selecting the attribute) as opposed to having to investigate it.

You didn't provide enough information above for me to know what actually went wrong.

1 Like

I'm responding to your comment above. It'd be nice if an error was thrown in rule machine that made it clear that the custom attribute had the wrong type set. Otherwise, anyone would think it's an issue with rule machine itself.

But I don't see this error, and I don't know what you actually encountered, so I don't know what to fix.

OK, this is fixed for the next release. And, for an added bonus, since it was almost trivial, INTEGER will also be a supported attribute type in Rule-4.1, even though strictly speaking it is not a supported attribute type. BOOLEAN is not supported.

Rule-4.1 will tell you if the attribute type of a custom attribute is not supported. In that case, another approach should be taken, including possibly contacting the driver author to fix their code.

5 Likes

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.