Professional presense detector

I’m looking for a presence detector.

My first test with the XIAOMIs motion detectors, which in reality are presence detectors,
went very well. Unfortunately they are not as sensitive as I had hoped.

Therefore I am looking for a manufacturer for presence detectors in different designs.
Installation in ceilings, as well as replacement for light switches.

As radio standard ZigBee or WLAN should be used.

The KNX people have very good products, but I don’t like KNX.

Anyone have an idea?

And they can only switch to ON/OFF stage every minute, so you can not detect real time movement.

The XIAOMIS switches ON/OFF, but only if no movement is registered for 1.5 minutes. As long as movements are detected during this time, they do not switch off.

If the presence detector is two meters away from my desk, it may not recognize the movement of my hands while writing on the keyboard. I always have to move my upper body slightly to recognize me.

That’s the reason why I want to try out other devices.

I suspect that most PIR motion sensors would struggle with fingers at a distance–all they see is a blob of heat. A camera would be more likely to pick up your fingers, if you’re willing to entertain the idea of a camera always looking at you while you work.

Does the Xiaomi sensor reset its off-timer every time it detects motion? If so, perhaps you could set a longer wait period so that it’s more likely you’ll move your upper body and re-trip the sensor before it switches off.

What are you hoping to accomplish with presence detection?

I want to automate some things in my Home or Office. First of all I want to switch on the lights if I am in Office. I dont want to wave every two minutes. Same in other areas in my Home.

I tried the OSRAM Motion Detector, but with zigbee2mqtt I could not bring it to work. I can see the temperature but not occupancy. Dont know why.

Thought there are other manufacturers with good products.

Motion detection is not a good choice for presence detection in my opinion. You should have a look at tasker and the autolocation plugin. In addition to that I would combine more options to detect the presence. Motion detection is possibly a weak but additional option. Then you should have a much more reliable solution.

Just a thought, use a PIR to trigger when you enter the room, and have a momentary button by the door that you just tap when you’re leaving to reset the PIR with a rule.

Motion sensing is possibly the fastest and best solution for detecting arrival/entry. Geofencing is great for detecting when you’re on the property, but it’s not accurate enough for individual rooms and can be slow to trigger. It also requires you to have your phone on your person at all times.

I only use my motion sensors to detect arrival events. When I get home at night, motion triggers my lights if it’s dark. But when I leave, I tell Google to turn off the lights. When I head to the kitchen late at night, I pass by a sensor that turns on the light; then I pass by the sensor again and the light turns off.

I live alone, so it’s relatively easy to create presence/motion rules due to there being fewer people/variables. I perceive that it’s much more difficult to use motion and presence detection when there’s more than one person in the mix.

Your use case is very typical and can be achieved with any motion sensor, including the Xiaomi ones. The key thing is to maintain the light on for a while; don’t just shut it off as you step out. Use an associated timer to shut it off. And depend on the location, the timer can be longer or shorter.

As you step in the office, the motion will trigger the light on. If the timer is reasonable, subsequent movements will triggered motion event, and you can use it to renew the timer (and thus keep the light on).

1 Like

I use the Xiaomi sensors and they have a setting to determine when the PIR resets.
I use 15 seconds and have a separate timer value as an item associated with each light and an item to save the last triggered time.

My rules then check the last triggered time plus the timer value against current time to determine whether to turn off.

Changing the off to 15 seconds does mean that they fire more often but it reduces to chance of the lights incorrectly turning off.



For a professional solution, you might want to take a look at this:

Good luck,

If I need to tap a button, I can also tap a regular Switch :wink:

Yes, Russell … it is more diffucult for a family with two kids. Not easy to create rules to fit for all.

If I could find reliable sensors, I would have more possibilities to improve some processes.

I didn’t know I could change the parameters of the Xiaomis. This is very interesting. How can the last triggered time be determined and how can I use it in the rules?

Thanks GreenJ … but these products are too professional for private use :wink:

The following is from PaperUI


If you bind an item to the Motion Off Timer you can use this to set how long it stays in the ON state (I use 15 secs).
The Last Activity channel will show the last time it tripped and also I use a standard item name and capture the last tripped time separately based on the ON/OFF state, but you may not need to do that.

My system is a little more complex than most as I have over 360 Things and about 7800 items.
I use node-red for my rule engine with OH 2.3 but I’m looking at javascript through JSR233 for OH 2.4.
As you can imagine the migration is a big task.

