Appendix M Tips and Tricks useful for Genmon - jgyates/genmon GitHub Wiki

Tip and Tricks

This is a collection of miscellaneous tips and tricks that may be useful when using the Generator Monitor.

Extending the life of your SD card

Using a raspberry pi as an always connected monitoring device can be tough on your SD card as the linux kernel and installed apps are continuously updating the system logs. One way to prolong your SD card is to use the application log2ram. This program will create a RAM based disk for the /var/log/ directory. This RAM disk is periodically flushed to your SD card. This reduces the number of writes to the SD card which extends the life of the Flash memory on the card.

This page describes how to install log2ram.

Setting up your Raspberry Pi without a monitor or keyboard (Headless)

If you have a good knowledge of networking and a knowledge of using the linux command line, you can setup your Raspberry Pi without using a monitor or keyboard. In a normal install you would initially use a keyboard and mouse to get the system up and running. This article describes how to setup a headless install.

Setting up a script to check the wifi connection and reconnect if needed

There are several examples of this on the web. This link contains a linux script that will check if the wifi on the pi is connected and reconnect if needed. This script is run from the pi. Typically you would set this up as a cron job that would run periodically (e.g. every 5 minutes). If the script detected the wifi was not connected it would attempt to reconnect. This thread has additional information on this topic. This thread as an alternate approach that some are using.

Perform a backup on your genmon settings

On the About page of the web interface there is a mechanism to backup your genmon settings and data files. This would come in handy if your Pi died for any reason.

Optical Isolation for longer RS-232 lengths

This thread has info on using an optically isolated RS-232 link to resolved some RS-232 issue with the Evolution controller. Also, this wiki article has info on the topic.

Restoring settings from a Backup

