Compare commits

13 Commits

Author SHA1 Message Date
Pierre CLÉMENT
4c8978decf Update README.md 2018-04-17 21:52:46 +02:00
Pierre CLEMENT
627946c3d8 chore(distrib): version bump 2018-04-17 12:56:12 +02:00
Pierre CLÉMENT
7f033a442b Merge pull request #38 from readeral/xiaomi-actions-get-id-patch
Xiaomi actions get id patch
2018-04-17 12:54:09 +02:00
Pierre CLÉMENT
b984f415d5 Merge pull request #37 from readeral/update_docs
Update README.md
2018-04-17 12:53:52 +02:00
Pierre CLÉMENT
aeb6fcd047 Merge pull request #34 from artemsuv/fix_issue33
fix(socket) miDevicesUtils is not defined
2018-04-17 12:53:11 +02:00
Pierre CLÉMENT
4e3c3055d7 Merge pull request #35 from artemsuv/fix_data_not_defined
fix(socket) fix ReferenceError: data is not define
2018-04-17 12:52:54 +02:00
readeral
ec82e3882c Update xiaomi-actions.js 2018-02-13 13:32:10 +11:00
readeral
7880cc4f74 Update README.md 2018-02-12 23:33:34 +11:00
Artem Suvorov
a07eef88ae fix(socket) fix ReferenceError: data is not define 2018-02-04 00:11:15 +02:00
Artem Suvorov
af67f19217 fix(socket) miDevicesUtils is not defined 2018-02-03 23:16:25 +02:00
Pierre CLEMENT
e37c4aa71c Merge branch 'development' 2018-01-20 13:24:59 +01:00
Pierre CLEMENT
600f8d859c Merge branch 'master' of github.com:pierrecle/node-red-contrib-mi-devices 2018-01-11 00:44:08 +01:00
Pierre CLEMENT
6a9863814b feat(devices): handle yeelight basic support
Delete gateway in action config.
Close #4, close #8 and close #9
2018-01-11 00:43:29 +01:00
4 changed files with 19 additions and 4 deletions

View File

@@ -1,5 +1,7 @@
# node-red-contrib-mi-devices
__:warning: I will not go further because I don't use node-red anymore and I don't have the time, but feel free to fork, PR & so on. If you want to maintain this module, feel free to ask.__
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)
@@ -53,6 +55,18 @@ Here an example of how to use the different nodes (screenshot of [importable flo
Here are different flow (screenshot of [importable flows-sample.json](flows-sample.json?raw=true "Different flows using Mi Devices")):
![Mi devices example in node-red](resources/mi-devices-sample.png?raw=true "Mi devices flow sample")
### Interpreting payload.msg
The following is an (incomplete) summary of interpreting payload.msg output from the mi-devices nodes
#### payload.msg.cmd
When utilising a gateway, device and debug node, you will see the following property of msg.payload.cmd along with a number of possible values:
* cmd: 'read' - this is the result generated from a flow that utilises the 'read' node. (see 'outgoing' example above. The result of the 'xiaomi-ht' device connected to the 'read' node, will be output from the xiaomi-gateway incoming node, with a property of 'cmd' and value 'read'). Using a read node is the best way to obtain up to date values.
* cmd: 'report' - is a result of a direct change in status of a device, for example the opening or closing of a magnet sensor, or a change in temperature.
* cmd: 'heartbeat' - If the device is the gateway, then a heartbeat cmd will be sent every 10 seconds. If it is a sub-device, then plug-in devices (such as sockets and aircon helpers) will send a heartbeat every 10 minutes, other devices that sleep (e.g. zigbee devices), will send a heartbeat message every 60 minutes. If a device's current status is lost, a heartbeat message may be used to remedy the issue.
* cmd 'write' - used to change the state of a Smart Socket
## Enable LAN mode
### Gateway

View File

@@ -24,7 +24,7 @@ module.exports = (RED) => {
this.on('input', (msg) => {
msg.payload = { cmd: "get_id_list" };
node.send(msg);
this.send(msg);
});
}
RED.nodes.registerType("xiaomi-actions get_id_list", XiaomiActionGetIdList);

View File

@@ -1,4 +1,5 @@
const crypto = require("crypto");
const miDevicesUtils = require('../src/utils');
module.exports = (RED) => {
function XiaomiPlugNode(config) {
@@ -13,9 +14,9 @@ module.exports = (RED) => {
var payload = msg.payload;
if(payload.sid) {
if (payload.sid == this.sid) {
if (data.status && data.status == "on") {
if (payload.data && payload.data.status && payload.data.status == "on") {
this.status({fill:"green", shape:"dot", text:"on"});
} else if (data.status && data.status == "off") {
} else if (payload.data && payload.data.status && payload.data.status == "off") {
this.status({fill:"red", shape:"dot", text:"off"});
}
this.send(msg);

View File

@@ -1,6 +1,6 @@
{
"name": "node-red-contrib-mi-devices",
"version": "1.1.0",
"version": "1.1.1",
"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",