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 🙏

© 2024 – Pkg Stats / Ryan Hefner

homebridge-milighthub-platform

v1.0.1

Published

Homebridge plugin to control Milight (EULight, Easybulb, LimitlessLED) lamps with the ESP8662 Milight Hub using MQTT or HTTP

Downloads

38

Readme

homebridge-milighthub-platform NPM Version verified-by-homebridge

Homebridge plugin to control MiLight / LightEU / Limitless / Easybulb lamps through the ESP8266 based Open Source MiLight Hub.

Features

  • Automatically fetches all MiLight Hub aliases as lights
    • Add/Remove lamps through the MiLight Hub web interface
    • No config.json editing, no entering stuff twice
  • Automatically uses MQTT if configured in the MiLight Hub
    • Using an MQTT broker can improve performance when using many lamps

Installation

  1. Install homebridge using: npm install -g homebridge
  2. Install this plugin using: npm install -g homebridge-milighthub-platform
  3. Add the plugin through your config.json

Example config

{
  "bridge": {
    "name": "Homebridge",
    "username": "CC:22:3D:E3:CE:30",
    "port": 51826,
    "pin": "031-45-154"
  },
  "platforms": [
    {
      "platform": "MiLightHubPlatform"
    }
  ]
}

Options

  • host Hostname of your MiLight Hub, default milight-hub.local
  • name The name of the platform as it appears in the homebridge log, default MiLightHubPlatform
  • httpUsername If you are using a username:password authentication for your MiLight Hub type in here your credentials, default null (disabled)
  • httpPassword If you are using a username:password authentication for your MiLight Hub type in here your credentials, default null (disabled)
  • backchannel Enables/Disables backchannel, default false (disabled)
  • darkMode Enables/Disables setting a low brightness value to mitigate the bright flashing of the lights if you turn them on with a low brightness & caches the last value before power off, default false (disabled)
  • rgbcctMode Enables ColorTemperature characteristic which is unsupported by HomeKit in combination with RGB characteristics but gives you a more accurate control of your lights at the expense of not supporting favourite colors in Home App anymore, default false (disabled)
  • forceHTTP Force use of HTTP regardless of MQTT settings in your MiLight hub, default false (disabled)
  • syncHubInterval Defines the interval in seconds when the plugin synchronizes with the hub, default every 10 seconds
  • commandDelay Defines the delay to send the commands with in milliseconds, default 100 milliseconds
  • debug Enables/Disables debug mode, default false (disabled)

Usage

Adding/removing Lamps

To add lamps in HomeKit, add aliases to the MiLight Hub. The aliases will automatically appear as lamps in HomeKit. If you remove an alias on the MiLight Hub the corresponding lamp will be removed as well.

Using MQTT

If MQTT is configured in the MiLight Hub then the plugin will automatically read those settings and use them to connect to MiLight Hub via MQTT.

Make sure your MQTT topic pattern includes the :device_id, :device_type and :group_id values, e.g. milight/:device_id/:device_type/:group_id.

To use the MQTT backchannel set MQTT topic state pattern to e.g. milight_state/:device_id/:device_type/:group_id.

Limitations

darkMode flag

This option changes 2 things: 1st: It sets the brightness value to 1 when switching off, so that when switching on again the lights do not flash super bright for a short moment. 2nd thing: It saves the last brightness value before the lights are switched off, so that when they are switched on again, they have the same value as before.

Unfortunately, there's a flip side to the coin: programmatically there's no way to distinguish between switching the lights on by sliding the brightness slider to 100 and switching them on by clicking the lights button. Since the cached value overwrites your brightness setting to 100, this leads to the error that your brightness is not set to 100 and you have to repeat the process.

RGB+CCT / RGBW(W) lamps

RGB+CCT / RGBW(W) milights have two modes, color temperature and RGB. Unfortunately HomeKit does not support lights with both modes active at the same time, so it's not supported to expose both RGB and Kelvin properties to Homekit. The default mode exposes only an RGB property, but detects when you set a color that is close to the colors used in the temperature circle in HomeKit and uses the color temperature mode on the milights in this case. This way you can still make use of favourite light-settings in the Home app. If you want to expose both properties anyway you can enable the RGB+CCT mode.

Development

If you want new features or improve the plugin, you're very welcome to do so. The projects devDependencies include homebridge and the npm run test command has been adapted so that you can run a test instance of homebridge during development.

Setup

  • Clone github repo
  • npm install in the project folder
  • Create .homebridge folder in project root
  • Add config.json with appropriate content to .homebridge folder
  • Run npm run test to start the homebridge instance for testing