Clear a device variable or set initial


#1

Is it possible to clear a device variable?
Or to set the device variable to initial on every piston start


#2

Just set variable to ā€œā€ at the start of the piston run… allongside your wait 2 minutes.

Your piston will never allow more than one device to be listed in your ā€˜problemList’ though, as each run of the ā€˜for each’ statement that finds a problem, will overwrite the last.

You’d be better off using the ā€˜save matching devices to variable’ function, which can be found within the IF statement by clicking on the cog symbol.


#3

something like this:


#4

thanks :slight_smile:
do i need the ā€œJust set variable to ā€œā€ at the start of the piston runā€ for the updated piston?


#5

I don’t think so… if there are no matching devices to save to the variable, I think it clears the variable automatically.


#6

ok perfect.
is it possible to check the entries in the device list - problem list?
at the moment, i got the push notification with "empty list macht Probleme!"
so i going to create an if statement.
ā€œif problem_list is emptyā€ - do nothing


#7

You should already have that check on lines 52 and 55… if either of those statements are true then the list should be populated and the message sent.

If both are false, lists will be empty and the THEN will not fire, so no message.

If one statement is true and the other false, then one lost will be empty the other populated, and message will be sent (assume that is what you are seeing?)


#8

i have some problems with the fibaro switches. so i need a double security check.
if i turn on the switch and then turn it off, again. then often it works.
so i have updated the code and also the point with the two lists an the output.

is it correct so?


#9

What exactly is the problem with the Fibaro switches?

They are usually very very reliable… I have zero issues with mine…

What handler are you using?


#10

Fibaro Wall Plug ZW5
(name: ā€œFibaro Wall Plug ZW5 STā€, namespace: ā€œClassicGODā€, author: ā€œArtur Dragaā€)

Fibaro Wall Plug
name: ā€œFibaro Wall Plug STā€, namespace: ā€œcscheieneā€, author: ā€œSmartThings,gpsmith,cscheieneā€)

Fibaro FGS-222 Double Relay Switch
(name: ā€œFibaro FGS-222 Double Relay Switchā€, namespace: ā€œsmartthingsā€, author: ā€œRobinā€) {

Fibaro Double Switch 2 FGS-223
(name: ā€œFibaro Double Switch 2 FGS-223ā€, namespace: ā€œerocm123ā€, author: ā€œEric Maycockā€) {


#11

my the way, because i“m going to learn the webcore better.
is the piston correct?


#12

Looks ok… but you’ll still need to test it.

There really is no right or wrong way with webCoRE… If it works it’s good.

So are you having issues with all of those Fibaro devices?

What exact issues are you having?


#13

Every 3 -4 days, a device didn“t siwtch off after the routine "good night"
i dont know why.
that is why i created the ā€œsecurity check pistonā€

do you have a idea to resolve the problem otherwise?

are my device handler ok?


#14

Is it one of those devices in particular or have all of them had problems at some point?

It’s no uncommon for ST to miss commands if you are trying to turn off a lot of things at the same time (maybe 20+)

Try this:


#15

Nice, I’m gonna use this one. Only thing that seems to be missing, is a counter reset.

I set up my lights and switches into global variables a while ago while testing another piston, and never got back to using the variables. This works nicely with that.

Thanks!


#16

oops… lol


split this topic #17

A post was split to a new topic: How to stop additional ā€˜IF’ blocks running with the rest of the piston?