Adding an LED Alert to WavesBlock Full Node Monitor

01 Apr 2018

Whilst I have found the WavesBlock monitor useful for checking on my Full Node (See original WavesBlock post here) And I often give it a quick glance to check everything is fine, sometimes when I'm busy and not paying much attention to it, It would be easy to miss when there's an issue.

I decided to add a small LED to the block that can simply switch on when there's something that needs reviewing, for example, Disk usage high, Server not responding, or even positive alerts like on mining a block.

The feature is divided up into 3 tasks;
- Add an LED to the case and connect it to the NodeMcu
- Modify the server page to return an alert status
- Modify the NodeMcu code to switch on the LED when theres an alert, or connectivity issues

Here's how it turned out, and below I'll describe how to implement it.

Step 1 - Add the LED
I drilled a small hole in the case and glued in an LED, connecting the + pin (The longest pin) to pin 7 on the node MCU, and the ground to GND.

Step 2 - Modify the server code
I modified the server response to contain a boolean flag named 'alert'. Now, it's up to you what you want to alert for here, I opted for High Disk, Mem, CPU, and when the server is not mining. It's easy enough to add to this in future, I initially set it to true, so I can test the LED.