Skip to content

SergiuToporjinschi/node-red-contrib-heater-controller

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GitHub license npm version npm npm downloads GitHub repo size in bytes GitHub last commit GitHub stars GitHub watchers

Codacy Badge Maintainability Package Quality Tests Coverage Status

node-red-contrib-heater-controller

-Requirements for version 3.0.0:
-NodeJS: 16.x Minimum version 12.x
-node-red: 2.0.6 Minimum version 1.x

A dashboard ui interface node for controlling a heater;

Interface

image image

  • 1 - target temperature value. The temperature desired by user;
  • 2 - current temperature
  • 3 - current status of the heater
  • 4 - slider for setting a custom value
  • 5 - current temperature from calendar
  • 6 - next temperature from calendar and the starting hour
  • 7 - warning that current temperature is missing so the controller is not active
  • 8 - if is locked, will keep the target temperature until user intervention; If is unlocked, will keep the target temperature until next calendar change;
  • 9 - reset to calendar

Once a custom value has been set will keep that value until the user is resetting it by double clicking the target value or by sliding it left or right, when the current calendar target value is taken from calendar.

Optimal size -> 8x5

Properties

  • Topic (string) Topic used to trigger the heater
  • Title (string) Display an optional title in front-end
  • Unit (Celsius/Fahrenheit/Kelvin) Display unit
  • Hysteresis Sets the hysteresis threshold
  • Logs>MaxLength Maximum length of logs
  • Min (integer) Minimum value selectable using slider
  • Max (boolean) Maximum value selectable using slider
  • Step (integer) Step value selectable from slider
  • Calendar (json) The calendar which will be apply in automatic mode. Needs to be a valid JSON with float values for temperature. Is important to cover the entire interval of 24/7, otherwise will keep the temperature until next since or next week day For example:

Inputs messages

This controller has one main input and two outputs;

  • First output is used to trigger the heater on or off;
  • Second output is used to get some information about the node (current status, logs or configuration);

The input accepts the following topics:

Topic: status

Triggers an status message on second output(Info) and no message on first output(Heater status) Input example

{
    "topic" : "status"
}

Output on info example

{
  "topic":"status", --same input topic
  "payload":{
    "currentTemp": 10, --current room temperature (ref no.2)
    "targetValue": 20, --current target temperature (ref no.1)
    "isUserCustom": false, --is a current target user temperature considered (ref no.1 and 9)
    "isLocked": false,  --is locked to a custom target value (ref no.8)
    "userTargetValue": 20, --last user target temperature (ref no.1)
    "currentSchedule": { --current schedule from calendar (ref no.5)
      "time": "08:00",
      "day": "Saturday",
      "temp": 20
    },
    "nextSchedule": { --next schedule from calendar (ref no.6)
      "time": "20:00",
      "day": "Saturday",
      "temp": 22
    },
    "currentHeaterStatus": "on", --current heater status (ref no.3)
    "time":"9/4/2021, 1:47:27 PM"
  }
}

Topic: logs

Triggers a message which contains the logs of the latest action. The array length is depending on the Log: Max length from node properties Input example

{
    "topic" : "logs"
}

Output on info example

{
  "topic":"logs",  --same input topic
  "payload":[ --an array with the last actions
    {
      "currentTemp": 10,
      "targetValue": 20,
      "currentSchedule": {
        "time": "08:00",
        "day": "Saturday",
        "temp": 20
      },
      "nextSchedule": {
        "time": "20:00",
        "day": "Saturday",
        "temp": 22
      },
      "currentHeaterStatus": "on", --heater status when the action was triggered (ref no.3)
      "time":"9/4/2021, 1:47:27 PM" --execution time
    }
  ]
}

Topic: config

Triggers a message which contains the current node properties Input example

{
    "topic" : "config"
}

Output on info example

{
  "topic":"config",
  "payload":{
    "title":"Heater",
    "topic":"newHeaterStatus",
    "logLength":1,
    "threshold":0.5,
    "calendar":{
      "Monday":{"00:00":19,"06:20":22,"08:00":19,"16:40":22,"23:59":19},
      "Tuesday":{"00:00":19,"06:20":22,"08:00":19,"16:40":22,"23:59":19},
      "Wednesday":{"00:00":19,"06:20":22,"08:00":19,"16:40":22,"23:59":19},
      "Thursday":{"00:00":19,"06:20":22,"08:00":19,"16:40":22,"23:59":19},
      "Friday":{"00:00":19,"06:20":23,"08:00":19,"16:40":22,"23:59":19},
      "Saturday":{"00:00":19,"08:00":20,"20:00":22,"23:59":19},
      "Sunday":{"00:00":19,"08:00":20,"20:00":22,"23:59":19}
    },
    "unit":"C",
    "displayMode":"buttons",
    "sliderMaxValue":35,
    "sliderMinValue":10,
    "sliderStep":0.5
  }
}

Topic: currentTemp

A message with this topic should come from time to time, containing a payload with an integer or float number (integer or float number); The payload value should represent the current room/boiler temperature; Each time currentTemp message is received the entire logic is executed to decide if is the case to trigger an out put with on or off status for starting the heater.

NOTE: If this message is not received then no logic is executed and the entire control will remain in current state.

{
    "topic" : "currentTemp",
    "payload" : 22.5
}

Topic: userConfig

Can be used to control the node with an input message. Basically almost all actions that user can do from dashboard should be possible with this message. Payload should be an json structure with the following options

  • isLocked (boolean [ true | false ]; interface reference no. 8) If is true will lock the heater to current state until next user intervention (via interface or another message with value false)
{
    "topic" : "userConfig",
    "payload" : {"isLocked": true}
}
  • userTargetValue (number [ integer | float ]; interface reference no. 4) Allows you to set the target value. If the currentTemp value is below userTargetValue, a trigger to start the heater will be emitted; if the currentTemp is bigger than userTargetValue the
{
    "topic" : "userConfig",
    "payload" : {"userTargetValue": 20.0}
}
  • isUserCustom (boolean [ true | false ]; interface reference no. 8) Allows you to set the target value. If the isUserCustom is true then the current target value is preserved until next calendar or user intervention.
{
    "topic" : "userConfig",
    "payload" : {"isUserCustom": true}
}

HeaterStatus output

A message is emitted when the status is recalculated (when the user is changing the target temperature, from interface or with a userConfig message, or a new currentTemp is received)

Example:

{
    "topic" : "newHeaterStatus", //topic set in node properties
    "payload" : "on"
}

Context tab

In context tab for this node two variables are displayed

  • logs containing the current stored logs
  • status current node status

If you find this project useful, please consider supporting it with a donation
Donate