cflurin/node-red-contrib-ramp-thermostat

Is the status text correct?

Closed this issue · 1 comments

I have a target temp of 12, hysteresis of +1 and -1 and a current temp of 13.4. The status is showing

13.4 > 13 (Default Kitchen)

Surely the "13" is not significant, as it will only switch when the temp drops to (target-hysteresis) - i.e. 11? I would expect it to read

13.2 > 11 ...

and similarly for the heating side, e.g.

10.5 < 13...

The actual status is one option of many. The code (ramp-thermostat.js) is quite simple:

    var target_plus = parseFloat((target + this.h_plus).toFixed(1));
    var target_minus = parseFloat((target - this.h_minus).toFixed(1));
    
    //this.warn(target_minus+" - "+target+" - "+target_plus);
        
    if (current > target_plus) {
      state = false;
      status = {fill:"grey",shape:"ring",text:current+" > "+target_plus+" ("+profile.name+")"};
    } else if (current < target_minus) {
      state = true;
      status = {fill:"yellow",shape:"dot",text:current+" < "+target_minus+" ("+profile.name+")"};    
    } else if (current == target_plus) {
      state = null;
      status = {fill:"grey",shape:"ring",text:current+" = "+target_plus+" ("+profile.name+")"}; 
    } else if (current == target_minus) {
      state = null;
      status = {fill:"grey",shape:"ring",text:current+" = "+target_minus+" ("+profile.name+")"};  
    } else {
      state = null;
      status = {fill:"grey",shape:"ring",text:target_minus+" < "+current+" < "+target_plus+" ("+profile.name+")"};    
    }

If you like, just change/test it and post your version.
Let's see what other users think about it.