diff --git a/.gitignore b/.gitignore index f35b474..f872e90 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,4 @@ -# Created by .ignore support plugin (hsz.mobi) - *.iml - /node_modules .log +package-lock.json diff --git a/README.md b/README.md index 247efc8..5baf4e7 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,7 @@ -# node-red-contrib-xiaomi-devices +# node-red-contrib-mi-devices This module contains the following nodes to provide easy integration of the Xiaomi devices into node-red. +This module is a fork of [Harald Rietman module, node-red-contrib-xiaomi-devices](https://github.com/hrietman/node-red-contrib-xiaomi-devices) The following devices are currently supported: @@ -15,17 +16,16 @@ The following devices are currently supported: * Power plug (wifi) ## Preperation -To receive the gateway json messages on your network you need to enable the developer mode, aka LAN mode in the gateway. -A UDP input node is needed to receive the json messages. An UDP output node to send command's to the gateway. +To interact with the gateway, you need to enable the developer mode, aka LAN mode in the gateway (see below). -To control the Wifi-Plug, extensive use is made of the miio library created by [Andreas Holstenson](https://github.com/aholstenson/miio). Make sure to check his page for compatible devices. +To control the Wifi-Plug, extensive use is made of the miio library created by [Andreas Holstenson](https://github.com/aholstenson/miio). +Make sure to check his page for compatible devices. ## Install ``` -cd ~\.node-red -npm install node-red-contrib-xiaomi-devices +npm install node-red-contrib-mi-devices ``` ## Usage @@ -36,16 +36,45 @@ Note that the Wifi power plug is not configured through the configurator as it i The Xiaomi configurator screen with ease of use to configure your different devices. -![Xiaomi configurator in node-red](https://raw.githubusercontent.com/hrietman/node-red-contrib-xiaomi-devices/master/xiaomi-configurator.png) +![Xiaomi configurator in node-red](https://raw.githubusercontent.com/pierrecle/node-red-contrib-mi-devices/master/xiaomi-configurator.png) Tip: use the configurator from the side-panel (hamburger menu, configuration nodes) to manage your devices. Node-red doesn't update underlying edit screens if the configuration panel is opened / closed from the edit node screen. (If you do, you need to first close the edit node screen and reopen it by double-clicking the node you want to edit the properties for.) Here an example of how to use the different nodes. -![Xiaomi devices example in node-red](https://raw.githubusercontent.com/hrietman/node-red-contrib-xiaomi-devices/master/xiaomi-devices-overview.png) +![Xiaomi devices example in node-red](/xiaomi-devices-overview.png?raw=true) +## Enable LAN mode + +### Gateway + +1. Install MiHome App +2. Make sure you set your region to: Mainland China under settings -> Locale - required for the moment. +Mainland China and language can set on English. +3. Select your Gateway in Mi Home +4. Then the 3 dots at the top right of the screen +5. Then click on about +6. Tap under Tutorial menu (on the blank part) repeatedly +7. You should see now 3 extra options listed in Chinese until you did now enable the developer mode. [ if not try all steps again!] +8. Choose the second new option +9. Then tap the first toggle switch to enable LAN functions. Note down the password (`A4D81977ED8A4177` in the screenshot). +10. Make sure you hit the OK button (to the right of the cancel button) to save your changes. + +If you change here something, you lose your password! + +![Gateway advanced mode](/xiaomi-gateway-advanced-mode.png?raw=true "Gateway advanced mode") +![Gateway LAN mode enabled](/xiaomi-gateway-lan-enabled.png?raw=true "Gateway LAN mode enabled") ## Roadmap -* ~~Support for other devices like the smart-socket WiFi~~ Done! -* Import (new) devices directly from the gateway + +- [ ] Integrate Yeelight +- [ ] Handle Xiaomi Cube + +## Sources + +* [Harald Rietman node-red module](https://github.com/hrietman/node-red-contrib-xiaomi-devices) +* [Domoticz Instructions](https://www.domoticz.com/wiki/Xiaomi_Gateway_(Aqara)) +* [louisZl Gateway Local API](https://github.com/louisZL/lumi-gateway-local-api) +* [Domoticz Gateway Code](https://github.com/domoticz/domoticz/blob/development/hardware/XiaomiGateway.cpp) +* [Node-red UDP nodes](https://github.com/node-red/node-red/blob/master/nodes/core/io/32-udp.js) diff --git a/package.json b/package.json index 701ba88..0426ee1 100644 --- a/package.json +++ b/package.json @@ -1,14 +1,15 @@ { - "name": "node-red-contrib-xiaomi-devices", - "version": "1.1.0", - "description": "A set of nodes to control some of the popular Xiaomi sensors which are connected to the Xiaomi Gateway.", + "name": "node-red-contrib-mi-devices", + "version": "1.0.0", + "description": "A set of nodes to control some of the popular Xiaomi sensors which are connected to the Xiaomi Gateway, and the Gateway itself.", "repository": { "type": "git", - "url": "git+ssh://git@github.com:hrietman/node-red-contrib-xiaomi-devices.git" + "url": "git+ssh://git@github.com:pierrecle/node-red-contrib-mi-devices.git" }, "license": "MIT", "keywords": [ "Xiaomi", + "Aqara", "node-red" ], "node-red": { @@ -25,9 +26,9 @@ "xiaomi-actions": "node-red-contrib-xiaomi-actions/xiaomi-actions.js" } }, - "author": "Harald Rietman", + "author": "Pierre CLEMENT", "bugs": { - "url": "https://github.com/hrietman/node-red-contrib-xiaomi-devices/issues" + "url": "https://github.com/pierrecle/node-red-contrib-mi-devices/issues" }, "dependencies": { "cryptojs": "^2.5.3", diff --git a/xiaomi-configurator.png b/xiaomi-configurator.png index 8174d30..2147aec 100644 Binary files a/xiaomi-configurator.png and b/xiaomi-configurator.png differ diff --git a/xiaomi-devices-overview.png b/xiaomi-devices-overview.png index 282abce..d30d6d4 100644 Binary files a/xiaomi-devices-overview.png and b/xiaomi-devices-overview.png differ diff --git a/xiaomi-gateway-advanced-mode.png b/xiaomi-gateway-advanced-mode.png new file mode 100644 index 0000000..5248fbd Binary files /dev/null and b/xiaomi-gateway-advanced-mode.png differ diff --git a/xiaomi-gateway-lan-enabled.png b/xiaomi-gateway-lan-enabled.png new file mode 100644 index 0000000..9472c19 Binary files /dev/null and b/xiaomi-gateway-lan-enabled.png differ