Skip to content

Using a fake HomeKit switch to automate capturing real sensor data

of

In Apple Home, an action runs whenever the Homebridge dummy switch is "pressed" (every 15 minutes). The action sends a JSON payload to dashd (the backend server/database) consisting of HomePod sensor readings and a timestamp.
In Homebridge, the virtual switch is set to trigger every 15 minutes, and also to create a local webhook where it can be triggered on-demand.
Main settings panel for virtual switch in Apple Home.
Apple Home provides a settings panel for the Homebridge virtual switch, including actions that can be run on single press, double press, and long press.

Homebridge is an open-source, virtual HomeKit bridge that runs on inexpensive hardware (I’m using a Raspberry Pi). With it, non-HomeKit devices can be added to, and controlled by, Apple Home. homebridge-dummy is a Homebridge plugin providing virtual switches and other fake “devices” that can trigger or extend HomeKit automations.

As a demo, I’m using this setup to push sensor readings from my HomePods to a database that powers live charts on dash.ohn.sh. Readings are taken every 15 minutes in response to the virtual switch being “pressed.” The automation takes the form of a Shortcut that uses the built-in “Get Contents of URL” action to send the data to dashd, my custom backend.