1) Give a description of the problem
I’ve got a couple kids who are good at unlocking doors and not locking them, so I’m working on this piston to notify me which doors have been used during the day.
2) What is the expected behavior?
When a monitored door’s contact opens, I want to log the door name to a variable, which will be used later to send me a message so that I can check the locks. I only want to log each door’s name once! So if it opens 20 times, I only want it once in the variable.
3) What is happening/not happening?
The devices are being logged to the variable, but I’m getting 20 instances of “Front Door” (as an example).
4) Post a Green Snapshot of the piston
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)
I tried updating the set variable to this expression:
if(contains(Doors_Opened,[$currentEventDevice]),Doors_Opened,Doors_Opened+", "+[$currentEventDevice])
But it cusses me about data type mismatches. I’m feeding it devices, but it wants strings. Any ideas how I can check the Doors_Opened variable for the currentEventDevice and only append the variable if it does not already contain the currentEventDevice?