npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

fp2-proxy

v0.0.1-0

Published

Proxy for Aqara Presence Sensor FP2

Downloads

29

Readme

FP2 Proxy

Downloads Version

GitHub issues GitHub pull requests JavaScript Style Guide

Proxy for Aqara Presence Sensor FP2

Copyright © 2023-2024 Erik Baauw. All rights reserved.

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.

Work in Progress

This repository is work in progress. I managed to pair the FP2 to fp2-proxy, persisting the pair data. Notably, the following features have yet to be implemented:

  • The actual proxy daemon;
  • Use a "lite", native JavaScript clone of hap-controller without the BLE logic;
  • Optionally connect to a Hue bridge instead of a deCONZ gateway.

Aqara FP2

The Aqara Presence Sensor FP2 is a mmWave presence detector supporting multiple detection zones. It also contains a light level sensor. The sensor is powered over a USB-C connection, like the Aqara FP1 Human Presence Sensor. However, unlike the FP1, the FP2 communicates over WiFi rather than Zigbee. It supports HomeKit natively, exposing an Occupancy Sensor and Light Sensor service by default. See the Wiki for details.

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.

Virtual Device

The virtual device consist of a number of CLIPPresence and CLIPLightLevel sensors resources on the deCONZ gateway ~~or the Hue bridge~~. fp2-proxy creates the CLIP resources and mirrors state changes of the FP2 to these, effectively creating a proxy FP2 sensor on the deCONZ gateway or Hue bridge.

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.

Configuration

Without any command arguments, fp2-proxy connects to and monitors paired FP2 devices, mirroring any state changes to the corresponding virtual devices on the deCONZ gateway. Typically, you would run fp2-proxy as a service on system startup. I recommend running 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.

Acknowledgements

Conceptually, 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. The HAP client is from hap-controller. The REST API client is ~~s are~~ from Homebridge deCONZ ~~and Homebridge Hue2~~.