Преглед на файлове

add time format hh:mm regex

Luigi Cisana преди 7 години
родител
ревизия
b929e72de3
променени са 3 файла, в които са добавени 15 реда и са изтрити 23 реда
  1. 0 10
      README.md
  2. 10 10
      ramp-thermostat/ramp-thermostat.html
  3. 5 3
      ramp-thermostat/ramp-thermostat.js

+ 0 - 10
README.md

@@ -27,16 +27,6 @@ This node expects a numeric msg.payload containing the current temperature (numb
 
 The state (true/false) is used to control an actuator. The current and target temperature outputs can be wired e.g. into an ui_chart node.
 
-
-### Get installed and npm Version
-
-```sh
-msg.topic: getVersion
-msg.payload: not used
-```
-
-Note: the installed version get sent instantly to the flow editor debug tab, the npm version after the response from the npm server is received (ca. 15 sec).
-
 ### Runtime settings
 
 **setTarget**

+ 10 - 10
ramp-thermostat/ramp-thermostat.html

@@ -129,25 +129,25 @@
         category: 'config',
         defaults: {
             name: {value:'',required:true},
-            time1: {value:''},
+            time1: {value:'', validate:RED.validators.regex(/(^$)|(^(?:[01]\d|2[0-4]):[0-5]\d$)/)},
             temp1: {value:'', validate:RED.validators.regex(/^[+-]?\d*\.?\d+$|^$/)},
-            time2: {value:''},
+            time2: {value:'', validate:RED.validators.regex(/(^$)|(^(?:[01]\d|2[0-4]):[0-5]\d$)/)},
             temp2: {value:'', validate:RED.validators.regex(/^[+-]?\d*\.?\d+$|^$/)},
-            time3: {value:''},
+            time3: {value:'', validate:RED.validators.regex(/(^$)|(^(?:[01]\d|2[0-4]):[0-5]\d$)/)},
             temp3: {value:'', validate:RED.validators.regex(/^[+-]?\d*\.?\d+$|^$/)},
-            time4: {value:''},
+            time4: {value:'', validate:RED.validators.regex(/(^$)|(^(?:[01]\d|2[0-4]):[0-5]\d$)/)},
             temp4: {value:'', validate:RED.validators.regex(/^[+-]?\d*\.?\d+$|^$/)},
-            time5: {value:''},
+            time5: {value:'', validate:RED.validators.regex(/(^$)|(^(?:[01]\d|2[0-4]):[0-5]\d$)/)},
             temp5: {value:'', validate:RED.validators.regex(/^[+-]?\d*\.?\d+$|^$/)},
-            time6: {value:''},
+            time6: {value:'', validate:RED.validators.regex(/(^$)|(^(?:[01]\d|2[0-4]):[0-5]\d$)/)},
             temp6: {value:'', validate:RED.validators.regex(/^[+-]?\d*\.?\d+$|^$/)},
-            time7: {value:''},
+            time7: {value:'', validate:RED.validators.regex(/(^$)|(^(?:[01]\d|2[0-4]):[0-5]\d$)/)},
             temp7: {value:'', validate:RED.validators.regex(/^[+-]?\d*\.?\d+$|^$/)},
-            time8: {value:''},
+            time8: {value:'', validate:RED.validators.regex(/(^$)|(^(?:[01]\d|2[0-4]):[0-5]\d$)/)},
             temp8: {value:'', validate:RED.validators.regex(/^[+-]?\d*\.?\d+$|^$/)},
-            time9: {value:''},
+            time9: {value:'', validate:RED.validators.regex(/(^$)|(^(?:[01]\d|2[0-4]):[0-5]\d$)/)},
             temp9: {value:'', validate:RED.validators.regex(/^[+-]?\d*\.?\d+$|^$/)},
-            time10: {value:''},
+            time10: {value:'', validate:RED.validators.regex(/(^$)|(^(?:[01]\d|2[0-4]):[0-5]\d$)/)},
             temp10: {value:'', validate:RED.validators.regex(/^[+-]?\d*\.?\d+$|^$/)},
         },
         label: function() {

+ 5 - 3
ramp-thermostat/ramp-thermostat.js

@@ -99,7 +99,7 @@ module.exports = function(RED) {
                   if (this.points_result.isValid) {
                     this.profile.points = this.points_result.points;
                   } else {
-                    this.warn("Profile temperature not numeric");
+                    this.warn("Profile temperature not numeric.");
                   }         
                   //this.warn("default "+this.profile.name);
                   this.current_status = {fill:"green",shape:"dot",text:"profile set to default ("+this.profile.name+")"};
@@ -114,13 +114,15 @@ module.exports = function(RED) {
               this.status(this.current_status);
               break;
               
-            case "getVersion":
+            case "checkUpdate":
               var version = readNodeVersion();
               var pck_name = "node-red-contrib-ramp-thermostat";
               
               read_npmVersion(pck_name, function(npm_version) {
                 if (npm_version > version) {
-                  this.warn("A new "+pck_name+" version "+npm_version+" is avaiable");
+                  this.warn("A new "+pck_name+" version "+npm_version+" is avaiable.");
+                } else {
+                  this.warn(pck_name+" "+version+" is up to date.");
                 }
               }.bind(this));