Homebridge Plugin Automation

28th Jan 2024

The simplest possible Homebridge automation plugin

Today I’m open sourcing grrowl/homebridge-plugin-automation, building and spinning out from previous work in 2023 “GPT-3 Home Control with Node-RED - tom mckenzie”, which inspired HomebridgeAI.

One of the core insights which lead to developing HomebridgeAI was, like much of the world, “We can just write Javascript”. Whether generated using Large Language Models and a whole lot of statistical analysis, or under a veneer of no- or low-code interface like Node-RED, a lot of the world is just JS, and we should be leveraging this to make our lives easier.

And since the HomebridgeAI project is stalled while I get wrapped up in other projects, I figured I’d open source the the functionality on the Homebrige side so its concepts could be leveraged by other projects, and the community could get use from it.

Hence, homebridge-automation is here. It includes the core “HAP command and control” code I wrote for HomebridgeAI, auto-discovers any homebridge instances on the network, and uses the same schema-validated message passing protocol to enable a plain Javascript file to act, react, plan, control, whatever, the devices in your home.

Why run automations on your instance? The core benefit (whether you use Node-RED or something like Automation) is it’s really reliable. Your automations shouldn’t be reliant on your iPad being at home and charged, or connectivity to Google or Some Other Cloud. Hue Bridge automations seem the most rock-solid but it only supports a handful of my lights. Homebridge supports everything, runs on a dedicated Raspberry Pi, and doesn’t skip a beat. No need to run extra services (like Node-RED) for simple automations which can run on the existing dedicated hardware, especially for straightforward automations which are so much easier to express in plain Javascript.

Current status is “rough as guts” since the config is a single-line textbox for pasting raw JS into, but there’s enough error handling and sanity checking to prevent this plugin from from crashing Homebridge. Hopefully in open-sourcing this capability, the community can find some use out of it and 🤞 help clean up some of the rough edges.