This is the forum archive of Homey. For more information about Homey, visit the Official Homey website.
The Homey Community has been moved to https://community.athom.com.
This forum is now read-only for archive purposes.
The Homey Community has been moved to https://community.athom.com.
This forum is now read-only for archive purposes.
How to count people going up/down stairs?
![cbh](https://forum.athom.com/uploads/userpics/384/nY8T2POU2TZEF.gif)
I'm trying to make some flows that can keep track of the number of persons each of three levels in my house.
A challenge in this is, that there isn't an obvious way to trigger a flow according to the sequence of devices triggered, that is, if PIR-1 and PIR-2 triggered in this sequence, then that... as opposed to if PIR-2 triggered first and then PIR-1 did then something else...
I've tried making setups with either two or three Aqara PIRs located on each end of the stairs and the third somewhere inbetween and use some Better Logic Boolean variables like this:
Flow 1:
![](https://forum.athom.com/uploads/editor/7q/kfo016yqa4y8.jpg)
Flow setting the variable "1st_high**" if the PIR at the upper end of the stairs is triggered.
Flow 2:
![](https://forum.athom.com/uploads/editor/1n/xnqc5aysb75u.jpg)
Flow setting the variable "1st_low**" if the PIR at the lower end of the stairs is triggered.
Flow 3:
![](https://forum.athom.com/uploads/editor/th/yz91nc9lxzct.jpg)
Flow triggered by the PIR in the middle.
If "1st_low**" is true, then someone must be on their way up: A variable "Pax_0" (persons present on ground level) is decremented by 1, another "Pax_1" incremented by 1and the "1st_low**" is set to false.
The "else" part is to set the "1st_low**" to false after 10 seconds to correct if the PIR was triggered by mistake.
Flow 4:
![Image: https://forum.athom.com/uploads/editor/wx/figtwipo8dsq.jpg](https://forum.athom.com/uploads/editor/wx/figtwipo8dsq.jpg)
As flow #3, just the other way.
The PIRs are set to cancel motion alerts after only 1 second to ensure getting alerts every time someone walks up or down.
It works most of the times, but not always...
Add:
Startet using only two Aqara PIRs and it didn't really work - therefore the approach with three - but I still had problems: If one person followed another within a short period - or if you went upstairs and then downstairs within a short period - the count was off.
Consulting encyclopedia @TedTolboom I learned, that no matter the time set for canceling a motion alert at the Aqaras, they will have a blind time at 60 seconds...
Have now made a setup with two NEO Coolcam PIR V1 and replaced the Aqaras in Flow #1 and #2.
Flow #3 and #4 is modified by replacing the middle PIR by the upper NEO PIR and lower NEO PIR, respectively.
Both NEO PIRs are set to have a motion blind time of one second and cancel motion alert after five seconds (the lowest possible value).
This works far better - the motion blind time obviously the troublemaker before.
Why making this, by the way?
Well, for the fun of it...
And, if you can keep track of the number of people at a certain level, then you can also make flows to control if stuff should be on or off accordingly, e.g. if the second floor is empty, then lights can be turned on when someone go there during night, but if it is not, then they should only be turned on at low brightness or not at all :-)
Any ideas to improve the flow - or ideas to a different approach?
A challenge in this is, that there isn't an obvious way to trigger a flow according to the sequence of devices triggered, that is, if PIR-1 and PIR-2 triggered in this sequence, then that... as opposed to if PIR-2 triggered first and then PIR-1 did then something else...
I've tried making setups with either two or three Aqara PIRs located on each end of the stairs and the third somewhere inbetween and use some Better Logic Boolean variables like this:
Flow 1:
![](https://forum.athom.com/uploads/editor/7q/kfo016yqa4y8.jpg)
Flow setting the variable "1st_high**" if the PIR at the upper end of the stairs is triggered.
Flow 2:
![](https://forum.athom.com/uploads/editor/1n/xnqc5aysb75u.jpg)
Flow setting the variable "1st_low**" if the PIR at the lower end of the stairs is triggered.
Flow 3:
![](https://forum.athom.com/uploads/editor/th/yz91nc9lxzct.jpg)
Flow triggered by the PIR in the middle.
If "1st_low**" is true, then someone must be on their way up: A variable "Pax_0" (persons present on ground level) is decremented by 1, another "Pax_1" incremented by 1and the "1st_low**" is set to false.
The "else" part is to set the "1st_low**" to false after 10 seconds to correct if the PIR was triggered by mistake.
Flow 4:
![Image: https://forum.athom.com/uploads/editor/wx/figtwipo8dsq.jpg](https://forum.athom.com/uploads/editor/wx/figtwipo8dsq.jpg)
As flow #3, just the other way.
The PIRs are set to cancel motion alerts after only 1 second to ensure getting alerts every time someone walks up or down.
It works most of the times, but not always...
Add:
Startet using only two Aqara PIRs and it didn't really work - therefore the approach with three - but I still had problems: If one person followed another within a short period - or if you went upstairs and then downstairs within a short period - the count was off.
Consulting encyclopedia @TedTolboom I learned, that no matter the time set for canceling a motion alert at the Aqaras, they will have a blind time at 60 seconds...
Have now made a setup with two NEO Coolcam PIR V1 and replaced the Aqaras in Flow #1 and #2.
Flow #3 and #4 is modified by replacing the middle PIR by the upper NEO PIR and lower NEO PIR, respectively.
Both NEO PIRs are set to have a motion blind time of one second and cancel motion alert after five seconds (the lowest possible value).
This works far better - the motion blind time obviously the troublemaker before.
Why making this, by the way?
Well, for the fun of it...
And, if you can keep track of the number of people at a certain level, then you can also make flows to control if stuff should be on or off accordingly, e.g. if the second floor is empty, then lights can be turned on when someone go there during night, but if it is not, then they should only be turned on at low brightness or not at all :-)
Any ideas to improve the flow - or ideas to a different approach?
Comments
If you set both your PIR's to , for example, 10s (meaining after detection, it stays high for 10 seconds)
Now going upstairs: PIR1 becomes high. . Stays high for 10 seconds.
IF PIR2 becomes high, AND PIR1 = high than somoneone came upstairs
Now going upstairs: PIR2 becomes high. . Stays high for 10 seconds.
IF PIR1 becomes high, AND PIR2 = high than somoneone went downstairs.
Works fine here
Different approach: Place a vibration sensor at your bottom step and your top step. When the bottom step sensor triggers, some1 is going upstairs and vice versa. Don't know how sensitive these things are though
https://www.kiwi-electronics.nl/vision-z-wave-schok-en-vibratie-sensor?lang=en