Remove Devices from a List Device


#1

I would need a piston that has this function

  1. Location Mode changes to … with SecurityCheckGlobal turn off…

  2. If from now a switch change to on remove the device from SecurityCheckGlobal

  3. Wait 5 Min

  4. Check the devices in securityCheckGlobal and …

Point 1, 3 and 4 i have solved. But I need help with point 2.

the problem right now is that after the routine good night has been executed, a light is turned on and it goes through the for each check directly off again.


Controlling multiple SONOS stations via IFTTT and ActionTiles
#2

Define
integer loopCount

IF mode changes to x
THEN

repeat
with @securityCheckGlobal
refresh
wait 3 seconds
turn off
set variable loopCounter = loopCounter+1
wait 10 seconds

Until

All of @securityCheckGlobal’s switch are off
AND
all of @securityCheckGlobal power are 0W
When true
set variable loopCounter = 0

OR

loopCounter = 10
when true
send SMS - failed after 10 loops
set variable loopCounter = 0


#3

Many Thanks. but point 2 is not covered with your logic or?
background:
when my wife performs the routine “good night” and I would like to turn on a light after that
it would not work with the current logic, because all the lights would be turned off again and again.
That’s why I thought to myself
when a light after the routine “good night” switch to ON, remove the device from the device list securitycheckglobal and then go on with the new selected list to check, is everything off.


#4

@Robin

can you help pls? :slight_smile:


#5

I’m not sure how to programically remove a device from a list of devices in a variable, you could find it with arrayItem($index, @globalSecurityCheck) but removing it???

Instead of removing, maybe check if it changed recently within a for each loop:

for each $device in @securityCheckGlobal
IF age([$device:switch]) is greater than 60000
THEN
with $device
turn off