mirror of
https://github.com/bemble/node-red-contrib-mi-devices.git
synced 2026-03-22 17:55:03 +01:00
Compare commits
13 Commits
developmen
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4c8978decf | ||
|
|
627946c3d8 | ||
|
|
7f033a442b | ||
|
|
b984f415d5 | ||
|
|
aeb6fcd047 | ||
|
|
4e3c3055d7 | ||
|
|
ec82e3882c | ||
|
|
7880cc4f74 | ||
|
|
a07eef88ae | ||
|
|
af67f19217 | ||
|
|
e37c4aa71c | ||
|
|
600f8d859c | ||
|
|
6a9863814b |
14
README.md
14
README.md
@@ -1,5 +1,7 @@
|
|||||||
# node-red-contrib-mi-devices
|
# 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 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)
|
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")):
|
Here are different flow (screenshot of [importable flows-sample.json](flows-sample.json?raw=true "Different flows using Mi Devices")):
|
||||||

|

|
||||||
|
|
||||||
|
### 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
|
## Enable LAN mode
|
||||||
|
|
||||||
### Gateway
|
### Gateway
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ module.exports = (RED) => {
|
|||||||
|
|
||||||
this.on('input', (msg) => {
|
this.on('input', (msg) => {
|
||||||
msg.payload = { cmd: "get_id_list" };
|
msg.payload = { cmd: "get_id_list" };
|
||||||
node.send(msg);
|
this.send(msg);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
RED.nodes.registerType("xiaomi-actions get_id_list", XiaomiActionGetIdList);
|
RED.nodes.registerType("xiaomi-actions get_id_list", XiaomiActionGetIdList);
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
const crypto = require("crypto");
|
const crypto = require("crypto");
|
||||||
|
const miDevicesUtils = require('../src/utils');
|
||||||
|
|
||||||
module.exports = (RED) => {
|
module.exports = (RED) => {
|
||||||
function XiaomiPlugNode(config) {
|
function XiaomiPlugNode(config) {
|
||||||
@@ -13,9 +14,9 @@ module.exports = (RED) => {
|
|||||||
var payload = msg.payload;
|
var payload = msg.payload;
|
||||||
if(payload.sid) {
|
if(payload.sid) {
|
||||||
if (payload.sid == this.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"});
|
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.status({fill:"red", shape:"dot", text:"off"});
|
||||||
}
|
}
|
||||||
this.send(msg);
|
this.send(msg);
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "node-red-contrib-mi-devices",
|
"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.",
|
"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": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
|
|||||||
Reference in New Issue
Block a user