smithtek-nodered-control 1.2.0

SmithTek Node-RED Control Nodes

npm install smithtek-nodered-control

smithtek-nodered-control

SmithTek Control

Installation

Install the smithtek-nodered-control using the NodeRED palette manager.

Usage

The smithtek-nodered-control node is designed for controlling pump systems based on tank levels, digital true/false signals, and remote control commands. The node supports flexible control modes, including local level-based control and remote override commands via the global context. It is commonly used alongside the Smithtek cloud platform.

The node has two operation modes: Fill and Empty.

In Fill mode, the start setpoint is a low value and the stop setpoint is a high value. In Empty mode, the start setpoint is a high value and the stop setpoint is a low value.

This numeric setpoint logic allows the node to be used for filling tanks, emptying tanks, or controlling sewage and wastewater pits using analogue level signals.

In addition to numeric level control, the node also supports digital true/false inputs, typically from devices such as level switches, float switches, or cam switches. When the incoming value for the configured level key is a boolean (true or false), the node automatically switches to digital control mode. In this mode, the boolean value is passed directly through to the output, allowing simple on/off control without the need for start and stop setpoints. Numeric values (0 and 1) are intentionally not treated as digital inputs to avoid interfering with existing level-based control logic.

Control mode commands and setpoint values are typically provided by the Smithtek input nodes. The Smithtek cloud publishes these values to the Node-RED runtime, and operators can design dashboards to remotely adjust modes and setpoints. This node also prevents unwanted behaviour where last-known cloud values are re-published to the PassPort on every deployment or restart, allowing local control logic to remain stable and predictable.

SmithTek Control

Setup smithtek-nodered-control

  1. Drag and drop the node into your Node-RED flow.
  2. Configure the control mode, start level, stop level, and level key in the node properties.
  3. Set the appropriate global context values for start and stop levels.

The node operates in two modes:

  • Local Control Mode (0): Controls the pump based on tank levels by comparing them to the start and stop levels.
  • Remote Start Mode (1): Remotely starts the pump, overriding the local tank levels.
  • Remote Stop Mode (2): Remotely stops the pump, overriding the local tank levels.

Configuration Properties

  • Control Mode Key: Global context key used to determine the control mode (0, 1, or 2).
  • Start Setpoint Key: Global context key for the start level setpoint (used when filling or emptying the tank).
  • Stop Setpoint Key: Global context key for the stop level setpoint.
  • Level Key: The key from the incoming message payload that contains the tank level.
  • Max Level: The maximum allowable tank level to prevent overfilling or over-emptied tanks.
  • Operation Mode: Choose between "fill" (fill the tank) or "empty" (empty the tank).

Control Modes

  1. Local Control (Control Mode 0):

    • In this mode, the node monitors the tank level (from msg.payload.level) and compares it to the configured startLevel and stopLevel.
    • The pump will start when the level is below the startLevel and stop when the level exceeds the stopLevel.
  2. Remote Start (Control Mode 1):

    • This mode bypasses local level monitoring and immediately sends a signal to start the pump (payload: true).
  3. Remote Stop (Control Mode 2):

    • This mode bypasses local level monitoring and immediately sends a signal to stop the pump (payload: false).

Auto Digital mode

The control node supports a digital control mode when the incoming value for the configured Level Key is a boolean. The incoming message must contain a true or false value using the same JSON key name that is configured in the node properties. When a boolean value is detected, the node automatically switches to digital mode and passes the true or false value directly to the output.

Digital mode only operates in local control mode. If a remote start or remote stop command is active, the digital input is ignored and the remote command takes priority. All other control modes continue to operate normally.

Only literal boolean values are supported for digital mode. Numeric values such as 0 and 1 are intentionally not treated as digital inputs to avoid interfering with existing level-based control logic

SmithTek Control

Example

[{"id":"4bb597c9fa7b1231","type":"smithtek-control","z":"f6e4dcac415570da","name":"Control Node","controlModeKey":"control","startLevelKey":"start","stopLevelKey":"stop","levelKey":"level","maxLevel":3000,"operationMode":"empty","x":470,"y":440,"wires":[["9b16fb2444aa04f6"]]},{"id":"9b16fb2444aa04f6","type":"debug","z":"f6e4dcac415570da","name":"debug 20","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":660,"y":440,"wires":[]},{"id":"0aebbab7ec14e698","type":"inject","z":"f6e4dcac415570da","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"0","payloadType":"num","x":270,"y":560,"wires":[["e643a806a258a861"]]},{"id":"feed64ed2f0e512d","type":"inject","z":"f6e4dcac415570da","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"1","payloadType":"num","x":270,"y":600,"wires":[["e643a806a258a861"]]},{"id":"3a695937bd7dc934","type":"inject","z":"f6e4dcac415570da","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"2","payloadType":"num","x":270,"y":640,"wires":[["e643a806a258a861"]]},{"id":"34d04ccce7337b8f","type":"inject","z":"f6e4dcac415570da","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"150","payloadType":"num","x":270,"y":720,"wires":[["2b1adde1d9e1a8bd"]]},{"id":"69804e5c23f69846","type":"inject","z":"f6e4dcac415570da","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"101","payloadType":"num","x":270,"y":780,"wires":[["2b6d2bdfc33d06c6"]]},{"id":"c2a7e8dab4b6b65b","type":"inject","z":"f6e4dcac415570da","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{"level":10}","payloadType":"json","x":260,"y":460,"wires":[["4bb597c9fa7b1231"]]},{"id":"a464f742719e8be7","type":"inject","z":"f6e4dcac415570da","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{"level":200}","payloadType":"json","x":250,"y":400,"wires":[["4bb597c9fa7b1231"]]},{"id":"e643a806a258a861","type":"smithtek-nodered-control-sp","z":"f6e4dcac415570da","name":"Control Mode","globalKey":"control","x":480,"y":600,"wires":[[]]},{"id":"2b1adde1d9e1a8bd","type":"smithtek-nodered-control-sp","z":"f6e4dcac415570da","name":"start setpoint","globalKey":"start","x":470,"y":720,"wires":[[]]},{"id":"2b6d2bdfc33d06c6","type":"smithtek-nodered-control-sp","z":"f6e4dcac415570da","name":"stop setpoint","globalKey":"stop","x":470,"y":780,"wires":[[]]}]

License

Copyright (c) 2023 www.smithtek.com.au
Licensed under the terms of the GPLv3

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"... [The rest of your license text]

Acknowledgements

Special thanks to:

  • Nick O'Leary and Dave Conway-Jones for their invaluable contributions to the Node-Red community.

Contact: [email protected]
Website: www.smithtek.com.au

Node Info

Version: 1.2.0
Updated 2 weeks ago
License: GPL-3.0
Rating: 5.0 1

Categories

Actions

Rate:

Downloads

99 in the last week

Nodes

  • smithtek-control
  • smithtek-nodered-control-sp

Keywords

  • node-red
  • smithtek
  • control
  • global
  • context

Maintainers