Variable loops in notification piston


#1

1) Give a description of the problem
The variable I used is looping. It seems like it is adding to the previously reported variables. The three speakers on the botton are for testing different TTS and media devices.

2) What is the expected behavior?
I only want it to report once I hit the momentary piston is pressed (for testing). I assume the variable has to be cleared but Stuffing a list: *ALL wasnt clear how I would add the clear.

3) What is happening/not happening?
The variable is repeating

**4) Post a Green Snapshot of the piston![image|45x37]

5) Attach any logs (From ST IDE and by turning logging level to Full)
ee157057-7e85-4f3d-b950-7c22508e8608 9:55:11 PM: info ╔ Event processed successfully (654ms)
ee157057-7e85-4f3d-b950-7c22508e8608 9:55:11 PM: trace ║╔ Execution stage complete. (481ms)
ee157057-7e85-4f3d-b950-7c22508e8608 9:55:11 PM: trace ║║ Executed virtual command setVariable (4ms)
ee157057-7e85-4f3d-b950-7c22508e8608 9:55:11 PM: trace ║║ Executed virtual command setVariable (4ms)
ee157057-7e85-4f3d-b950-7c22508e8608 9:55:11 PM: trace ║║ Executed virtual command setVariable (4ms)
ee157057-7e85-4f3d-b950-7c22508e8608 9:55:11 PM: trace ║║ Executed virtual command setVariable (4ms)
ee157057-7e85-4f3d-b950-7c22508e8608 9:55:11 PM: trace ║║ Executed virtual command setVariable (4ms)
ee157057-7e85-4f3d-b950-7c22508e8608 9:55:11 PM: trace ║║ Executed virtual command setVariable (4ms)
ee157057-7e85-4f3d-b950-7c22508e8608 9:55:10 PM: trace ║╚ Execution stage started
ee157057-7e85-4f3d-b950-7c22508e8608 9:55:10 PM: trace ║ Runtime (49456 bytes) successfully initialized in 74ms (v0.2.102.20180116) (169ms)
ee157057-7e85-4f3d-b950-7c22508e8608 9:55:10 PM: info ╚ Received event [Casa de Pines].test = 1517892910769 with a delay of 0ms


#2

add a new task - set variable then pick txt as the variable and leave the value field empty.


#3

I did that and it clears out the variable but the alert is still repeating 5 times in my tablet


Piston is not repeating or triggering
#4

thats because of the for loop. drag the if block contained in the for loop outside of the for loop and delete the for loop.


#5

I thought the for each was not a for loop


#6

for each is a type of for loop. if you expand that for each:

for each device in devices variable opensensors set $device to next device in list and
do
   tasks
end for each

#7

Don’t I need the for each on line 20 to pull all the devices I to the opensensors variable?


#8

if you expand this:

if opensensors contact is open
   x save matching devices to contactsopen

it executes as:

if any of the contact sensors in device list variable opensensors is open
   x save those matching open contact sensors to the device list variable contactsopen

the if takes care of what you are looking for without the need for a for loop.


#9

So many ways to skin this chicken! lol