Compare 2 devices attributes

Is there a way to compare 2 devices attributes together to trigger automation ?

My scenario is :

  1. multisensor in a room
  2. humidity sensor in another room

if humidity from device 2 is greater than humidity from device 1, do something

I was able to set variable with device attribute, but if that part of the code doesn’t get executed, this other automation won’t work

Any idea ?
thanks

Depends on how you have this setup. If you have rules setup to store the value from devices into variables, you could use a separate rule which triggers off of the variables changing and compares them.

So lets say your first rule is just taking the Humidity and storing it into a variable:

:bulb: Note that I used the Context Variable: Event → Device → Value here which makes this rule execute lightning fast as it just stores the triggering value directly rather than trying to look it up from SmartThings

Then in your second rule, you could use that variable changing as a trigger.

Note that when you’re setting up a comparison (and on some other input types), you can tap the </> button next to the input to use a variable as the comparison target.

Nice, thanks for the input, will try!