Skip to content

Homebridge Buddy

Colorado Four Wheeler edited this page Mar 13, 2018 · 3 revisions

Homebridge Buddy: A Refugee’s Guide

Particularly in the early phases of HomeKit Bridge it’s entirely likely you came from Homebridge Buddy, a quite functional but also quite bulky plugin. This plugin was written to replace HBB and eventually (far down the line in a galaxy far, far away) HBB will be put out to pasture as "that cool thing that taught us what we really needed to do with HomeKit integration".

Why Am I Upgrading?

There are a number of reasons to upgrade from Homebridge Buddy to HomeKit Bridge. Let’s review the bigger points:

Devices, Devices, Devices (no, not objects)

This is THE single biggest reason I ventured down this path. In the current setup HBB only supports a tiny portion of the many HomeKit devices that are out there. It’s OK squeezing my irrigation system into a strategic set of dimmers, it works fine, but I would rather have the actual irrigation control in HomeKit. Same goes for fans: call me silly but that stupid graphic makes me happy and having a dimmer switch as my fan makes me sad and sadness apparently makes me code. Wait until I’m depressed, I’ll probably pop out an entire operating system.

Webdeck Is Awesome (And So Is The New Integration)

When the devs asked Webdeck and I to come up with a more consolidated and easy solution it became abundantly clear that Webdeck knew NodeJS quite well. It is thanks to him that we have Homebridge integrated and distributed with HBB and if it wasn’t for Homebridge-Indigo in the first place HBB wouldn’t have been built.

When I thought of writing this I approached Webdeck with the idea that instead of the plugin having to translate the less-than optimal API from Indigo that I wanted to build something that allowed the plugin to define every aspect of the integration and have him pass it, somewhat generically, back to HomeKit. Poof, he was on board and that’s a testament to the kind of guy he is.

Webdeck, thank you brother, for bringing HomeKit to the Indigo masses.

So another reason to upgrade is that since the Homebridge link is more generic it means that the world is our oyster, we can do all sorts of cool Indigo stuff in HomeKit Bridge and just sort of tell HomeKit what to do. We can bully it into submission. Sort of like dodge ball, but for Siri.

HomePod

This is a big inspiration. Finally, after a long wait, I get to "Hey Siri" my house again. My voice command adventure started with putting all my old iPads and iPhones around the house so they could hear me "Hey Siri" my way through life and that changed my entire home automation mentality - and I haven’t looked back. But I found the Echo’s microphone was FAR superior and it made things less frustrating and made me less likely to get hit in the head by a cast iron pan when my wife has to scream at Siri in frustration.

The HomePod means it’s time to kick HomeKit into high gear in my house and, in the end, my needs are what drive my plugin development. I need this, it’s my crack.

So now that HomePod puts Siri squarely in your reach (and she can actually hear you now), it’s time to do more than dim your lights, it’s time to control everything that HomeKit can control.

Memory

One of the things that inspired me to start this project from the ground up was that HBB was built to be something entirely different, but most people used it for what it morphed into: the server for HomeKit rather than the management system for Homebridge-Indigo. The problem is that HBB was a memory hog and even developed a slight memory leak. Up front when you start HBB it will use between 35-60MB of memory and can grow to several hundred (the reason for this is still unknown). When I saw that I decided it would far easier to start over from what I learned than to try to manipulate HBB and likely break everything and upset a lot of folks in the meantime.

CPU

Like the memory issue, HBB comes with a CPU tax. It really isn’t much, but it could be better. In fact the latest release of HBB saw the memory usage cut by nearly 70% - which is to say we went from about 1/2 of a percent (or 1/4 of a percent on two processors) to about 1/8th of a percent. But, again, for what HBB was designed for this made sense and was an acceptable cost but as a server it seemed high.

The Spaghetti Code

If you read the intro to HomeKit Bridge then you see that this started out as a management plugin and morphed into a server at the request of the devs. I was honored to have been asked but it resulted in trying to shoehorn the server aspect of Homebridge into the already abundant management code. What ended up was a less than appealing mess of code that was becoming increasingly difficult to manage and would often lead to breaking something when something else got fixed. So upgrading means stability.

So, What Can I Expect As A Refugee?

Other than what’s been pointed out above (more memory, more devices, more stable, etc), here are the other things that are totally different between the two.

No More Wrappers

I love Wrappers. I wrapped the ever loving crap out of my Indigo devices and was able to create complex sprinkler controls and camera controls out of the humble dimmer. But I’ve come up with better ways to accomplish this and they are due for a ground up rewrite, but not in HomeKit Bridge. HomeKit Bridge will be 100% server, never anything else. I have other plugins that are better for doing wrappers and that is where they will end up.

Aliases No Longer Needed

Aliases were a means to an end. I didn’t want to say "Hey Siri, turn on the front porch wall sconce to 50%", I wanted to say "Hey Siri, turn on the porch", but my Indigo is a finely tuned machine where the room name prefixes each device name so they sort logically in Indigo lists - thus aliases were created. I hated them but there was no choice because there is no "Alias" feature in Indigo. Now that we control our own API we added an Alias feature and no we don’t need them any longer.

But Wrappers And Aliases Still Work

Don’t fear, young refugee, all that work you put into Wrappers and Aliases carry over. You’ll attach them to HBB but they are still devices and, as such, they can be used in HomeKit Bridge too.

Goodbye Treat As

Because of how Indigo passes information on the API it was impossible for Webdeck to accurately determine what each device was. That’s been fixed. While you can still "treat as" by simply specifying a different HomeKit type for your object, there isn’t an unmanageable list of "treat as" items to navigate. This will become even more of an awesome reason to upgrade in later versions of HomeKit Bridge when advanced device definitions will be possible.

No More Indigo Username and Password

Would you believe this is probably the #2 reason why people cannot get HBB working? They forget to add the Indigo web name and password to the config and then Homebridge can’t talk to the API. Now that there is no more Indigo API being used there is no more need for remembering to update HBB when you change your Indigo password.

No More Crazy Polling

Homebridge-Indigo had no choice but to call the Indigo API and poll device lists and process. This ended up meaning that if you had 1,000 devices that each one got polled even if only 100 of them were for HomeKit. And if you named them weird then you got all the web server messages about something not being found. This is gone, now HomeKit will ask the server to send the objects you have selected and it’s done, because that list will contain every detail Homebridge needs to know to enable your object(s) for HomeKit.

Fairwell Complex Configs

If you ever had to muck around on the config.json for Homebridge then it’s understandable why your hair loss is at an all time high. It can be confusing. Now the configuration goes from upwards of hundreds of lines to about twenty lines is all that is needed to go from zero to fully integrated.

Conclusion

There are so many things that are different that it’s too much to write, but this should give you a pretty good idea of why HomeKit Bridge is far better than Homebridge Buddy ever was. Don’t get me wrong, HBB does what it needs to do and I’ve been using it exclusively (I even use it for all my Alexa integration so it’s identical to HomeKit) for quite a while, but it’s now time to kick it into high gear and really USE HomeKit to it’s fullest potential.

Clone this wiki locally