How to set variable to whichever device meets a condition?


#1

1) Give a description of the problem
I want to set a variable to whichever of multiple presence sensors’ value changes from ‘present’ to ‘not present’.

2) What is the expected behavior?
(PUT YOUR INFO HERE)

3) What is happening/not happening?
I don’t even have this written yet… need guidance on how this would be accomplished.

4) Post a Green Snapshot of the pistonimage
(UPLOAD YOUR IMAGE HERE)

5) Attach any logs (From ST IDE and by turning logging level to Full)
(PASTE YOUR LOGS HERE BETWEEN THE MARKS)

REMOVE BELOW AFTER READING
If a solution is found for your question then please mark the post as the solution.


#2

It depends on the way you set this up but if you use

if presence sensor 1 or presence sensor 2 changes to present/not present

$currentEventDevice is the way to go

if presence sensor 1 or presence sensor 2 is present/not present

You can also use $currentEventDevice but if you wanted to capture all of them that meet the condition then it is a little more involved.

Define a device type variable. Name it whatever you want. Then click the cog and you can save the matching list to your variable you created.


#3

Thanks! This is my first shot at webCoRE and you’ve helped me get off the ground!