stason325 / node-red-contrib-miio-localdevices

Nodes for controlling MIIO devices via node-mihome lib. List of devices and commands to be extended.
GNU General Public License v3.0
18 stars 7 forks source link

node-red-contrib-miio-localdevices

platform Min Node Version GitHub Repo size

GitHub version Package Quality GitHub last commit NPM Total Downloads NPM Downloads per month issues issues

Node for Node-Red to control Mi Devices locally via node-mihome (Humidifiers, Purifiers, Heaters, Fans, Vacuums, Lights - list of devices to be enlarged).

References

Based on node-mihome library: https://github.com/maxinminax/node-mihome

List of supported devices

See DEVICES.md for full list of supported devices and commands available for them.

Please make sure whether your device is supported by default, or you need to import additional definition file (please inspect carefully column "Import File" in DEVICES table). In case you need to import the file follow the instuctions below (section "SEND-node" in README).

It is theoretically possible to add support for any wifi-device which is operated via MIIO and MIOT protocols. Thus feel free to request support of new devices.

Successfully Tested Devices

npm install node-red-contrib-miio-localdevices

Latest Updates

version 0.5.12

version 0.5.0

version 0.4.0

version 0.3.0

Description and Setup

Available nodes:

You can find nodes in mihome section.

NR-Miio_pic9.png

Setting Up:

1) Configure your device with CONFIG-node

NR-Miio_pic1.png NR-Miio_pic2_1.png NR-Miio_pic2_2.png

2) For obtaining MiHome tokens please check out this guide:

https://github.com/Maxmudjon/com.xiaomi-miio/blob/master/docs/obtain_token.md

3) Starting from 0.4.0 you can choose whether GET-node returns JSON with original Mi-protocol properties' names or "friendly" names

NR-Miio_pic1_2.png

4) Set up SEND-nodes in line with pictures and example:

NR-Miio_pic3.png NR-Miio_pic3_2.png NR-Miio_pic3_3.png

5) Overall flow could look like that (instead of or together with dashboard nodes you can use Alice-nodes, HomeKit-nodes etc.):

NR-Miio_pic4.png

Ta make sure that your flow works properly I would recommend using certain hints (like in example.json attached):

Device Status Updates and Errors

GET-node:

1) sending JSON with actual device characteristics is trigered by input message (depreciated: starting from 0.3.0 there is no input in GET-node, JSON with current device properties is sent automatically after saving device configuration and deploying) 2) you can poll your device once or continuously with some interval, for that please check the box and choose polling interval in CONFIG-node (starting from 0.3.0 if auto-polling is turned on, GET-node sends JSON with actual characteristics only if these sharacteristics have changed) 3) if polling was successful you will see "Connection: OK" or "State: changed" green status under the node and after that get message with actual device characteristics (starting from 0.4.0 the vocabulary was added and you are free to choose whether GET-node returns JSON with original Mi-protocol properties' names or "friendly" names) 4) starting from 0.5.0 GET-node quickly returns a message with updated device characteristics after every command sent to device through SEND-node

NR-Miio_pic6.png

NR-Miio_pic10.png

4) some MIOT devices could require authorization in your MiHome account (please see collumn "Cloud Auth" in DEVICES.md). If you failed to get JSON with device charecteristics without MiHome auth, fill in your MiHome credentials in CONFIG-node and try to poll the device once again (I hope you will not need it).

SEND-node:

1) If sending command was successful and device supports your command (please see DEVICES.md) you will see ok-status under the node.

NR-Miio_pic5.png

2) Starting from 0.5.0 it is possible to send complex command through SEND-node. To do that you need to choose {} Custom JSON command from the pick list. Message to push into the SEND-node must be in a following form:

{
command_1: value_1,
command_2: value_2,
...
command_X: value_X
}

, where Command_1 ... _X and Value_1 ... _X are those supported by your device (please see DEVICES.md)

3) Some devices are not basically included into Node-mihome library but supported through node-red-contrib-miio-localdevices (please see collumn "Import File" in DEVICES.md). If you have such a device you need to copy-paste additionally the definition-file for your device. Do it this way:

Errors and Exceptions:

1) in case of errors you will see red status under the node and get message with the nature of error accured.

NR-Miio_pic7.png

NR-Miio_pic8.png

Flow Example

You can import attached example.json from Node-Red Import menu.

Future Updates and Improvement

Reporting an issue and new devices support requests

Please feel free to report all issues and to request support of new devices.