Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

homebridge-yeelighter

cellcortex1.2kMIT2.15.5TypeScript support: included

Yeelight support for Homebridge with particular support of ceiling lights

homebridge-plugin, ceiling, yeelight, xiaomi, homekit, night_mode, Bedside Lamp, Ceiling Light, Moonlight, Jiaoyue, YLXD42YL, YLXD50YL, YLXD01YL, GuangCan, Galaxy

readme

Welcome to homebridge-yeelighter 👋

Version License: MIT Twitter: cellcortex

Yeelight support for Homebridge: https://github.com/nfarina/homebridge with particular focus on supporting the special features of ceiling lights.

There are many plugins for Yeelight already. This one is unique (so far) in supporting the background light that some yeelights have and also has a diffent approach to the moonlight mode (exposed as just another range for brightness).

If a light supports a background light, it will show up as a secondary service in the light accessory. If a light supports moonlight mode, the brightness will be adjusted so that the lower 50% are reserved for moonlight brightness and the upper 50% are using the "normal" mode. While this makes it simple to control the moonlight mode, it has the small drawback that setting the color-temperature will only work when in the normal light mode. I could not find an API to set the color temperature of the moonlight.

🏠 Homepage

Prerequisites

  • node ^16.14.2
  • homebridge ^1.4.0

Installation

You might want to update npm through: $ sudo npm -g i npm@latest

Install homebridge through: $ sudo npm -g i homebridge

Follow the instructions on GitHub to create a config.json in ~/.homebridge, as described;

Install the homebridge-hue plugin through: $ sudo npm -g i homebridge-yeelighter

Edit ~/.homebridge/config.json and add the yeelighter platform provided by homebridge-yeelighter, see Configuration;

Configuration

In homebridge's config.json you need to specify homebridge-yeelighter as a platform plugin. Furthermore, you need to specify what you want to expose to HomeKit. The simplest form is show below. This will enable the plugin and add all lights with their detected configuration to homekit.

"platforms": [
  {
    "platform": "Yeelighter",
    "name": "Yeelighter",
    "timeout": 5000,
    "interval": 60000
  }
]

The plugin supports setting the configuration through homebridge-config-ui-x.

You can use the override array to override the automatic configuration of the lights. An example for disabling the light with id 0x00000000deadbeef and enabling moonlight and disabling background for 0x0000000012345678:

"platforms": [
  {
    "platform": "Yeelighter",
    "name": "Yeelighter",
    "override": [
      {
        "id": "0x00000000deadbeef",
        "ignored": true
      },
      {
        "id": "0x0000000012345678",
        "background": false,
        "nightLight": true
      }
    ]
  }
]

Optional per light configuration:

  • id: string (mandatory) - the id of the light (as reported in the device config of homebridge)
  • name?: string (optional) - the name to be used in log messages
  • color?: boolean (optional) - this light is full RGB color
  • backgroundLight?: boolean (optional) - this light has a secondary color mood light
  • nightLight?: boolean (optional) - this light supports moonlight mode
  • log?: boolean (optional) - enalbe detailed logging for this light
  • offOnDisconnect?: boolean (optional) - switch the light off in homekit when it disconnects (this is for people with old-school wall switches)
  • colorTemperature?: { min: number, max: number } (optional) - colorTemperature limits in kelvin

