Compare two custom attributes

I have to imagine that this is possible and apologies if this has been answered a million times, but how would I go about comparing the values of 2 different custom attributes in rule machine? When I create my IF/THEN statement, I only see that I can compare an attribute to a value that I enter.

In my example I want to compare the inside temperature to the outside temperature.

If you are using Rule Machine 5.X, you just need to enable the “Relative to a device?” switch:

3 Likes

Thanks for the reply. Your suggestion makes sense and would work I believe, but when I look at my conditional, I don’t see that toggle.

1 Like

Are you using Rule Machine 5.X or one of the Legacy versions (4.X)?

If you are using one of the legacy versions, you might want to install the new one.

I have the latest Hubitat and downloaded the main app, not the legacy app. I am having a hard time finding where to see which version it is. I’m almost certain I have the new v5. Am I in the right spot to where I would see this feature in the actions area?

Just look in the main App screen. The version is under the “Type” column:

Ah that doesn’t show up on mobile view. Confirmed that I am using v5.0.

I just tried it again, this time targeting a temperature device and not the temperature from a custom attribute. That now shows what you mentioned. So I guess I can compare two custom attributes this way. :man_shrugging:

1 Like

Interesting! Maybe this is not possible because the variable types may differ…

An option in that case would be to create one or two variables and store one or both of the values in those variables, and then compare one of the device to the variable or both variables.

For now this seems to meet my goal. Thanks for helping me troubleshoot. :+1:

1 Like

Another option. You can set the values of custom attributes into a variable. Then compare the variables. The method above would be easier, but you could also look at string attributes with this method.