2
0

doc(main): update documentation and flows

This commit is contained in:
Pierre CLEMENT
2018-03-21 23:29:36 +01:00
parent c850ca9536
commit d04f5c1196
65 changed files with 2990 additions and 4 deletions

29
dist/devices/gateway/Motion.js vendored Normal file
View File

@@ -0,0 +1,29 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const GatewaySubdevice_1 = require("./GatewaySubdevice");
class Motion extends GatewaySubdevice_1.GatewaySubdevice {
constructor() {
super(...arguments);
this.lux = 0;
}
static get acceptedModels() {
return ['motion', 'sensor_motion.aq2'];
}
get internalModel() {
return 'mi.motion';
}
handleMessage(msg) {
super.handleMessage(msg);
if (msg.isReadAck() || msg.isReport()) {
let data = msg.data;
if (data.lux) {
this.lux = parseInt(data.lux);
}
if (data.status === "motion") {
this.lastMotionTimestamp = data.timestamp;
this.emit('values-updated', { sid: this.sid, data: { hasMotion: true } });
}
}
}
}
exports.Motion = Motion;