npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

homebridge-magic-blue-bulb

v2.0.1

Published

Homebridge platform plugin for the MagicBlue LED Lightbulbs

Downloads

17

Readme

Homebridge Magic Blue Bulb

This plugin enables you to control your MagicBlue LED light bulbs through HomeKit via Homebridge using a dynamic platform plugin.

Installation

npm install -g homebridge-magic-blue-bulb

You may need to use sudo with that command.

Configuration

Add this platform to your homebridge config.json:

{
    "platforms": [
        {
            "name": "Magic Blue Bulbs",
            "platform": "MagicBlueBulbPlatform",
            "bulbs": [
                {
                    "name": "Living Room Light",
                    "mac": "aa:bb:cc:dd:ee:ff",
                    "handle": 12,
                    "manufacturer": "Magic Blue",
                    "model": "RGB Bulb",
                    "serial": "MB001"
                },
                {
                    "name": "Bedroom Light",
                    "mac": "ff:ee:dd:cc:bb:aa",
                    "handle": 12,
                    "manufacturer": "Magic Blue",
                    "model": "RGB Bulb",
                    "serial": "MB002"
                }
            ]
        }
    ]
}

Configuration Validation

This plugin uses Zod for runtime configuration validation, providing enhanced error reporting and type safety:

  • MAC Address Validation: Ensures MAC addresses follow the correct format (e.g., AA:BB:CC:DD:EE:FF or aa-bb-cc-dd-ee-ff)
  • Required Fields: Validates that essential fields like name and mac are present and non-empty
  • Type Safety: Ensures numeric fields like handle are proper integers
  • Clear Error Messages: Provides detailed error messages when configuration is invalid

Example Validation Errors

If you provide an invalid configuration, you'll see helpful error messages in the Homebridge logs:

[Magic Blue Bulbs] Configuration validation failed: mac: Invalid MAC address format, name: Bulb name is required

Platform Configuration Options

| Key | Description | | ---------- | -------------------------------------------------- | | name | Required. The name of this platform instance | | platform | Required. Must be "MagicBlueBulbPlatform" | | bulbs | Required. Array of bulb configurations (see below) |

Bulb Configuration Options

| Key | Description | | -------------- | ----------------------------------------------------------------------------------------------------- | | name | Required. The name of this bulb in your HomeKit app | | mac | Required. The MAC address of your Magic Blue bulb | | handle | Optional. BLE handle for commands. Use 46 for newer bulbs, defaults to 12 (0x000c) for older versions | | manufacturer | Optional. Manufacturer name, defaults to "Light" | | model | Optional. Model name, defaults to "Magic Blue" | | serial | Optional. Serial number, defaults to "5D4989E80E44" |

Migration from v1.x

If you're upgrading from v1.x, you'll need to update your configuration from an accessory-based setup to a platform-based setup:

Old Configuration (v1.x)

{
    "accessories": [
        {
            "accessory": "magic-blue-bulb",
            "name": "Magic Blue Bulb",
            "mac": "aa:bb:cc:dd:ee:ff"
        }
    ]
}

New Configuration (v2.x)

{
    "platforms": [
        {
            "name": "Magic Blue Bulbs",
            "platform": "MagicBlueBulbPlatform",
            "bulbs": [
                {
                    "name": "Magic Blue Bulb",
                    "mac": "aa:bb:cc:dd:ee:ff"
                }
            ]
        }
    ]
}

Benefits of Platform Plugin

The new platform plugin architecture provides several advantages:

  • Multiple Bulbs: Easily manage multiple Magic Blue bulbs from a single platform configuration
  • Better Performance: Improved caching and accessory management
  • Future-Proof: Uses Homebridge's recommended modern architecture
  • Easier Management: Centralized configuration for all your Magic Blue devices

Finding Your Bulb's MAC Address

The light bulb uses Bluetooth Low Energy. To discover your bulb's MAC address, install bluez and run:

sudo hcitool lescan

Look for a device named "LEDBLE-" followed by some characters - that's your Magic Blue bulb.

Example output:

LE Scan ...
FF:FF:C8:5D:68:9E Eve
FF:FF:C8:5D:68:9E Eve Thermo
33:03:44:44:AA:5C (unknown)
33:03:44:44:AA:5C Eve Door
aa:bb:cc:dd:ee:ff (unknown)
22:20:7B:99:D3:AF (unknown)
aa:bb:cc:dd:ee:ff LEDBLE-A582661F    <--- this is your light bulb
22:20:7B:99:D3:AF (unknown)

Development

This project is written in TypeScript. To develop and contribute:

Setup

npm install

Build

npm run build

Watch mode (for development)

npm run watch

The TypeScript source files are in src/ and the compiled JavaScript output is in dist/.

Project Structure

homebridge-magic-blue-bulb/
├── src/
│   ├── index.ts              # Plugin registration and entry point
│   ├── platform.ts           # Main platform class
│   ├── accessory.ts          # Individual bulb accessory implementation
│   ├── constants.ts          # BLE commands and default values
│   ├── rgbConversion.ts      # HSL/RGB color conversion utilities
│   └── types.ts              # TypeScript type definitions and validation
├── dist/                     # Compiled JavaScript output
├── tsconfig.json            # TypeScript configuration
└── package.json             # Dependencies and scripts

Requirements

  • Node.js >= 22.0.0
  • Homebridge >= 1.6.0 (compatible with Homebridge v2.0)
  • Bluetooth LE support on your system

Homebridge v2.0 Compatibility

This plugin is fully compatible with Homebridge v2.0! It uses:

  • ✅ Modern platform plugin architecture
  • ✅ Current HAP-NodeJS APIs (no deprecated patterns)
  • ✅ Proper TypeScript implementation with strict typing
  • ✅ Zod validation for enhanced configuration safety

Users will see a green checkmark in the Homebridge UI once v2.0 is installed.

Issues

This software comes with no warranty. It works for me and it might for you. If you encounter issues, please open an issue on GitHub.

Credits

License

GPL-3.0