Set variable with list of devices that are on


#21

It’s because you have the presence statement set to ‘never subscribe’ and you have two statements (mode and SHM) separated by ‘OR’s above.

Your piston will never be triggered by ‘presence changes’ and when triggered by mode or SHM, because of the ‘OR’s only one statement needs to be true for the group of statements to be true. Piston runs from the top down until it finds a true, it then moves on.

webCoRE won’t bother evaluating the other statements, in order to save evaluation time, and therefore the presence, and in turn the variables, will never get set.

Hope that makes sense?


#22

Sorry on the previois piston you’d put in there “never subscribe” and want sure if that’s the way this style should have it set. Actually I’ve never changed that setting in my pistons and unsure why you’d choose to never subscribe either. Honestly there’s so much in webCoRE that I’m not using and there’s been some stuff I didn’t know was even there.


#23

Still not working.


#24

That’s because of the Or’s… if mode or SHM are the trigger, the presence trigger never needs to be evaluated and therefore the variables never get populated.

You also have some weird use of ‘average of presence sensors’ and you are referencing system variables without the ‘$’ symbol and incorrect capitalisation.

Try this:


#25

That works great but another question - how do you handle empty lists? Like is there a way to have it say something other than zero devices?


#26

(count(PersonsPresent)==0 ? ”everyone is away” : (count(PersonsPresent)==1 ? PersonsPresent “ is present” : PersonsPresent “ are present” ))

(Condition ? When True : When False)


#27

And put this in the set piston state command or in the command to set variable?


#28

Piston state and / or SMS message.

Leave the ‘save matching’ / ‘non-matching’ part alone.