node-red-contrib-alice 0.6.5 → 0.6.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/nodes/alice-sensor.js +10 -5
- package/package.json +1 -1
package/nodes/alice-sensor.js
CHANGED
|
@@ -57,16 +57,21 @@ function AliceSensor(config){
|
|
|
57
57
|
});
|
|
58
58
|
|
|
59
59
|
this.on('input', (msg, send, done)=>{
|
|
60
|
-
if (this.stype =='devices.properties.bool' && typeof msg.payload != 'boolean'){
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
};
|
|
60
|
+
// if (this.stype =='devices.properties.bool' && typeof msg.payload != 'boolean'){
|
|
61
|
+
// this.error("Wrong type! msg.payload must be boolean.");
|
|
62
|
+
// if (done) {done();}
|
|
63
|
+
// return;
|
|
64
|
+
// };
|
|
65
65
|
if (this.stype =='devices.properties.float' && typeof msg.payload != 'number'){
|
|
66
66
|
this.error("Wrong type! msg.payload must be number.");
|
|
67
67
|
if (done) {done();}
|
|
68
68
|
return;
|
|
69
69
|
};
|
|
70
|
+
if (this.unit == 'unit.percent'){
|
|
71
|
+
msg.payload = +msg.payload.toFixed(0);
|
|
72
|
+
}else {
|
|
73
|
+
msg.payload = +msg.payload.toFixed(2);
|
|
74
|
+
};
|
|
70
75
|
if (msg.payload === this.value){
|
|
71
76
|
this.debug("Value not changed. Cancel update");
|
|
72
77
|
if (done) {done();}
|