/Nebra-Helium-Watchdog

Keep an eye of your Helium Nebra miner

Primary LanguageJavaScript

Nebra-Helium-Watchdog

If watchdog is useful for you, feel free to dip some HNT.
image
14faPbrrcdhNSG2EXiGuox4qkfcWNJmHmYYeSA8s8MvYcAeSxEE

This document describes how to keep an eye of your Nebra miner.
Basically it uses hardware (I used Raspberri Pi 3 model B) and operating system where you can run nodejs (You can run it on windows machine also but it needs to be on site 24/7 and running. Video how to use that with PC is here: https://youtu.be/H8iyiYbm3oQ ). Program checks cyclically if miner UI works and takes data from your miner to analyze if everything is okay. Notification is done via Telegram app (IOS and Android).
Here is example:
image

You will get four type of notifications:

  1. Miner watchdog is activated. That means check service is started.
  2. Miner block heigh is back more than X blocks. You can change it by yourself.
  3. Miner firmware was updated.
  4. Miner local UI is not responding. I usually wait 10-15 minutes and if miner status is not changed back to normal, I’ll do physical restart. This usually solves the problem. By default program checks miner UI every 3 minutes.

Telegram


Create a bot using BotFather. Here is video link how to do that: https://youtu.be/XoryoE9V88E?t=104
Create a new group and add bot to your group. Take a group id from browser:

image


Test if bot is working with this command:

https://api.telegram.org/bot<BOT_TOKEN_HERE>/sendMessage?chat_id=<CHAT_ID_HERE>&text=Testing_bot

Change these values <BOT_TOKEN_HERE> and <CHAT_ID_HERE> in link and paste it in your browser. Hit ENTER. If you get the message in Telegram you are done in here and can go to change app.js file with notepad or notepad++.

Code, modifications and installation


You need to change these lines:

image

I’m using latest nodejs v16.8.0 and it works fine.
Check this manual if you need step by step tutorial how to setup raspberry pi: https://thisdavej.com/beginners-guide-to-installing-node-js-on-a-raspberry-pi/
When node is installed, copy app.js file to raspberry and run it (node app.js). There is a lot tutorials how to do that. www.google.com is your best friend.
We want that code will execute automatically after raspberry pi restart or power failure. I used PM2.
Here are the commands (link to help: https://stackoverflow.com/questions/13385029/automatically-start-forever-node-on-system-restart)

sudo npm install pm2 -g --installs pm2
pm2 start app.js --starts application (make sure you are in same directory with app.js file)
pm2 list --shows your running application
pm2 startup --creates running service to your startup service

After that you will see pm2 asking to manually run a command, copy and run that.
pm2 save --saves that process and executes that app.js process when startup.

If you want to stop application then use:
pm2 stop all --stops all applications (we have only one so you can use that command)