Light My Way…

Now to add some smart-home products! We’ve covered some interesting stuff over the last two blog posts, so now I want to turn our attention to adding the first (of hopefully many!) smart-home devices to Homebridge; my Yeelight bulbs. With seven lights to add, I’m hoping this proves to be relatively straight-forward so, without further ado, let’s get started!


A bit of background on these Yeelights first though: I purchased my first bulb a couple of years ago when smart-home technology began to appear on my radar. I’d recently taken delivery of my first Amazon Echo Dot, and I was keen to impress friends and family alike with the ability to control lights (or in this instance a single standing lamp!) just by using my voice. Like many folks, I’d seen and heard much about the Philips Hue eco-system of bulbs, lights, and hubs, but wasn’t prepared for the shock of just how expensive these products were. It was disappointing to see that I’d need a separate hub to control it all too – something I just didn’t want to do (at least at this point). Whilst there was (and still is) no doubt about the absolute quality of these products, it was simply a case of being way out of my budget range. So that’s why I felt so happy to suddenly stumble across Yeelights, a product from the Chinese Xiaomi stable. I’d not heard anything about this company, but it checked the necessary boxes in terms of price and usefulness, including the major bonus that a separate hub wasn’t required to get these setup and running. At a little over £10.00 GBP per bulb, it was also very reasonably priced and could be used with the downloadable Yeelight skill in Alexa, thereby achieving my desire to use voice as a control method. Aside from the annoyance of having to purchase a bulb-fitting adapter (bayonet to screw) separately, I was delighted with my purchase. Now, nearly two years later, that same bulb is still going strong, along with the others I subsequently ordered. They’re incredibly simple to set up too:

1) Download the Yeelight app
2) Click the ‘+’ symbol under ‘Device’
3) Select the type of product you’re adding
4) Follow the simple on-screen instructions.

In a little more than a minute you’ve added your bulb/light into the Yeelight app, and it’s fully controllable.

So what about adding Yeelights into Homebridge via HOOBS? How easy will it be? Is it even possible? Let’s find out by navigating back to http://hoobs.local, and entering our username and password. Hopefully, you’ll be looking at the main page ‘Status’ screen.

With minimal research on the HOOBS website, it becomes clear that adding smart-home devices into Homebridge is done simply by adding ‘plugins’ so, with a single click, I’ve selected the tab right next to the Status page. There are a couple of plugins pre-installed in HOOBS, so it makes sense to steer clear of messing around with them. Instead, I head for the search bar at the top of the screen which suggests I search for plugins to install.

With that, I type in ‘Yeelights’ and I’m almost instantly met with a range of plugins available. From here it is simply a case of reviewing each one by selecting the NPM button on each plugin. This opens a separate page which details the plugin, how it should be configured, and possible variables to the setup.

Initially, I found this to be a bit overwhelming, and I struggled to work out which plugin was needed. Because I own a mixture of white and colour bulbs, along with a set of strip-lights, it wasn’t immediately obvious which option I should choose. A calm head is needed here and, after reviewing each plugin again, it became more apparent which plugin matched well with my products. It’s also really helpful to see the popularity of each plugin on each NPM page, as it shows the number of downloads per week – a useful guide to show which ones other folk used.

It’s important to state right now that because we’re using HOOBS, we don’t need to worry about the installation section of the NPM page – the all-in-one package we’ve installed on to our Raspberry Pi takes care of this for us! How fantastic is that?

I close the NPM tab and now revert back to my HOOBS plugins page. It’s as simple as clicking ‘install’ on the required plugin for it to begin the speedy process of adding it to your Homebridge instance. A window pops up and gives you a visual guide of the installation progress, and a satisfying ‘Succeeded’ message briefly appears to tell you all is done. Then the pop-up screen is gone leaving you with your installed plugins displayed in a neat order for easy viewing.

That’s it then, right? Well, actually not – there’s more work to be done to configure your Yeelight plugin. Firstly we need to ensure that each yeelight bulb/strip has API/LAN enabled which is pointed out clearly on the NPM page, as you can see below. If you’re unsure how to do this, here’s the solution:

1) Open your Yeelight app

2) Select your bulb

3) Select circled option

4) Select LAN control

5) Toggle on

All done! Repeat this process for each Yeelight bulb you have.

Next, we need to configure our plugin. Fortunately, with Yeelight, you’ll discover that it is one of a select few plugins that don’t require much if any, configuration (although you can alter transitions, connection attempts, etc.). The config section sits directly next to the Plugins tab we’ve just come out of. I probably didn’t need to do it, but I opted to include the information in the configuration shown in the image below. It’s another case of keeping a calm head here, as one look at the config section could make you break out into a cold sweat! It did me, to be honest.

You have the main configuration block occupying the very top section, where you can change the name and pin lines if you wish to do so. Just be sure that the new pin that you enter matches the three-two-three number sequence of the original otherwise it won’t work. The two sections below this are ‘Accessories’ and ‘Platforms’. They display a number of open and closed brackets which, being honest, I initially hadn’t the foggiest idea of what they did. It’s now a case of replicating the configuration requirements from the NPM page with any necessary tweaks you need to personalise your setup.

It clearly states that this information (for Yeelights) should be placed under the ‘platforms’ section of the configuration. As I’m the type of guy who’s a little bit OCD when it comes to lining things up I make sure that the brackets I’m inputting into the config line up as well as I can make them do so. I quickly work out that for every open bracket shown in each plugin, a corresponding closed bracket must also be there. If there isn’t, it won’t allow you to save it. This is a really good idea as it forces you to learn quickly what format the configuration needs to be in. It’ll soon tell you if it’s not quite right!

Once you’re confident your input in the config page is correct, select ‘Save’ in the top right-hand side of the screen. A green ‘Success, config saved’ box will momentarily appear to confirm your achievement. Things are going to start getting exciting now! Open your ‘Home’ app on your iOS device, select ‘Rooms’ at the bottom of the screen and, if you’ve not yet created any additional rooms, you should see your bulb(s)/light strip, etc. nestled cosily alongside your Homebridge Hub. It makes sense to test it in its current location, so feel free to toggle the switch for your bulb(s) on and off. If it’s a colour bulb, a long press of the icon will offer up the option to change the colour too. If it’s all working – congrats! It might now be a good idea to start creating rooms in your ‘Home’ app in preparation for additional smart devices being added.

We’ve started our journey towards smart-home nirvana! Hope you’re enjoying coming along for the ride…

Next time: Personalising your Home App and adding Sonoff Tasmota devices

1 reply
  1. Russell Gee
    Russell Gee says:

    Success! I hadn’t stumbled upon this plugin before and managed to get this working with a little bit of tinkering using previously acquired knowledge, had I been a total noob, I would have probably given up on raspi, your system and the idea of working with homebridge. You have a nice GUI here that will attract a few people who were scared of SSH and modifying script.

    I think you need to be a little more methodical with your tutorials, keep blog posts using superfluous sentences, but then write tutorials using clear concise steps, examples (not just redacted marker lines) and sub headings, examples of copyable code instead of non-zoomable photos of screens.

    This post needed to be accompanied by another couple of tutorials, how to use the config screen and how to validate your JSON – the JSON script that you posted doesn’t actually work – it can’t be saved by HOOBS, If you go to JSONLint and validate it you will see

    “timeout”: 100,

    The final comma isn’t necessary or accepted and needs to be removed.

    Minor – I know, but still enough for some people to lose sleep and hair over.

    Good luck, I hope you succeed! Im looking forward to the Sonoff tutorial.


Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply

Your email address will not be published. Required fields are marked *