If ANY 2 of THESE 8 Presence Devices are Present, do something


#1
  1. Give a description of the problem
    Not really a problem. I just need assistance.

  2. What is the expected behavior?
    I want the action to be based on…
    2 or more of a specific set of presence devices being present (i.e. not just any 2 presence devices from my whole home’s compliment, but just from a specific subset)

So, the thing I need assistance with is this…

IF ANY 2 of THESE 8 PRESENCE SENSORS ARE PRESENT, do something.

  1. What is happening/not happening?
    I have no idea to specify the subset of presence devices, or how to act on any 2 of them being present.

  2. Post a Green Snapshot of the piston![image|45x37]
    -NA-

  3. Attach any logs (From ST IDE and by turning logging level to Full)
    -NA-

REMOVE BELOW AFTER READING


#2

Can you give an idea of what your presence devices currently are?

More than likely you will just need to group the presence sensors together in your condition that you are wanting combined.


#3

I realize this might not be the best way but this is what i am working on for this


#4

There are at least three different kinds of presence sensors:
One of them is an Android phone.
Some of them are DD-WRT WiFi-based.
One of them is Tasker-based.

Can you explain “group” in this context?

I really like this.
In my present use case though, I’m not working on getting a presence status for the whole family. Instead, I’m working on getting presence status for a single person.

The idea I’m working on is… if any 2 of my multi-method presence sensors reports that I’m present, then it will turn ON the primary presence switch that represents my presence status (which something like this system you’re working on could then act on; along with others in the family).

So, the thing I need assistance with is this…

IF ANY 2 of THESE 8 PRESENCE SENSORS ARE PRESENT, do something.


#5

Put all 8 of your Presence devices in a device variable at the top of the piston… Iets call it ‘presenceDevices’

Create another device variable but leave it empty… let’s call it ‘presentDevices’

IF
any of presenceDevices are present
save matching devices to variable ‘presentDevices’
THEN
IF
count(presentDevices) IS greater than or equal to 2
THEN
do stuff


#6

I’m guessing he has 2 for each member of the family.


#7

I’m not so sure… the brief was quite straightforward.


#8

LOL, that’s a lot for one person :slight_smile:


#9

indeed… guess that’s one way of reducing presence delays.


#10

AWESOME!
Thanks a lot. I will give this a try later today, and let you know how it goes.

Indeed. lol
I may rethink it at some point, but presence was so horrible for so long, and I tried so many things, that I eventually gave up on it, and haven’t had anything in my entire system based on presence for years.

Now that I’m working in webCoRE, my energy for such things has been renewed. :slight_smile: So, I’m giving it another try.


#11

Have you got a webcore presence sensor?.. bring you up to 9… or even the magic 10 if you have two phones lol


#12

That was just the base for a working piston btw… you’ll need to account for the other presence sensors re-triggering the piston as they arrive one-by-one.

Post where you get to if you need help with that.


#13

How do I specify this?

IF
any of presenceDevices are present

#14

Same way you would a single device… the device variables appear at the bottom of the drop down list.

After creating the device variable though, you normally have to save and exit the piston and then go back in for it to show up on the list.

An in case you’re not sure, to save matching devices to the second variable, click the cog symbol when building the ‘IF’ statement.


#15

What to compare
Variable @MyGlobalPresence

What kind of comparison?
?


#16

Why are you using global variables? Keep it simple and define a local variables unless there is a specific need to do otherwise.

Import this:


#17

This is what threw me off in the beginning. It sounded like he had multiple people in the mix.


#18

download


#19

Aha, OK. I guess I just figured that, if there’s any chance I may want to use the same variable elsewhere at some point, I might as well make it Global.

Is that faulty thinking for the webCoRE universe?


#20

It’s hard to explain but the problem with global device variables is that the devices referenced are not saved in the piston storage app along with the rest of the piston, so every time a piston using that variable needs to use one of those devices, it has to go looking, which increases the execution time.

For something as simple as this it’s normally easier to just duplicate things across pistons if required.

Generally speaking, global variables are intended to help one piston talk / send info to another… not neccesseraily to reduce repetition.