Controlling Vera from Homebridge

I’ve been trying take advantage of some of my home automation that Vera just can’t reach. Specifically, I have several Nest Protect smoke detectors. While Nest Protect does show up for smoke and CO, it can’t leverage the occupancy sensor. With a wired Nest Protect, it’s a handy motion detector built into many of my rooms.

I’ve set up Homebridge on a Raspberry Pi 3. There is a Homebridge-Nest app, which sees all 3 sensors on the Nest protect, as well as any other Nest product you may own (Thermostat, alarm system, etc). Homebridge-Nest can see the status of the occupancy sensor, so I’ve been trying to come up with a way to get that information to Vera. After some trial and error, I came up with an admittedly convoluted way, but it does work well.

Another plugin for Homebridge had to be installed, which was Homebridge-Vera. Homebridge-vera takes some considerable configuration ot get only what you want. I had to export a list my device-ids from Alt-ui, and had to create a CSV of all the device-ids I didn’t want included in Homebridge. I also excluded sensors (default).

Once configured, I had to take advantage two of Rigpapa’s apps. The first was Switchboard. Switchboard lets you create one or many virtual switches. This is one half of the key to getting information from Homebridge. I created a virtual switch for each of my Nest Protect sensors. Unfortunately, this runs into a limitation of Homebridge-Vera. It can’t control virtual switches (feature request coming). Those switches also must be excluded from Homebridge, otherwise Homebridge won’t function correctly.

Homebridge can however, control scenes. I created two scenes each; one for occupancy on, one for occupancy off. The scenes are manual scenes, and the action of the scene, to control the virtual switch, has to be controlled via a one line luup code. Scenes won’t directly control the virtual switches, unfortunately.

Once those were all created, I reloaded Vera, then restarted Homebridge. The new scenes automatically showed up in Homebridge. Now that they are in Homebridge, automations can be set up in the Apple Home app. Again, two need to be created. One for on, one for off.

The last step was to use one of Patrick’s other apps, Virtual Sensors. I created virtual motion sensors for each of the occupancy sensors, which get their value from the status of the virtual switches.

Once all this was done, I created lighting scenes for those rooms in Reactor, and they turn on and off based upon occupancy.

This method also works for other Homebridge integrations, such as Ring and Ubiquti Unifi, to detect motion.

Like I said, a bit convoluted, but it works.

Has anyone come up with another way (maybe easier, less cumbersome way) to get event triggers from Homebridge?