Proxy for Aqara Presence Sensor FP2
npm install fp2-proxy


This repository provides a daemon programme, fp2-proxy, that creates a virtual device, mirroring an Aqara Presence Sensor FP2, on a deCONZ gateway ~~or Hue bridge~~.
This virtual device enables the FP2 to be used in rules on the deCONZ gateway ~~or on the Hue bridge~~.
Generally speaking, these rules are more reliable, more responsive, and functionally richer than HomeKit automations. Furthermore, these rules don't require an Apple home hub.
The virtual device can be exposed to HomeKit through Homebridge deCONZ ~~or Homebridge Hue2~~.
This provides a richer experience than using the native HomeKit feature of the FP2,
as the Homebridge plugins include additional characteristics for _Last Motion_, _Dark_, and _Daylight_ and history for _Motion_ and _Light Level_.
fp2-proxy, persisting the pair data.hap-controller without the BLE logic;The FP2 can be bound to the Aqara app, next to its pairing with HomeKit.
It is configured through the Aqara app, as far as I can tell over the Aqara IoT server in the cloud.
Once configured, the sensor can be unbound from the app, and no longer communicates with the Aqara IoT server.
For each configured detection zone, an additional _Occupancy Sensor_ service is exposed to HomeKit.
sensors resourcesfp2-proxy creates the CLIP resources and mirrors state changes of the FP2 to these,To REST API clients, including Homebridge deCONZ ~~and Homebridge Hue2~~, these CLIP resources are similar to the ZHAPresence and ZHALightLevel resources for a Zigbee motion sensor.
Only the state of the CLIP resources is updated through the API, instead of from the Zigbee device.
fp2-proxy connects to and monitors paired FP2 devices,fp2-proxy as a service on system startup.fp2-proxy on the same server as deCONZ.fp2-proxy keeps its configuration in a hidden configuration file, ~/.fp2-proxy.
It contains parameters like the API key for the deCONZ gateway, and the HomeKit pair data for the FP2.
While running, fp-proxy monitors the configuration file for changes,
adding or deleting virtual FP2 devices on the deCONZ gateway, as FP2 devices are paired or unpaired.
To pair or unpair FP2 devices, run fp2-proxy pair or fp2-proxy unpair.
fp2-proxy consists of a HAP client to connect to the FP2 devices, and a REST API client to connect to the deCONZ gateway or Hue bridge.