Which is the best way to build a room presence detection system?

Interesting reading about ZigBee network capacity:


Seems limit is in range of several millions of devices in single mesh.
1 Like

Don’t know if your house is pre-cabled for this purpose but using an ordinary consumer alarm system with IP module including PIR sensors for every room would be much more flexible. Or you can use consumer grade alarm system wireless sensors for this (Though you have to compare total price for that). I have xiaomi zigbee body sensors in my bedroom; but they have a min of 2mins between movement registers (1.5 mins with deconz). On the other hand, i have this very cheap Crow alarm system with IP module, which registers movements online without and delays on or off, so i see movements in every room instantly. Btw, this cheap alarm system (all cabled reed or pir sensors) on my smart home network is the most stable of all among zigbee, zwave and wifi…

I use a mix of bluetooth and motion sensors, It works pretty well. Motion sensor will trigger the light but once the timer reports no motion it HASS to pass a condition of no bluetooth devices detected in that room. In my case it’s Mibands, which isn’t an issue as everyone in my house wears one.

The sweet automations are having custom modes for each room based on who’s in there. When I walk in to my living room the lights set to my preferred settings, the temperature i like, tv turns on and changes to Plex. If my housemates in there already, it’s on his settings and stays the same. When everyone leaves, everything turns off.

4 Likes

What do you use to detect the mibands? Pi Zero W? Are you using room-assistant as well?

1 Like

Yeah, room-assistant on a bunch of pi’s.

1 Like

Hey I’ve been using this for over a year now Monitor - multi user passive presence detector is room assistant better?

Do u have an example of your automation when the timer restarts if a specific device is in use in that room. I like this idea

I would use a “tripwire” to count the persons in the room and turn the lights on/off. Something like an infrared or laser receiver/transmitter pair. If you want also to personalise the scene, you could use bluetooth devices for individual recognition but that’s far far from perfect :wink:

My whole config is available here. However I’m afraid, all my automations are in AppDaemon :sweat_smile:

However in HA automations, I would do it like this:

Create a timer:

timer:
  office:
    duration: '00:10:00'

Create an automation that triggers on motion and turns the light on and starts the time (just in case you didn’t know this, when you try to start an already running timer, it will restart the timer instead).

automation:
- alias: "Turn on office lights on motion"
  trigger:
  - platform: state
    entity_id: binary_sensor.motion_office
    to: 'on'
  action:
  - service: light.turn_on
    entity_id: light.office_ceiling
  - service: timer.start
    entity_id: timer.office

Create a second automation that triggers when the timer finishes that starts the timer again if one of the “override” devices is on.

- alias: "Restart timer if an override device is on"
  trigger:
    platform: event
    event_type: timer.finished
    event_data:
      entity_id: timer.office
  condition:
    condition: or
    conditions:
      - condition: state
        entity_id: switch.computer_office
        state: 'on'
      - condition: state
        entity_id: media_player.office
        state: 'playing'
  action:
    service: timer.start
    entity_id: timer.office

Create a third automation that also triggers when the timer finishes that turns the lights off if none of the override devices is on.

- alias: "Turn off lights if no override device is on"
  trigger:
    platform: event
    event_type: timer.finished
    event_data:
      entity_id: timer.office
  condition:
    - condition: state
      entity_id: switch.computer_office
      state: 'off'
    - condition: state
      entity_id: media_player.office
      state: 'off'
  action:
    service: light.turn_off
    entity_id: light.office

The last two automations can probably be merged into one automation, not an expert in HA automations :upside_down_face:
I didn’t test these automations, but feel free to try it.

6 Likes

Good idea, but how about this:
One person is in the room, another person enters the room, how does the “tripwire” know if the person inside the room left the room or another person entered the room? I think you would need at least two tripwires to know in which direction it was tripped, or am I completely wrong?

These guys were going to bring this to market, but seems theyve changed direction.
I saw it in BRuh a while back
https://www.xandem.com/

At the moment the only reliable solution for exact room presence detection is using a thermopile grid sensor such as Panasonic Grid-EYE
Altough not cheap (about $30 per sensor), it’s still pretty affordable but requires some pretty simple build on Arduino, RPI or other DIY.
There are modules available on Aliexpress

2 Likes

Ooh nice; this could be super useful for an upcoming project. Thanks!

I was looking for an automation like this, thanks!

Good point @Burningstone, it would require a tandem of 2 tripwires positioned very close together.

It’s an option… two tripwires one after the other can be used to know if the person goes into a room or out.
But please, correct me if I am wrong… a PIR sensor can “see” the body’s heat (or the IR radiation emited by a hot body) . So, why is needed that the body’s be moving to trigger? Even if the person is static, keeps hot…

1 Like

Here’s an explanation on how PIR sensors work. I can tell you for sure that all of the PIRs I used don’t detect motion if you are sitting still in a room.

1 Like

Nice I look forward to your impending tutorial ?! :wink:

There are already a number of tutorials easily found by googling “arduino grid-eye” or similar.
This one for example.

Thanks have you tried it. To be clear this would remove the need for movement such as what is required by a pir sensor. Looks like they can do room counts with this thing…a little bit Orwellian hehe

Looks like a bit of work to get set up going through that tutorial especially if its your first arduino project but appears to be well documented. Maybe a good one for Dr z

1 Like