Page 1 of 1
blocky presence for many people
Posted: Thursday 02 February 2017 6:22
by markjgabb
hi guys
im trying to do a someone is home blocky which i know is pretty common and has been done alot, but i havent seen on for more than 2 people
so we have 4 people in our house
with a switch for each person
p1
p2
p3
p4
so ive created another dummy called occupied
so i would like a if p1 or p2 or p3 or p4 is home set occupied to on, but i cant seem to get the or's right, it seems to me that you can do that many ors in one sentance or it would be a matter of nested ors and im not sure if that would work
Re: blocky presence for many people
Posted: Thursday 02 February 2017 6:47
by jannl
Not sure if this is common. Most people do presence detection with a python or perl script as found in the wiki.
Re: blocky presence for many people
Posted: Thursday 02 February 2017 7:24
by markjgabb
Yeah I've got the presence detection part working. It's just the last bit.
The if anyone of these switches are on turn this switch on.
I figured that might be easier in blocky
Sent from my SM-G900F using Tapatalk
Re: blocky presence for many people
Posted: Thursday 02 February 2017 8:07
by pvm
Can you show your current blockly? It shouldn't be a problem. Users (like me) who use geofencing with a virtual switch for every user need this functionality.
You can add an 'or' block to the if and in one of the two 'or' sides put another 'or'. And in the 'else' part use the same construction with 'and' blocks to turn the switch off
Re: blocky presence for many people
Posted: Thursday 02 February 2017 8:18
by Siewert308SW
indeed pvm
Something like this should work.
if P1 == on and occupied == off then
occupied = on
end
---
if P2 == on and occupied == off then
occupied = on
end
---
if P3 == on and occupied == off then
occupied = on
end
---
if P4 == on and occupied == off then
occupied = on
end
---
if P5 == on and occupied == off then
occupied = on
end
---
if p1 = off and p2 == off and p3 == off and p4 == off and p5 == off and occupied == on then
occupied = off
end
Re: blocky presence for many people
Posted: Thursday 02 February 2017 8:35
by mayyam
Maybe this one can help You. It's working for me.
viewtopic.php?f=23&t=31&start=100#p27521
I'm checking 4 phones that way (well, 2 phones, but 4 MACs because of AP).
I've 3 blocky:
1 - to check if two MACs of first person are present - presence of first person = on or off
2 - to check if two MACs of second person are present - presence of second person = on or off
3 - to check if two persons are present = presence of two people = on or off
Re: blocky presence for many people
Posted: Thursday 02 February 2017 13:38
by markjgabb
sorry for slow reply
this is the current blocky I use below
the occupancy switch just never changes to on

- occupancy blocky.PNG (13.14 KiB) Viewed 2091 times
blocky presence for many people
Posted: Thursday 02 February 2017 19:19
by pvm
In the else part you use 'on' guess that should be 'off'
I would add an extra check to make sure when presence is on it does not switch on again
Re: blocky presence for many people
Posted: Thursday 02 February 2017 22:20
by markjgabb
wow, i cant believe i missed that......seriously.....how the heck did i miss it had on set there.....works perfectly now, so the aditional check so chuck the entire set of or and one side and put an and box around it?
wow thanks...ive been staring at that for hours and never saw that
Re: blocky presence for many people
Posted: Friday 03 February 2017 0:00
by pvm
If off and (p1 on or p2 on) etc
Re: blocky presence for many people
Posted: Friday 03 February 2017 0:04
by markjgabb
excelent...seem to be working now
thanks guys...still slapping myself for missing that one