Grabbing two variables from two different groups?


#1

1) Give a description of the problem
I want to compare two lists, and grab the corresponding variables from each group - the presence sensor from one, and the location from the other.

2) What is the expected behavior?
grab the corresponding variables from each group - the presence sensor from one, and the location from the other.

3) What is happening/not happening?
I’m not sure how to code this

4) Post a Green Snapshot of the pistonimage

5) Attach any logs (From ST IDE and by turning logging level to Full)
(PASTE YOUR LOGS HERE BETWEEN THE MARKS THEN HIGHLIGHT ALL OF THE LOGS SND CLICK ON THE </> ICON TO FORMAT THEM)

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


#2

Ok, can someone explain something to me? What’s the point of a device variable?

I ask because I’m trying to get this piston to determine if one variable (4 Life360 presence sensors) are at another variable (4 locations), and tell me which presence sensor is where.

If I list the presence sensors in a device variable, I have to select a parameter, and the parameters under the device box don’t necessarily match up with my Life360 parameters.

If I list the presence sensors as devices within the piston itself, the parameters are specific to Life360.

Basically, I’m trying to make this code as efficient as possible, but I’m just not understanding the workflow needed to get the information I want.


#3

A device variable is just that a variable that holds device name I guess that you can query or act on.

An example would be:

device switchVar = Laundry Light

In an Expression, you can get the status of the switch attribute by [switchVar:switch] or [Laundry Light:switch]

If you had multiple devices inside switchVar, you can iterate over the list and use $device variable for the current selected device from the list. Using the same above example in an Expression.

Current status of switch for the currently selected device [$device:switch]

If the device name was stored as string variable, you would not be able to do above.

I hope that made sense, I’m not a developer so terminology maybe too basic.


#4

That does help.