thing-it-device-enocean-ip
Advanced tools
Comparing version 0.2.6 to 0.2.7
@@ -11,5 +11,12 @@ module.exports = { | ||
events: [{ | ||
label: "Medium CO2 Concentration", | ||
id: "mediumCO2Concentration" | ||
}, { | ||
label: "High CO2 Concentration", | ||
id: "highCO2Concentration" | ||
}], | ||
},{ | ||
label: "Very High CO2 Concentration", | ||
id: "veryHighCO2Concentration" | ||
} | ||
], | ||
state: [{ | ||
@@ -75,3 +82,5 @@ label: "Humidity", | ||
this.state.co2Concentration = body.state.functions[n].value; | ||
if(telegram.functions[n].value > 1000) this.publishEvent("highCO2Concentration", {}); | ||
if(body.state.functions[n].value >= 700 && body.state.functions[n].value < 850) this.publishEvent("mediumCO2Concentration", {}); | ||
if(body.state.functions[n].value >= 850 && body.state.functions[n].value < 1050) this.publishEvent("highCO2Concentration", {}); | ||
if(body.state.functions[n].value >= 1050) this.publishEvent("veryHighCO2Concentration", {}); | ||
this.logDebug("CO2Concentration: " + this.state.co2Concentration); | ||
@@ -101,3 +110,5 @@ } | ||
this.state.co2Concentration = telegram.functions[n].value; | ||
if(telegram.functions[n].value > 1000) this.publishEvent("highCO2Concentration", {}); | ||
if(telegram.functions[n].value >= 700 && telegram.functions[n].value < 850) this.publishEvent("mediumCO2Concentration", {}); | ||
if(telegram.functions[n].value >= 850 && telegram.functions[n].value < 1050) this.publishEvent("highCO2Concentration", {}); | ||
if(telegram.functions[n].value >= 1050) this.publishEvent("veryHighCO2Concentration", {}); | ||
this.logDebug("CO2 Concentration: " + this.state.co2Concentration); | ||
@@ -104,0 +115,0 @@ } |
@@ -10,10 +10,21 @@ module.exports = { | ||
services: [], | ||
events: [], | ||
events: [{ | ||
id: "vibrationDetected", | ||
label: "Vibration Detected" | ||
}], | ||
state: [{ | ||
label: "Last intrusion Timestamp", | ||
id: "lastIntrusionTimestamp", | ||
type: { | ||
id: "string" | ||
label: "Last intrusion Timestamp", | ||
id: "lastIntrusionTimestamp", | ||
type: { | ||
id: "string" | ||
} | ||
}, | ||
{ | ||
label: "Cumulative counter", | ||
id: "counter", | ||
type: { | ||
id: "integer" | ||
} | ||
} | ||
}], | ||
], | ||
configuration: [{ | ||
@@ -51,7 +62,6 @@ label: "Device ID", | ||
} else { | ||
this.device.adapter.getDeviceState(this.configuration.deviceId).then(function (body) { | ||
/*this.device.adapter.getDeviceState(this.configuration.deviceId).then(function (body) { | ||
for (var n in body.state.functions) { | ||
if (body.state.functions[n].key === "cumulativeCounter") { | ||
this.state.lastIntrusionTimestamp = moment().toISOString(); | ||
this.logDebug("Last intrusion alarm: " + this.state.lastIntrusionTimestamp); | ||
this.state.counter = body.state.functions[n].value; | ||
} | ||
@@ -62,12 +72,13 @@ } | ||
console.log(err) | ||
}.bind(this)); | ||
}.bind(this));*/ | ||
// Retrieve current state | ||
this.device.adapter.listeners.push(telegram => { | ||
if (telegram.deviceId === this.configuration.deviceId) { | ||
//console.log(telegram); | ||
if (telegram.telegramInfo.data.match(/.{1,2}/g)[0] != "00") return; | ||
for (var n in telegram.functions) { | ||
if (telegram.functions[n].key === "cumulativeCounter") { | ||
this.state.counter = telegram.functions[n].value; | ||
this.state.lastIntrusionTimestamp = moment().toISOString(); | ||
this.publishEvent('vibrationDetected', {}); | ||
this.logDebug("Last intrusion alarm: " + this.state.lastIntrusionTimestamp); | ||
@@ -74,0 +85,0 @@ } |
{ | ||
"name": "thing-it-device-enocean-ip", | ||
"version": "0.2.6", | ||
"version": "0.2.7", | ||
"description": "[thing-it-node] Device Plugin for EnOcean IP products.", | ||
@@ -25,2 +25,3 @@ "authors": "Marc Gille", | ||
"moment": "^2.20.1", | ||
"lodash": "^4.17.10", | ||
"q": "^1.5.1", | ||
@@ -27,0 +28,0 @@ "request-json": "^0.6.2" |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
155441
48
3768
5
+ Addedlodash@^4.17.10
+ Addedlodash@4.17.21(transitive)