The following assumes you are using the default settings (i.e. your config files are stored in the /etc/genmon folder on the pi:

First take the file that you downloaded from the web interface and transfer it to your pi. You can do this in a few different steps but I like to use the scp program. This command will copy the file genmon_backup.tar.gz to the /home/pi folder on a pi at IP address 192.168.1.10

 scp genmon_backup.tar.gz [email protected]:./

Then log into the pi with ssh. You should log into the /home/pi directory if you log as the pi user. Once you are logged in type:

 tar -xzf genmon_backup.tar.gz

This will unpack the archive file into a folder named genmon_backup. The contents of this folder should be copied to the /etc/genmon folder. You will need root privileges (sudo) since you are copying to the /etc/ folder.

 sudo cp ./genmon_backup/*.* /etc/genmon

Then restart genmon:

 cd genmon
 ./startgenmon.sh restart

or reboot

 sudo reboot

The backup includes the power log, outage log, service journal, and all config files. If you only want the config files you can on copy the *.conf files.

sudo cp ./genmon_backup/*.conf /etc/genmon

Configuring USB WiFi on a Raspberry Pi

This section gives details on how to use external USB Wifi device so you can use an external antenna.

The test platform is a preloaded Raspberry PI 3A+ with Hat from Pintsize.me. The Pi was already configured using the internal wifi and working fine. (This is typically the point where you realize you need an external antenna). A Mideatek RT5370N Wireless-N USB Adapter from Amazon was used as other posts referred to it as already working on this model. The internal wifi by default comes up as WLAN0. Plug in the external and it comes up as WLAN1.

There are multiple articles on the web, but none seems to exactly fit the use case here - too complex.

Here's the simple solution: Disable the built-in WiFi. By doing this, the USB Wifi will come up as WLAN0, and no other WLAN interfaces will be active. You will not have to change any other settings, as they are already set up for WLAN0.

STEPS: You can open a terminal, connect via SSH, or edit the file directly on the SD card from your computer Open the config.txt file with nano:

sudo nano /boot/config.txt

Find the following line:

 # Additional overlays and parameters are documented /boot/overlays/README

And add these two lines under it:

 dtoverlay=disable-wifi
 dtoverlay=disable-bt

(The second line is to disable the Bluetooth module) Save and exit (CTRL+O, CTRL+X) Power off the Pi, insert the USB Wifi and power up the Pi.

Note: If you've reserved an IP address already for your PI, the will not be working as the MAC address has changed. It should get a new address from DHCP. You'll need to make a new IP address reservation for the new MAC.

Access the Dealer Menu

For Evolution Controllers, some functions, like resetting the maintenance timers can only be done by accessing the the dealer menu. To access Dealer Menu on the Evolution controller, from the top menu selection (SYSTEM, DATE/TIME,BATTERY, SUB-MENUS) enter (for air cooled models) UP UP ESC DOWN UP ESC UP, then go to the dealer menu and press enter. For liquid cooled models a level 2 dealer code can be entered, ESC UP UP DOWN DOWN ESC ESC, then navigate to the dealer menu and press enter. Passcode for Nexus controller is ESC, UP, UP ESC, DOWN, UP, ESC, UP, UP, ENTER.

Updating your pi system software

As with most open source software, it is a good practice to update the system software. To update the system software on your pi type the following form the console:

 sudo apt-get update
 sudo apt-get upgrade

If you want to also update the system kernel then instead of "upgrade" use "dist-upgrade":

 sudo apt-get update
 sudo apt-get dist-upgrade

Depending on the modules that are upgraded, you may need to restart your pi. To restart your pi type:

 sudo reboot reboot

Pi Locator

This website can be used to locate sites that have raspberry pis in stock.

Setup Gmail for use with Genmon

Thanks to @mac1-131 for the following info. A discussion thread on other email server settings can be found here.

Outbound Emails from Genmon

  1. Sign-in to the Google account you want to use on a PC browser
  2. Select your account picture and click on Manage you Google Account
  3. Click the Security tab, then scroll down and click on 2-Step Verification
  4. Turn it on if it is not already on (no way around this, if you really can't use MFA then stop here)
  5. Scroll down to the bottom and click on App passwords
  6. Select an app (Other is good) and give it a name (Genmon is good, or gmail SMTP is good, you can use this password for all IoT devices that need to send emails, not just Genmon)
  7. Click on Generate and copy the password to your clipboard, or write it down (even though it tells you not to write it down, do it anyway, you will need to put it in your Genmon Settings
  8. Log into Genmon and click on the Settings link
  9. Scroll down to Outbound Email Settings and turn it on
  10. Enter the email account you are using, the one you generated the application password in
  11. Enter the application password you generated in your Google account settings
  12. Sender address can be [email protected] or you can put in your email if you want, if you have trouble getting emails delivered to your inbox directly, try putting your email address as the sender
  13. Sender name can be whatever you want, Genmon is fine
  14. SMTP server is smpt.gmail.com
  15. Leave port at 587
  16. Click the Test Email Settings button, you should receive a test email
  17. Click the Save link at the bottom of the page, Genmon will restart and you should get an email in a couple minutes saying that Genmon was started

Setting up Inbound Emails to Send Generator Commands

  1. In Genmon Settings, just turn it on and imap.gmail.com is fine, and the default folders are fine
  2. You must create those folders in the Gmail account yourself, and create a filter to move received emails to that folder. Be advised Gmail now calls folders "Labels" so your are actually working with Labels in Gmail
  3. Go to Gmail for that account, and on the left side click the + next to Labels
  4. Create a Label called Generator and do not nest it under any other labels. By default, IMAP access for this folder will be on
  5. Click the + again, and create another label, nest it under Generator, and call it Processed
  6. Now you need a filter to move any received emails to the Generator folder. Click the Settings wheel at the top right of your Gmail, and click on See all settings
  7. Click the Filters and Blocked Addresses tab
  8. Scroll down and click the Create a new filter link
  9. In the Subject line, enter generator: and click Create filter
  10. Under When a message is an exact match, check the Apply the label box and click the drop-down arrow and select Generator
  11. Click the blue Create filter button
  12. Send a test email from any email address to your Gmail email address you set this up on with generator: status in the subject line and you should get a response. The email does not need any text, just the subject line
  13. You can now use the rest of the commands as shown in the wiki, or send generator: help for a list of commands