Chapter 12 Indicators and heartbeats

The script ws-indicate is used to indicate the device’s status using the LED(s) on board the Raspberry Pi. The script ws-heartbeat can be used to transmit the device’s status to a user-defined script that could provide logging, or submit the status to an online dashboard.

12.1 Installation of ws-indcate and ws-heartbeat

These tools are installed as part of the node installation process.

12.2 Indicators

Internally ws-inidicate makes repeated calls to pi-pwr to control the LED(s). There are three indicator routines, heartbeat (quick flash of LEDs in order to show device is functioning), countdown (flashes power LED), and record (power LED on, action LED off).

sudo ws-indicate
sudo ws-indicate countdown 5   # counts down from 5
sudo ws-indicate record action # record light is on while action is executed

12.2.1 A note on sudo

Raspberry Pi OS (and previously Raspbian) allows the default user to run sudo without a password. This is not true for other Linux distributions, such as Ubuntu. This could lead to a password prompt when using ws-indicate. As nodes are designed to run autonomously, the installation process for ws-node will configure ws-indicate to not require a sudo password.

12.3 Heartbeat

The script ws-heartbeat is used to send a heartbeat signal to the devices.wildlife.systems server to indicate that the node is alive and connected, as well as to provide some information to assist problem diagnosis. The data sent comes from the onboard sensor readings (sr onboard) and the server stores the node ID, timestamp, CPU and GPU temperatures, and the amount of memory and storage used. The node must be registered with WildlifeSystems for this data to be stored.

The script may be run for debugging purposes at any time as follows.

ws-heartbeat

The script will exit silently on success.