Detailed Summary of SignalK Alarm Management with Node-RED
This project describes how to manage and display alarms generated by the SignalK system in a nautical environment, using Node-RED as the central platform for processing notifications. The solution includes visualization on an old Android tablet and sound alerts for critical alarms.
1. System Objective
The main objective is:
- Receive notifications from SignalK.
- Process them to determine their severity (normal, warning, alarm, emergency).
- Display them on a graphical interface on an Android tablet.
- Emit specific sounds based on the type of alarm.
- Allow the user to mark notifications as "read" or "resolved."
2. Main Components
2.1. Hardware
- Android Tablet: Used as a user interface to display notifications and allow interaction.
- Raspberry Pi (optional): Can be the device running Node-RED if no remote server is used.
2.2. Software
- SignalK: Monitoring system used to generate and send notifications based on boat data (voltage, temperature, etc.).
- Node-RED: Visual programming platform for processing and managing notifications.
- Node-RED Dashboard 2.0: For creating interactive graphical interfaces.
- Plugin PlaySound: To play audio files as alerts.
- Festival TTS: To read messages aloud (if installed on the system).
3. Workflow
3.1. Notification Reception
signalk-notification Node:
- This node receives all notifications generated by SignalK.
- Notifications can have different states: normal, alert, warn, alarm, emergency.
Subflow Manage Notification Array:
- This subflow manages a global array (
flow.matrizNotificaciones
) where active notifications are stored.
- If a notification already exists in the array, it is updated. If it is new, it is added.
- If a notification changes to a normal state, it is removed from the array.
3.2. Notification Processing
3.2.1. State Filtering
A switch
node filters notifications based on their state:
- Non-normal state: Processed to emit sounds and display them on the interface.
- Normal state: Only updated in the notification list and removed from the array.
3.2.2. Sound Emission
The subflow Emit Appropriate Sound or Stop handles sound playback based on the type of alarm:
- Alert: Plays a soft sound.
- Warning: Plays a moderate sound.
- Alarm: Plays a loud sound.
- Emergency: Plays a critical sound.
- Stop: Stops all active sounds.
3.2.3. Voice Reading
An exec
node uses the command festival --tts
to read the notification message aloud.
This ensures the operator stays informed even if they are not looking at the screen.
3.3. Visualization on the Tablet
3.3.1. Notification Table
A ui-table
node displays a list of up to 25 recent notifications.
Each row includes:
- Path: Unique identifier for the notification.
- Description: Message associated with the notification.
- Status: Visual indicator showing whether the notification has been read.
3.3.2. Pop-Up Notifications
A ui-notification
node displays pop-up notifications when a new alarm arrives.
The user can interact with these notifications:
- Button "Received": Confirms the notification has been seen.
- Button "Resolved": Changes the notification status to normal and removes it from the array.
3.4. Updating Status in SignalK
When the user marks a notification as "read" or "resolved":
- A signal is sent to the
signalk-send-notification
node to update the status in SignalK.
- The notification is removed from the global array (
flow.matrizNotificaciones
).
4. Detailed Implementation
4.1. Initial Setup
Install Node-RED:
- Ensure Node-RED is installed on your Raspberry Pi or server.
- Install necessary packages:
node-red-dashboard
, node-red-contrib-play-sound
, etc.
Configure SignalK:
- Set up SignalK to generate notifications based on your sensors (e.g., average battery voltage).
Prepare the Tablet:
- Install the Node-RED Dashboard app on the Android tablet.
- Connect the tablet to the same WiFi network as the Node-RED server.
4.2. Node-RED Flow
4.2.1. signalk-notification Node
- Configure this node to receive all notifications from SignalK.
- Define rules to filter specific notifications if needed.
4.2.2. Subflow Manage Notification Array
- Create a subflow to manage the global notification array.
- Use
function
nodes to:
- Create or update the array.
- Remove resolved notifications.
4.2.3. Subflow Emit Appropriate Sound or Stop
- Create a subflow to play sounds based on the type of alarm.
- Use
PlaySound
nodes to load specific audio files.
4.2.4. ui-table Node
- Configure this node to display the notification table.
- Customize columns to show relevant information (path, description, status).
4.2.5. ui-notification Node
- Configure this node to display pop-up notifications.
- Add buttons for user interaction:
- "Received": Confirms the notification.
- "Resolved": Resolves the notification.
4.2.6. exec Node
- Configure this node to use
festival --tts
and read messages aloud.
- Ensure the system has Festival installed and configured with Spanish support.
4.3. Optimization
Debounce for Repetitions:
- Implement a debounce mechanism to avoid annoying repeated alarms.
- Allow normal-state notifications to pass through without applying debounce.
Automatic Cleanup:
- Schedule automatic removal of old entries from the global array to keep it clean.
5. Expected Results
- Clear Visualization: All notifications are displayed on an intuitive interface on the tablet.
- Custom Sounds: Each alarm type has a specific sound for easy identification.
- Simple Interaction: Users can mark notifications as read or resolved with a single click.
- Real-Time Updates: Notifications are automatically updated in SignalK and on the tablet interface.
6. Conclusions
This system provides a robust and customizable solution for managing alarms in a nautical environment. By combining SignalK with Node-RED, a seamless integration between sensors, notifications, and user interfaces is achieved. Using an old Android tablet as the interface adds value to the project by repurposing a device that would otherwise be inactive.