{"id":25091644,"url":"https://github.com/drarox/node_milight_api","last_synced_at":"2026-04-13T16:32:02.805Z","repository":{"id":42489744,"uuid":"245226338","full_name":"Drarox/Node_Milight_API","owner":"Drarox","description":"Simple API running in NodeJS Express for controlling your Mi-Light lights. Compatible Google Home and Amazon Alexa.","archived":false,"fork":false,"pushed_at":"2023-07-11T11:19:28.000Z","size":249,"stargazers_count":1,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-01T20:48:01.298Z","etag":null,"topics":["api","express","iot","mi-light","node","nodejs"],"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/Drarox.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":"2020-03-05T17:28:26.000Z","updated_at":"2023-04-11T16:32:41.000Z","dependencies_parsed_at":"2022-09-03T08:41:32.772Z","dependency_job_id":null,"html_url":"https://github.com/Drarox/Node_Milight_API","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Drarox/Node_Milight_API","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Drarox%2FNode_Milight_API","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Drarox%2FNode_Milight_API/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Drarox%2FNode_Milight_API/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Drarox%2FNode_Milight_API/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Drarox","download_url":"https://codeload.github.com/Drarox/Node_Milight_API/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Drarox%2FNode_Milight_API/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31761796,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-13T15:25:13.801Z","status":"ssl_error","status_checked_at":"2026-04-13T15:25:09.162Z","response_time":93,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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","express","iot","mi-light","node","nodejs"],"created_at":"2025-02-07T13:36:33.657Z","updated_at":"2026-04-13T16:32:02.790Z","avatar_url":"https://github.com/Drarox.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Node Milight API\n\nNode_milight is a simple API running on NodeJS with Express for controlling your Mi-Light lights. Follow the section below for an integration with Google Home and Amazon Alexa.\n\n## Features\n\n- Configuration file with all parameters in config.js\n- Use an authentication token for securing the access to the API\n- The token will be secured with an HTTPS connexion\n- Control your light with a voice assistant or third-party applications\n\n## Installation\n\n- You will need to have [NodeJS](https://nodejs.org/en/download/) and [NPM](https://www.npmjs.com/get-npm) installed :\n```shell script\nsudo apt-get update \nsudo apt-get install nodejs npm\n```\n- Clone the repo : `git clone https://github.com/Drarox/Node_Milight_API.git`\n- Go into the repo : `cd Node_Milight_API`\n- Install required libraries `npm install`\n- Edit config.js file `vi config.js`\n- [Generate](https://www.allkeysgenerator.com/Random/Security-Encryption-Key-Generator.aspx) a good random key for authentication\n- Change `bridge_ip` with your device's ip, `server_port` with the desired port (default: 3000), `authToken` with your token key and `bridge_version` if needed\n- Run the server with `node server`\n- You can test the API with curl or postman :\n```curl\ncurl --location --request POST 'http://localhost:3000/api/toggle' \\\n--header 'Content-Type: application/json' \\\n--data-raw '{\"auth\" : \"YOUR_RANDOM_TOKEN_KEY\"}'\n```\n\n## API usage\n\nMethod : `HTTP POST`\n\nContent-Type: `application/json`\n\nBody : `{\"auth\" : \"YOUR_RANDOM_TOKEN_KEY\"}`\n\n#### Endpoints:\n- `/api/on` : Turn the lights on\n- `/api/off` : Turn the lights off\n- `/api/toggle` : Toggle the light on and off\n- `/api/night` : Turn on night lights\n- `/api/brightness?value=[0-100]` : Set the brightness to a value between 0 and 100\n\n## Deploy as a service\n- Install npm package forever : `npm install -g forever`\n- Run forever : `sudo forever start server.js`\n\n## Google Home and Alexa integration with IFTTT\n\nFor this one you will need to have a server that is always running. You will also need to open the port for your node server in your router.\n\nI recommend to install the node server on raspberry or on a server with docker for example.\nIf you are one a raspberry, just open the port 3000 on your router for the raspberry or whatever port you configured your server.\n\n#### Docker deployment\nFor a docker installation, I personally use the official [docker-node](https://github.com/nodejs/docker-node) image, you can use the following docker-compose :\n ```yml\nnode:\n  image: node:lts\n  user: \"node\"\n  working_dir: /home/node/app\n  environment:\n    - NODE_ENV=production\n  volumes:\n    - /path/on/host:/home/node/app\n  ports:\n    - \"3000:3000\"\n  net: bridge\n  command: \"npm start\"\n ```\n#### Server security\n\nI strongly recommend you to use an HTTPS connection for your server because the app is using an authentication token sent in the body of the request which will only be protected if you use an HTTPS connection.\n\nOne way of doing that is to use a [reverse proxy](https://docs.nginx.com/nginx/admin-guide/web-server/reverse-proxy/).\nWith a reverse proxy you will also be able to use your domain as URL without entering the port (https://milight.example.com/api for example) and update the your ip address behind automatically using services like [ddclient](https://github.com/ddclient/ddclient).\n\n#### IFTTT configuration\n\nOnce your server is configured, secured and the port is open, you can configure the trigger for your voice assistant in IFTTT.\nSimply create an account or log in, [connect your account](https://support.google.com/pixelphone/answer/7194656) to your google account and go to [IFTTT/create](https://ifttt.com/create/), from here just click on \"This\" and choose the trigger plateform, for example Google Assistant and select \"Say a simple phrase\". Here just enter the trigger phrase and click on create trigger. Then click on \"That\" and search for \"Webhooks\" and choose \"Make a web request\", enter your url, for example https://milight.example.com/api/toggle, choose the method \"POST\", Content-Type \"application/JSON\" and enter this in the body section :\n```json\n{\"auth\" : \"YOUR_RANDOM_TOKEN_KEY\"}\n```\nWith YOUR_RANDOM_TOKEN_KEY being the key you configured in config.js.\n\nFinally click on \"Create action\" then \"Finish\" and that's it !\n\nYou can now trigger the light with your voice !\n\n## Credits\n\n- [NodeJS](https://nodejs.org/)\n- [ExpressJS](https://expressjs.com/)\n- [NPM](https://www.npmjs.com/get-npm)\n- [node-milight-promise](https://github.com/mwittig/node-milight-promise) by Marcus Wittig\n\n## License\n\nCopyright (c) 2020, Yannick Burkard and contributors. All rights reserved.\n\n[MIT License](https://github.com/Drarox/Node_Milight_API/blob/master/LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdrarox%2Fnode_milight_api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdrarox%2Fnode_milight_api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdrarox%2Fnode_milight_api/lists"}