@jmaza_itix/ton-alarm 1.1.4
Alarm monitoring with timer logic
ton-alarm for Node-RED
Overview
ton-Alarm
is a Node-RED node designed to monitor numerical values and trigger alarms when values cross configurable thresholds. It supports:
- Delayed alarm activation via timeout
- Repeat alarm notifications while the condition remains active
- Reset and disable controls
- Dual outputs for synchronous and asynchronous use cases
This node is ideal for use cases like sensor montioring, process condition alarms, and alert systems in industrial or IoT environments.
Features
- Configurable minimum and maximum thresholds
- Timeout before triggering the alarm (debounce/filter)
- Optional repeat interval for alarm reminders
- Synchronous (on every message) and asynchronous (on status change) outputs
- Reset and disable capabilities for smarter control logic
Node Configuration (via editor)
When adding the node in Node-RED, you can configure
minValue
(optional): Minimum thresholdmaxValue
(optional): Maximum thresholdtimeout
(optional): Delay (in seconds) before alarm activates. Defaults to 60 seconds if not providedrepeat
(optional): interval (in seconds) to repeat alarm notifications while active
These settings can be overridden via incoming config messages (see below)
Dynamic Configuration via Message
You can dynamically override node settings by sending a configuration message. This only needs to be sent once, and will persist. You can send it again to modify configuration.
Message properties (all optional):
Property | Type | Description |
---|---|---|
msg.minValue |
number | Minimum threshold |
msg.maxValue |
number | Maximum threshold |
msg.timeout |
number | Time (sec) before alarm is triggered |
msg.repeat |
number | Interval (sec) for repeated alarm notifications |
⚠️ If a property is omitted, it is excluded from alarm calculations (except timeout, which defaults to 60 seconds).
To delete a config value, just assign it a null
like msg.MinValue = null
Input Messages
Payload handling:
msg.payload
: A number or boolean- Booleans are converted to
1
(true) or0
(false).
- Booleans are converted to
msg.payload = "reset"
: Resets alarm state and timersmsg.disable = true
: Disables the alarm logic and forces both outputs to emit a "false" statemsg.disable = false
: Re-enables the alarm based on the last received value.
Disabling the alarm will set lastValue to null. Alarm condition won't be calculated when msg.disable=false
unless a new msg.payload is received
Output Messages
The node emits messages on two outputs:
- First output (synchronous):
- Emitted on every received message
- Useful when periodic or frequent updates are expected
- Second output (asynchronous):
- Emitted only on alarm state change or repeat interval
- Useful for flows that only react to changes (e.g. Telegram, email alerts)
Output message structure:
{
"payload": true,
"idDisabled": false,
"isCondition": true,
"isAlarmL": false,
"isAlarmH": true,
"isSyncMsg": false,
"isRepeating": true,
"lastValue": 105.3,
"minValue": 50,
"maxValue": 100,
"timeout": 10,
"repeat": 30
}
Field | Description |
---|---|
payload |
true or false, indicating whether alarm condition is active |
isDisabled |
Indicates whether the alarm is currently disabled |
isCondition |
Indicates current condition is outside threshold (before timeout applies) |
isAlarmL |
True if value is below minValue |
isAlarmH |
True if value is above maxValue |
isSyncMsg |
True if the message was from the synchronous output |
isRepeating |
True if this message is part of the repeating alarm |
lastValue |
The last received value |
minValue |
Current min threshold |
maxValue |
Current max threshold |
timeout |
Configured timeout in seconds |
repeat |
Configured repeat interval in seconds |
Alarm Disabling Use Case
In some cases, the alarm should be conditionaly disabled. For example, when a device like a cooling chamber is powered off the temperature may rise, but no alarm should be triggered.
- Send
msg.disable = true
to temporarily disable the alarm Both outputs will emit a message withpayload = false
andisDisabled = true
- Send
msg.disable = false
to re-enable alarm checks
License
This project is licensed under the MIT License. See the full license in the source code.