What I do is use groups to trigger a proxy item on each light that I want automated (the group would have motion, door/window sensors, and anything else particular to that light).
Then the logic is done at the light level and compares the time the trigger was last tripped, adds the timer value for the light (each light has a configurable timer value in another proxy item) and compares to the current time.
I have a single function that checks every minute for all lights that are configured to allow automation (another proxy item) and send an OFF command if it is now past the timer for any particular light.
This has the advantage that it will not “forget” to turn off lights following a system restart or anything else that may make the current states/timers unreliable. It also means that I don’t have to right separate rules for each light. But it does require a strict naming convention for all lights, this is my definition for one light:

Group         GRoom3MainLight            "%RoomName% Main Light"  <light> (GRoom3)
Group         GRoom3MainLightMisc        "%RoomName% Main Light Misc"  <light> (GRoom3MainLight)
Switch        Room3MainLightSwitch       "%RoomName% Main Light" <light> (GRoom3,GRoom3MainLight,Lights,GPersist)   {channel="zwave:device:8ff2027c:node75:switch_binary"}
Dimmer        Room3MainLightDimmer       "%RoomName% Main Light [%d %%]" <light> (GRoom3,GRoom3MainLight,GPersist)
Color         Room3MainLightColour       "%RoomName% Main Light Colour"  <colorwheel> (GRoom3MainLight,GPersist)
Dimmer        Room3MainLightColourTemp   "%RoomName% Main Light Colour Temp [%d]" <colorwheel>  (GRoom3MainLight,GPersist)
Switch        Room3MainLightWhite        "%RoomName% Main Light White" <light>  (GRoom3MainLight,GPersist)  { expire="1s, state=OFF" }
Number        Room3MainLightWatts        "%RoomName% Main Light Watts [%.1f W]" <energy> (GRoom3MainLight,GPersist,GRestore)  {channel="zwave:device:8ff2027c:node75:meter_watts"}
Number        Room3MainLightPower        "%RoomName% Main Light Power [%d W]" <energy>  (GRoom3MainLightMisc,GPowerLevels,GPersist,GRestore)
Number        Room3MainLightkWh          "%RoomName% Main Light kWh [%.1f kWh]" <energy> (GRoom3MainLight,GPersist,GRestore)  {channel="zwave:device:8ff2027c:node75:meter_kwh"}
Number        Room3MainLightYesterdaykWh "%RoomName% Main Light Yesterday kWh [%.1f kWh]" <energy> (GRoom3MainLight,GPersist,GRestore)
Number        Room3MainLightTodaykWh     "%RoomName% Main Light Today kWh [%.1f kWh]" <energy> (GRoom3MainLight,GPersist,GRestore)
Switch        Room3MainLightAuto         "%RoomName% Main Light Auto" <selfAutoMode> (GRoom3MainLight,GPersist,GRestore)
Number        Room3MainLightAutoOn       "%RoomName% Main Light Auto On" <selfAutoMode> (GRoom3MainLight,GPersist,GRestore)
Number        Room3MainLightTimer        "%RoomName% Main Light Timer [%d min]" <clock> (GRoom3MainLight,GTimers,GPersist,GRestore) [ MinutesTimer ]
Number        Room3MainLightNightTimer   "%RoomName% Main Light NightTimer [%d min]" <clock> (GRoom3MainLightMisc,GTimers,GPersist,GRestore) [ MinutesTimer ]
Number        Room3MainLightEveningTimer "%RoomName% Main Light EveningTimer [%d min]" <clock> (GRoom3MainLightMisc,GTimers,GPersist,GRestore) [ MinutesTimer ]
Number        Room3MainLightDayTimer     "%RoomName% Main Light DayTimer [%d min]" <clock> (GRoom3MainLightMisc,GTimers,GPersist,GRestore) [ MinutesTimer ]
Number        Room3MainLightThreshold    "%RoomName% Main Light Threshold [%d lux]" <sun> (GRoom3MainLight,GPersist,GRestore) [ GSetpoint_0_1000_1 ]
Switch        Room3MainLightSolar        "%RoomName% Main Light Solar" <sun> (GRoom3MainLight,GPersist,GRestore)
Switch        Room3MainLightDimmable     "%RoomName% Main Light Dimmable" <light> (GRoom3MainLightMisc,GPersist,GRestore)
Switch        Room3MainLightArmed        "%RoomName% Main Light Armed" <security> (GRoom3MainLightMisc,GPersist,GRestore)
Switch        Room3MainLightTrigger      "%RoomName% Main Light Trigger"    <selfMotion> (GRoom3MainLightMisc)     { expire="15s, state=OFF" }
DateTime      Room3MainLightLastChanged  "%RoomName% Main Light Changed  [%1$ta, %1$te/%1$tm %1$tR]" <calendar>  (GRoom3MainLight,GPersist,GRestore)
DateTime      Room3MainLightLastUpdate   "%RoomName% Main Light Update  [%1$ta, %1$te/%1$tm %1$tR]" <calendar>  (GRoom3MainLight,GPersist,GRestore)
Number        Room3MainLightScene        "%RoomName% Main Light Scene  [%d]" <calendar>  (GRoom3MainLight,GPersist)

