{"id":23031228,"url":"https://github.com/thomas-bouvier/yeelight-node","last_synced_at":"2025-08-14T15:31:26.695Z","repository":{"id":40454379,"uuid":"175679685","full_name":"thomas-bouvier/yeelight-node","owner":"thomas-bouvier","description":"💡 A simple Node.js library to discover and control Xiaomi Yeelights over LAN","archived":false,"fork":false,"pushed_at":"2023-01-05T08:17:23.000Z","size":378,"stargazers_count":30,"open_issues_count":4,"forks_count":7,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-12-12T21:41:34.733Z","etag":null,"topics":["api","home-automation","ssdp","xiaomi","yeelight"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/thomas-bouvier.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-03-14T18:39:44.000Z","updated_at":"2023-09-16T17:07:44.000Z","dependencies_parsed_at":"2023-02-03T20:00:29.860Z","dependency_job_id":null,"html_url":"https://github.com/thomas-bouvier/yeelight-node","commit_stats":null,"previous_names":["thomas-bouvier/yeelight-node-binding"],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thomas-bouvier%2Fyeelight-node","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thomas-bouvier%2Fyeelight-node/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thomas-bouvier%2Fyeelight-node/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thomas-bouvier%2Fyeelight-node/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/thomas-bouvier","download_url":"https://codeload.github.com/thomas-bouvier/yeelight-node/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":229839395,"owners_count":18132344,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api","home-automation","ssdp","xiaomi","yeelight"],"created_at":"2024-12-15T15:35:08.392Z","updated_at":"2024-12-15T15:35:08.954Z","avatar_url":"https://github.com/thomas-bouvier.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# yeelight-node\n\n[![npm](https://img.shields.io/npm/v/yeelight-node.svg)](https://www.npmjs.com/package/yeelight-node)\n[![Build Status](https://travis-ci.com/thomas-bouvier/yeelight-node.svg?branch=master)](https://travis-ci.com/thomas-bouvier/yeelight-node)\n\nA simple Node.js library to discover and control Xiaomi Yeelights over LAN.\n\nThis solution offers a 1:1 implementation of the [official docs from Xiaomi](http://www.yeelight.com/download/Yeelight_Inter-Operation_Spec.pdf), and also includes an SSDP implementation to retrieve the IP of your light.\n\n\u003cp align=\"center\"\u003e\n  \u003c!-- Why isn't there Markdown for centered images? --\u003e\n  \u003cimg src=\"https://imgs.xkcd.com/comics/standards.png\" alt=\"Competing standards\"\u003e\n\u003c/p\u003e\n\n## Installation\n\n```bash\n# Run this in your favourite terminal\nnpm i yeelight-node\n```\n\n## Usage\n\n**⚠️ Make sure you enabled the *LAN Control* option in the Yeelight app.**\n\nYou can get started by running the example, which will discover and ping your devices over LAN:\n\n```bash\nnode example/index.js\n```\n\nIn your code, simply require and instantiate the package as a class, passing in the IP address and port of the device as an object.\n\n```javascript\nconst { Yeelight } = require('yeelight-node')\n\nconst yeelight = new Yeelight({ ip: '0.0.0.0', port: 55443 })\n\nyeelight.set_power('on')\nyeelight.set_rgb([250, 150, 120])\n\nyeelight.get_prop('bright').then(\n    data =\u003e console.log(data)\n)\n```\n\nIf you don't know the IP of your device, you can use the SSDP client to scan your network:\n\n```javascript\nconst { Client } = require('yeelight-node')\n\nconst client = new Client()\n\nclient.bind(yeelight =\u003e {\n    yeelight.set_power('on')\n    yeelight.set_rgb([250, 150, 120])\n\n    yeelight.get_prop('bright').then(\n        data =\u003e console.log(data)\n    )\n})\n```\n\nYou can now call any of the operations from the [official docs](http://www.yeelight.com/download/Yeelight_Inter-Operation_Spec.pdf) on this instance.\n\nAs stated in the docs, Xiaomi devices support up to 4 simultaneous TCP connections. Any further connect attempt will be rejected. This library exposes the `yeelight.closeConnection()` to close the TCP connection at will, should your use case require it.\n\n## Tests\n\nTo run the tests:\n\n```javascript\nmocha tests/yeelight.test.js\n```\n\n## Credits\n\nOriginal work by [@cpav3](https://github.com/cpave3).","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthomas-bouvier%2Fyeelight-node","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthomas-bouvier%2Fyeelight-node","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthomas-bouvier%2Fyeelight-node/lists"}