Explorar el Código

add toFixed(1)

Luigi Cisana hace 7 años
padre
commit
0ade2877ef
Se han modificado 2 ficheros con 8 adiciones y 2 borrados
  1. 6 1
      package.json
  2. 2 1
      ramp-thermostat/ramp-thermostat.js

+ 6 - 1
package.json

@@ -1,12 +1,17 @@
 {
     "name"         : "node-red-contrib-ramp-thermostat",
-    "version"      : "0.3.0",
+    "version"      : "0.3.1",
     "description"  : "A Node-RED node that emulates a thermostat",
     "dependencies": {
     },
     "keywords": [ 
       "node-red",
       "thermostat",
+      "profile",
+      "heating control",
+      "tmeperature control",
+      "energy saving",
+      "multtple heating zones"
       "single room temperature control"
     ],
     "author": "cflurin",

+ 2 - 1
ramp-thermostat/ramp-thermostat.js

@@ -79,6 +79,7 @@ module.exports = function(RED) {
               
             case "setTarget":
               result = setTarget(msg.payload);
+              
               if (result.isValid) {
                 this.profile = result.profile;
                 globalContext.set(node_name, this.profile);
@@ -199,7 +200,7 @@ module.exports = function(RED) {
       status = {fill:"grey",shape:"ring",text:target_minus+" < "+current+" < "+target_plus+" ("+profile.name+")"};    
     }
     
-    return {"state":state, "target":target, "status":status};
+    return {"state":state, "target":parseFloat(target.toFixed(1)), "status":status};
   }
   
   function setTarget(target) {