For what you are doing the relevant items are the Room3MainLightSwitch, Room3MainLightTimer, Room3MainLightTrigger and Room3MainLightLastChanged fields.

Room3MainLightLastChanged is updated whenever the the trigger or switch items change and also when the rule decides the last change was older than the timer.

The timer is in minutes.

From some older code I did the comparison would be something like this:

if (( swtimer.state > 0 ) && (now.isAfter((switchlastchanged.state as DateTimeType).calendar.timeInMillis + ((swtimer.state as DecimalType).intValue * 1000 * 60)))) myswitch.sendCommand(OFF)

So only if the timer item is set to greater than 0 will the check be done, then it checks if now is after the timer in milliseconds (minutes * 1000 * 60) and then turns off the light.

Hope this helps.


btw. the .calendar.timeInMillis part of the time comparison is deprecated and should rather be .zonedDateTime.toInstant.toEpochMilli

If you wanted to DIY it you could try use CO2 sensors. I’ve got a couple to try solve this problem, just not got around to it yet.

Apparently CO2 level rises rapidly in a room with occupants and drops rapidly when empty. I was planning on using this to determine occupancy while the people sat motionlessly.

Last night I made an interesting discovery. Without paying attention I ordered two different Xiaomi motion detectors. Xiaomi Aqara and Mijia. I thought the only difference is the illuminance sensor.

RTCGQ01LM - Xiaomi MiJia human body movement sensor
RTCGQ11LM - Xiaomi Aqara human body movement and illuminance sensor

The MiJia sensor switches to occupancy=TRUE as long as it detects motion.
Only when no movements are detected the timer runs for 90 seconds and changes to FALSE.
I can then immediately enter the room again and the sensor switches back to TRUE.

The Aqara sensor switches to occupancy=TRUE as soon as it detects movements.
Then the timer runs for 90 seconds and changes to FALSE.
Then it does not change to TRUE for another 90 seconds. Even if movements
is available.
After this time it switches from FALSE to TRUE. This is obviously completely different from the MiJia.

I wasn’t aware of that when I ordered the sensors.

With my Openhab 2.4 installation I use zigbee2mqtt and no bindings. The sensors write directly in MQTT. Also I don’t use PaperUI. I only use the config files.

MQTT gets this information from zigbee2mqtt:

zigbee2mqtt:info 2019-5-6 16:00:07 MQTT publish: topic ‘z2mqtt/0x00158d0001dbbacb’, payload ‘{“occupancy”:false, “linkquality”:55, “battery”:100, “voltage”:3015}’’

// RTCGQ01LM - Xiaomi MiJia human body movement sensor (EndDevice) (KELLER)
Type string : xiaomi_0x00158d0001dbbacb_switch_occupancy “Sensor MiJia motion” [stateTopic=“z2mqtt/0x00158d0001dbbacb”,transformationPattern=“JSONPATH:$.occupancy”]
Type number : xiaomi_0x00158d0001dbbacb_switch_linkquality “Sensor MiJia Signal” [stateTopic=“z2mqtt/0x00158d0001dbbacb”,transformationPattern=“JSONPATH:$.linkquality”]

I don’t know what options I have to change settings.

1 Like

I also have the RTCGQ11LM and it is working fine for me.
I use the following setup in configuration.yaml:
at the device:
retain: false
and at the bottom:

	cache_state: false

Maybe that makes it work for you.
Here is an overview of what options you have: