This piece of code is intended to use as plugin to Node red This plugin has basic support for Xiaomi Mi home devices via miio library
npm install node-red-contrib-miio-wrapper
Config node doesn't have any settings yet. It only discovers devices in a network (same as miio discover). Than list of devices become available in miio device node.
Miio device node is able to request its properties via 'props' command. The second option is just to listen for any events emiting from device. The last option is to call device function by name (which is currrently a hack)
Payload for changePower command:
{"command":"call", "name":"changePower", "args":["on"]}
Payload for properties request:
{"command":"props"}
Just make 'miio device' from Mii Home section. Then create config node from config dialog. You have to use same config for all nodes.
- zimi.powerstrip.v2 doesn't report its current power state (probably miio bug)
- You cannot use devices with custom tokens (going to implement it later)
- The best way to help is make pull request with new functions or bug fixes.
- Reporting bugs and (not-)working devices also helps
- Alexander Sorokin (initial author https://github.com/Gromina)