Forcing a light to be shown (for network configs that don't support multicast)

Since the yeelights respond with their configuration to the discovery request, this information needs to be manually entered into the config. Use at your own risk - this may be screwing with your config since there's no way for Yeelighter to tell if the light is really there.

  • id: string - the id of the light (you have to find this from the app)
  • address: string - the IP address of the light
  • model: string - model (name of the light)
  • supports: string - whitespace separated list of commands that the light supports.

Setting up the lights

Make sure to enable "LAN control" for the lights you want to control. This is done in the Yeelight app either when setting up the light or in the lights settings which hide behind the ⏏ - button.

There are existing configurations for a number of lights. If your light is not supported, it will hopefully fall back to a decent fallback configuration. You can use the settings to fine-tune it. In those cases, it would be great if you could open a ticket in the issues page including the homebridge logs for the light being setup so the configuration can be added for future users.

Author

👤 Thomas Kroeber

🤝 Contributing

Contributions, issues and feature requests are welcome!
Feel free to check issues page.

Show your support

Give a ⭐️ if this project helped you!

changelog

Changelog

All notable changes to this project will be documented in this file. See standard-version for commit guidelines.

2.15.5 (2025-03-15)

2.15.4 (2024-12-11)

Bug Fixes

  • set brightness to 0 before switching off (ef6d068)

2.15.3 (2024-12-11)

Bug Fixes

2.15.2 (2024-12-11)

Bug Fixes

  • powermode was coded wrong for background (fc4d6d3)

2.15.1 (2024-12-11)

Bug Fixes

  • power swtiching with animations still ongoing (8f04f25)

2.15.0 (2024-12-11)

Features

  • animations for colors and brightness (use animateChanges in config) (1e559b0), closes #123

2.14.1 (2024-12-11)

Bug Fixes

  • config fix for animation (0a2f50f)

2.14.0 (2024-12-11)

Features

2.13.0 (2024-12-10)

2.12.0 (2024-12-09)

Bug Fixes

  • crash when charactistic getter times out first tim (dc3ce97)

2.11.0 (2024-12-07)

Bug Fixes

  • fix typos, less verbose logging (4b7f6e5)
  • improve logging when timeout (6bddca2)

2.10.0 (2024-12-07)

Bug Fixes

  • plugin is slowing down homebridge (74e39e9)

2.9.0 (2024-12-07)

Features

2.8.0 (2024-12-07)

Features

  • homebridge 2.0 support (preview) (d8f7f30)

Bug Fixes

  • was not checking for heartbeat messages correctly resulting in wrong warnings in log (f4c4122)

2.8.0-beta.0 (2024-12-07)

Features

  • add separate keep-alive interval (c13cad8)

2.7.2-beta.27 (2024-12-07)

Bug Fixes

  • transaction logging a bit less verbose (c03920d)

2.7.2-beta.26 (2024-12-07)

Bug Fixes

2.7.2-beta.25 (2024-12-07)

2.7.2-beta.24 (2024-12-07)

Bug Fixes

  • still fiddling with the startup crash (c6aba4c)

2.7.2-beta.23 (2024-12-07)

Bug Fixes

2.7.2-beta.22 (2024-12-07)

Bug Fixes

  • crash when update fails (eda7d0f)

2.7.2-beta.21 (2024-12-07)

2.7.2-beta.20 (2024-12-07)

2.7.2-beta.19 (2024-12-07)

Bug Fixes

  • yeeaccessory: crash of homebridge if quote exceeded on initial request (00ff129)

2.7.2-beta.18 (2024-12-07)

Bug Fixes

  • yeeaccessory: reconnnect and command id fixes (512604d)

2.7.2-beta.17 (2024-12-07)

2.7.2-beta.16 (2024-12-07)

Bug Fixes

  • yeeaccessory: request numbers get messed up (a5c0a41)

2.7.2-beta.15 (2024-12-07)

Bug Fixes

  • yeeaccessory: request numbers get messed up (a5c0a41)

2.7.2-beta.14 (2024-12-07)

2.7.2-beta.13 (2024-12-07)

2.7.2-beta.12 (2024-12-07)

2.7.2-beta.11 (2024-12-07)

2.7.2-beta.10 (2024-12-07)

2.7.2-beta.9 (2024-12-07)

2.7.2-beta.8 (2024-12-07)

2.7.2-beta.7 (2024-12-07)

2.7.2-beta.6 (2024-12-07)

2.7.2-beta.5 (2024-12-07)

2.7.2-beta.4 (2024-12-07)

2.7.2-beta.3 (2024-12-07)

2.7.2-beta.2 (2024-12-07)

2.7.2-beta.1 (2024-12-07)

2.7.2-beta.0 (2024-12-07)

2.7.1 (2024-12-07)

2.7.1-beta.1 (2024-12-07)

2.7.1-beta.0 (2024-12-06)

2.7.0 (2024-01-14)

2.6.0 (2023-08-06)

Bug Fixes

2.5.17-beta.5 (2023-08-06)

2.5.17-beta.4 (2023-08-06)

2.5.17-beta.3 (2023-08-06)

2.5.17-beta.2 (2023-08-06)

2.5.17-beta.1 (2023-08-06)

2.5.17-beta.0 (2023-08-06)

2.5.16 (2023-05-29)

Bug Fixes

  • initialization still happens with corrupt deviceInfo (b1f207b)

2.5.15 (2023-05-29)

Bug Fixes

  • initialization still happens with corrupt deviceInfo (b1f207b)

2.5.14 (2023-05-29)

2.5.13 (2023-05-29)

2.5.12 (2023-05-29)

2.5.11 (2023-05-29)

  • Added Arwen Light 550S and W1 Color support to specs (#139)
  • add model specs ceiling17 (#126)
  • add panel3 (#138)

2.5.10 (2023-05-28)

  • Updated dependencies

2.5.9 (2023-05-28)

2.5.8 (2023-05-28)

2.5.7 (2023-05-28)

2.5.6 (2022-07-03)

2.5.5 (2022-04-22)

Bug Fixes

  • platform config was not read correctly (152377e)

2.5.4 (2022-04-22)

Bug Fixes

2.5.3 (2022-04-22)

Bug Fixes

2.5.2 (2022-04-22)

Bug Fixes

  • ColorTemperature was not initialized before enabling Adaptive Lighting (5bde5cf)

2.5.1 (2022-04-22)

Bug Fixes

  • Characteristic getter was async (9e798a2)

2.5.0 (2022-04-22)

2.5.0-beta.0 (2022-04-22)

Features

  • Adaptive Lightning for TemperatureLights (f280883)

2.4.24 (2022-04-22)

Bug Fixes

  • #89 Interval setting ignored, still polling for updates every 1 minute (91d97b7)

2.4.23 (2022-04-22)

Bug Fixes

  • uuid error message at start (910b0f7)

2.4.22 (2022-04-21)

Features

  • added support for Monitor Hanging Light (05332fd)

2.4.21 (2022-04-21)

Features

  • added support for Yeelight Arwen Ceiling Light 550C (9c26230)

2.4.20 (2022-04-21)

Bug Fixes

  • #99 characteristics are reported with NaN when disconnected (9ef967e)

2.4.19 (2022-04-21)

Bug Fixes

  • add blocking of manual power when moonlight mode (ccab07f)

2.4.18 (2022-04-21)

Bug Fixes

  • temperaturelight power mode was not awaited (d733bd3)

2.4.17 (2022-04-21)

Bug Fixes

  • debounce temperature light (14a5bc3)
  • debounce temperature light (f47d215)

2.4.16 (2022-04-21)

Bug Fixes

  • debounce temperature light (b70391a)

2.4.15 (2022-04-21)

Bug Fixes

  • debounce mode setting for temperature lights (a9c5a95)

2.4.14 (2022-04-21)

2.4.13 (2022-04-21)

2.4.12 (2022-04-21)

Bug Fixes

  • Wrong check for numbers (a288343)

2.4.11 (2022-04-21)

Bug Fixes

  • various warnings and errors in the log (cda9c9c)

2.4.10 (2022-02-06)

Bug Fixes

  • clear timeout to reduce load (d15b898)
  • do not set NaN values (856b185)

2.4.9 (2022-01-27)

Bug Fixes

2.4.8 (2022-01-26)

Bug Fixes

  • power off when brightness set to 0 (8c672fe)

2.4.7 (2022-01-26)

Features

  • added 'ignorePower' setting to allow to ignore Homekits explicit power on message. This helps with the brightness settings of temperature lights with moonlight support. (d5e3c09)

2.4.6 (2022-01-26)

2.4.5 (2022-01-26)

2.4.4 (2022-01-26)

Bug Fixes

  • properly store moonlight brightness when set (eba6e0e)

2.4.3 (2022-01-26)

Bug Fixes

  • catch errors so Hoembridge doesn't carash with: UnhandledPromiseRejection (de120dc)

2.4.2 (2022-01-26)

Features

  • added support for A2001 (43ba941)

Bug Fixes

  • set power off instead of brightness 0 (b7c0398)

2.4.1 (2022-01-26)

Features

2.4.0 (2022-01-26)

2.4.0-beta.0 (2021-12-31)

Features

2.3.18 (2021-12-29)

Bug Fixes

  • Update required version to node 16 (4e10e16)

2.3.17 (2021-12-29)

2.3.16 (2021-12-29)

Features

  • update to latest dependencies. Please use node >= 16.6. (8acdfa9)

2.3.15 (2021-12-29)

2.3.14 (2021-12-28)

2.3.13 (2021-08-28)

Features

  • add experimental manual addition of devices (53ae357)

2.3.12 (2020-12-16)

Bug Fixes

  • duplicate removing of accessories (3766d38)

2.3.11 (2020-12-16)

Bug Fixes

  • remove items from cache when remoing them from platform (34bddc1)

2.3.10 (2020-12-15)

Bug Fixes

  • add recently added items to cache (94ed9ac)

2.3.9 (2020-12-14)

Bug Fixes

  • check for duplicate cache items (746d977)

2.3.8 (2020-12-14)

Bug Fixes

  • don't unregister new accessories (afdf987)

2.3.7 (2020-12-13)

Bug Fixes

  • catch unregistration errors (3aaff51)
  • handle global 'split' property properly (e575ced)
  • set device info also for separate ambient light (de32b46)

2.3.6 (2020-12-06)

Bug Fixes

2.3.5 (2020-12-06)

Bug Fixes

2.3.4 (2020-12-06)

Bug Fixes

2.3.3 (2020-12-06)

Bug Fixes

  • mixup with ambient accessory uuid (42471d2)

2.3.2 (2020-12-06)

Bug Fixes

2.3.1 (2020-12-06)

Bug Fixes

  • name setting overrides accesory (4367a5d)

2.3.0 (2020-12-06)

Features

  • configure ambient light as separate accessory (9886f07)

2.2.12 (2020-12-06)

Bug Fixes

2.2.11 (2020-11-29)

Bug Fixes

  • update accessory only once on name change (b108a03)

2.2.10 (2020-11-29)

Bug Fixes

  • set configured name for infoservice (97ddd7c)

2.2.9 (2020-11-29)

Features

2.2.8 (2020-11-29)

Bug Fixes

  • properly pass device into accessory (6a8a082)

2.2.7 (2020-11-29)

2.2.6 (2020-11-29)

2.2.5 (2020-11-29)

2.2.4 (2020-11-29)

Bug Fixes

2.2.3 (2020-11-29)

Bug Fixes

  • remove accessory when it is ignored (7b9dbdb)

2.2.2 (2020-11-29)

2.2.1 (2020-11-29)

2.2.0 (2020-11-29)

Bug Fixes

2.1.0 (2020-11-29)

! Version upgrade. This changes the structure of the accessories. Please reset your homebridge cache to prevent devices to show with duplicate characteristics.

1.5.16 (2020-11-23)

Bug Fixes

  • can't use HAP without webpacking (b11efdf)

1.5.15 (2020-11-23)

Features

  • set configured name (experimental) (2cc6787)

1.5.14 (2020-11-23)

Features

  • add support for ceiling13, ceiling14, celing18 (4077ccb)

1.5.13 (2020-07-19)

1.5.12 (2020-06-26)

1.5.11 (2020-06-26)

Bug Fixes

  • changin power mode didn't save request id (76fdcf0)

1.5.10 (2020-06-26)

Bug Fixes

  • changin power mode didn't save request id (76fdcf0)

1.5.9 (2020-06-21)

Bug Fixes

1.5.8 (2020-06-21)

Bug Fixes

1.5.7 (2020-06-21)

Bug Fixes

  • keep rest of message when parsing (614b31b)

1.5.6 (2020-06-21)

Bug Fixes

  • update did not set transaction (bf09f11)

1.5.5 (2020-06-21)

Bug Fixes

  • gracefully handle strange messages (a45deb2)

1.5.4 (2020-06-21)

1.5.3 (2020-06-21)

Bug Fixes

  • updating characteristics didn't work as expected (11b5332)

1.5.2 (2020-06-21)

1.5.1 (2020-06-21)

1.5.0 (2020-06-21)

Features

  • set initial name for homekit (9a91b20)
  • update characteristics from what is set (0048c75)

1.4.0 (2020-06-21)

Features

  • set initial name for homekit (9a91b20)
  • update characteristics from what is set (0048c75)

1.3.5 (2020-05-23)

Bug Fixes

  • logging of disconnect and connection failure (915833a)

1.3.4 (2020-05-23)

Bug Fixes

  • threshold calculation for timeout was wrong (e899671)

1.3.3 (2020-05-23)

1.3.2 (2020-05-23)

1.3.1 (2020-05-23)

Bug Fixes

  • minimum and maximum for timings (c37d145)

1.3.0 (2020-05-23)

Bug Fixes

  • config schema for homebridge-ui was wrong, now it should work (1804ec8)
  • release script doesn't query for version (e6c4864)
  • timeout of lights (now really) (c9ebdc3)

1.2.49 (2020-05-23)

Bug Fixes

  • stricter check if light is unreachable (493aa92)

1.2.48 (2020-05-23)

Bug Fixes

  • logging of seconds was the wrong number (2916819)

1.2.47 (2020-05-23)

Features

  • better detection of powered off lights (64aa01d)

1.2.45 (2020-05-23)

Bug Fixes

  • default to non-blocking (64d2458)
  • HSV settings for color lights should work now

1.2.43 (2020-05-08)

Bug Fixes

  • reconnect only on error (9dfeb61)
  • update CT on color lights only when in CT mode (6b4141d)

1.2.42 (2020-03-26)

1.2.41 (2020-03-22)

1.2.40 (2020-03-22)

Bug Fixes

  • connected state was not correctly updated (6acd46f)

1.2.39 (2020-03-22)

1.2.38 (2020-03-22)

Features

  • converted to non-blocking (slow polling) retrieval of properties (f48ead3)

Bug Fixes

  • check reachable with interval (c45e00b)

1.2.37 (2020-03-21)

Bug Fixes

  • activate light only when first update received (62142bc)

1.2.36 (2020-03-21)

1.2.35 (2020-03-21)

1.2.34 (2020-03-21)

1.2.33 (2020-03-21)

Features

  • option to disable CT for color lights (3f527eb)
  • option to use non-blocking requests and update intervals (9214e86)

1.2.32 (2020-03-19)

1.2.30 (2020-03-19)

Features

  • support for Mi LED Ceiling Light (21948f9)

1.2.29 (2020-01-19)

Bug Fixes

  • off status was not correctly set when disconnected (707b9ad)

1.2.28 (2020-01-17)

Features

  • 5s timeout when requesting attributes to handle power-off case (212db99)

1.2.27 (2020-01-17)

Bug Fixes

  • sending commands to disconnected lights did hang (65af343)

1.2.26 (2020-01-17)

Bug Fixes

1.2.25 (2020-01-17)

Features

  • update attributes when re-connected (6afc4d6)

1.2.24 (2020-01-17)

Features

1.2.23 (2020-01-12)

Features

  • configuration to make a light go 'off' in homekit when it disconnects (b619e9a)

1.2.22 (2020-01-12)

Bug Fixes

  • attribute update promise was not caught (f62dd4f)

1.2.21 (2020-01-12)

Bug Fixes

  • added CT first so the presets are used from color hopefully (afb5156)

1.2.20 (2020-01-12)

Bug Fixes

  • better function for calculating hue and saturation from colortemp (85acce2)

1.2.19 (2020-01-12)

Bug Fixes

  • setting color temperature on color lamps (cc5fa21)

1.2.18 (2020-01-12)

Bug Fixes

  • color light was switched on whenever a property was read. (2eb35d5)

1.2.17 (2020-01-12)

Bug Fixes

1.2.16 (2020-01-12)

Bug Fixes

1.2.15 (2020-01-12)

Bug Fixes

  • overrideconfig would always ignore light (98bba1f)

1.2.14 (2020-01-12)

Features

  • allow for detailed logging in individual lights in config (65e7dad)

1.2.13 (2020-01-12)

1.2.12 (2020-01-12)

Bug Fixes

  • Changed default behavior to not update characteristics (yet) (1741af1)

1.2.11 (2020-01-12)

Features

  • update attributes in case some other app has changed them (23fbd32)

1.2.10 (2020-01-11)

Features

  • config setting to save default values (so on power cycle the status is restored) (b372b13)

1.2.9 (2020-01-11)

Bug Fixes

  • disable CT for background light (for now) (a79f16e)

1.2.8 (2020-01-11)

Bug Fixes

  • background light was setting the front light ct instead (c2a6caa)

1.2.7 (2020-01-11)

Bug Fixes

  • do not spam 'Disconnected' if device remains inactive (1de04c2)

1.2.6 (2020-01-11)

Features

  • support for CT in background light (48325d9)

1.2.5 (2020-01-11)

Bug Fixes

  • updates were queried only once (7171222)

1.2.4 (2020-01-11)

Bug Fixes

  • added background light ct (which was missing from the attributes) (ef4c479)

1.2.3 (2020-01-11)

Features

  • detection for meteorite (bdc06a5)

1.2.2 (2020-01-10)

1.2.1 (2020-01-10)

Bug Fixes

  • CT was not working correctly for color lights (cbaf20b)

1.2.0 (2020-01-10)

Features

  • added template for configuration UI (214d31c)
  • White light support (42d768b)

Bug Fixes

  • Bedside lamp 2 was false classified as having moonlight (2b1b547)

1.1.0 (2020-01-07)

Features

  • added template for configuration UI (ececa77)

1.0.9 (2020-01-07)

  • added support for lightstrips and additional ceiling lights
  • fallback in case that an unknown model is detected
  • added support for color (main) lights

1.0.8 (2020-01-07)