Aqara FP2 in Hubitat Rules using virtual devices & wrapper automations

If you haven’t been under a rock for the last few months, you’ve likely seen the Aqara FP2 in your social media feeds. With headlines with words like “Incredible” and “Automations will never be the same” it was too hard to resist getting one.

My smart home “allegiance” is pretty well split between HomeKit, Alexa and Hubitat. I try my best to make everything work together with things like Homebridge on Hubitat and Hoobs. The Aqara FP2 presented a particular challenge. Normally I’m working with something like a Zigbee or Zwave device to get it into Homekit. This time the FP2 shows up in Homekit and nothing else.

I’ve used the idea of “wrapper” devices for years in my smart home. Use a virtual device that can span multiple platforms, setup automations in the native platform to turn on/off the virtual device, then use that virtual device in a non-native platform.

I applied these techniques to the Aqara FP2:

  1. Create a virtual device of type “Virtual Presence with Switch”. Expose to Homekit via Homebridge.

  2. Setup an Automation in Homekit to turn On and Off respectively the switch when your designated FP2 presence sensor detects occupancy / no occupanc.

  3. Setup appropriate rules / rule machines in Hubitat

I’ve had this automation configured for about an hour and it seems to be exactly what I needed. Homekit lacks the ability to configure an automation that “detects no occupancy and stays for X seconds”. I setup a shortcut with a delay, but it was faulty because no change in occupancy in the delay period would reset the timer, so lights got turned off prematurely too often. This rule machine seems to work like I wanted. Just thought I’d share in case anyone else was looking for a way to get Aqara FP2 into Hubitat Rules.