Homebridge and Node-RED Integration
Homebridge and Node-RED Integration
The above Node-RED Flow, turns on my 'Outside Office' light when the powder room is turned on, and turns them both off after 10 seconds. Not practical but a good sample of the power behind Node-RED. Link to exported flow for above.
This is a release of the ability to integrate Homebridge Accessories into Node-RED so that you can start flows from Homebridge accessory events and control your existing homebridge accessories. ( To create accessories in HomeKit, please use node-red-contrib-homekit-bridged. )
Four different node types are available, the first node hb event listens for changes to an accessory (ie on/off) and sends a message into Node-Red containing the updated accessory status. The second node hb resume holds the state of an accessory and supports creating a state resume function. The third node hb status allows you to poll an accessory for status. The forth node hb control allows you to control a homebridge accessory. Each node is tied to an individual Home App Tile/Service of an accessory (ie on/off and brightness).
Payload from a dimmable lightbulb.
{ "On":true, "Brightness":100 }Please keep in mind that this integration only works with devices supported/exposed with HomeBridge Plugins. This does not have visibility to Native HomeKit devices. ( Similar to my homebridge-alexa plugin. )
For the hb event node, the ability of a Accessory to generate events in Real Time is dependent on how the plugin was architected and the actual device. Some are very good at generating events in real time, and others only generate events when the Home App is opened to the accessory. YMMV.
With a plugin, you can see if it supports Real Time events, by opening the Home App, and looking at an accessory. Then trigger a local event outside of homebridge/homekit. If the accessory updates in real time, then it support Real Events. ( An example of a local event can be turning on a Smart Light Switch, by the local switch. Another example would be using the vendor app to control an accessory.)
hb state to hb resume to make the use case for the node more self-explanatory. If you had used the hb state node in your existing flow, nodeRed will not start unless you manually change the node type in the flow file. To fix the issue, manually edit the flow file in your .node-red directory, and change the type reference hb-state to hb resumetrue going to the On characteristic would turn on a light, with this version it would be be represented with a message payload of { "On":true, "Brightness":100 }. This particular payload would turn on a light and set the brightness to 100. I made this change to enable easier intergradation with node-red-contrib-homekit-bridged.hb resume or hb control nodes it would output a debug message containing the valid/supported characteristics for use in the payload object.Camera nodes, as for some devices the name has changed.Debug logging configuration option that creates a file homebridge-automation-endpoints.json, which contains all the homebridge devices discovered. It can be used as part of troubleshooting device issues.ERROR: Device registration failed. You will need to re-select the device in the drop down. In my setup, nodes with Camera Motion sensors and Ceiling Fans needed to be revisited.No open issues yet, or sync has not completed.