normen / homebridge-milighthub-platform

Homebridge plugin to control MiLight Hub
6 stars 0 forks source link

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

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

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