Best way to create an alarm state

I currently have a Node-Red flow that checks path values, then sends a message to the next node, which is a notification node. Example:
const app = global.get('app')
const voltagePath = app.getSelfPath('electrical.batteries.288-second.voltage')

if (voltagePath.value < 13.2){
return {
payload: {
alarm: 'Start voltage is too low!',
value: voltagePath.value,
unit: 'V'
}
};
}
const app = global.get('app')
const voltagePath = app.getSelfPath('electrical.batteries.288-second.voltage')

if (voltagePath.value < 13.2){
return {
payload: {
alarm: 'Start voltage is too low!',
value: voltagePath.value,
unit: 'V'
}
};
}
The notification node already has a static message field. I would prefer to have the message be dynamic which indicates the value when alarm state is triggered. How do other people do this. Instead of using notification nodes, should I just create a notification path and payload, then let the plugins handle the actual alarm state?
No description
No description
1 Reply
Scott Bender
Scott Bender4w ago
you can send state to it it will use that instead of what's in the config

Did you find this page helpful?