WØZI

DX Watchdog

Script that Will Text your Phone with QSO Alerts

I live in an HOA area and the restrictions cause me to use a multi-band dipole in my attic. I never thought I would be able to make QSOs to other parts of the world. I could barely make a phone contact to the other side of my country. When I started using WSJT-X, I was ecstatic to discover that I could reach other parts of the world. It seems like I would tell my wife that I will probably never get Australia and then shortly after, I would get Australia.

I now believed that I had a chance of winning some awards. I got LoTW setup and would do manual uploads at the end of the day. I kept track of my QSOs on a spreadsheet. Trying to chase states for the WAS award and countries for the DXCC award became a speedreading task. While WSJT-X has some capability to help sort this out for you, it wasn’t quite good enough. I went looking for an application that would do this work for me. Sometime later, I was using GridTracker to filter all the calls on WSJT-X. GridTracker does an excellent job doing this using the Callable Roster menu option. Callable Roster has a powerful set of filtering options that can be tailored for most awards. I didn’t want just any DX call; I wanted QSOs from operators that also upload to LoTW. Rather than chasing paper QSLs, getting QSO’s confirmed on LoTW seems to be an easier path to the DXCC award.

DX Watchdog - Gridtrackers Callable Roster screen

I continued to get DX QSLs on a regular basis until I hit somewhere between 60 – 70 DX QSLs. It seemed like I hit a wall. Days would go by before I would get a new DXCC, then it seemed like weeks. I knew there were probably new DX calls occurring when I wasn’t at my radio, but I couldn’t stay at my radio all the time. This is not a new idea, but if I could get my computer to text me whenever I had a DXCC hit, I could do other things around the house. When I initially thought of this, GridTracker did not have this capability. I sent an email to Stephen Loomis, the author of GridTracker, recommending this capability. Not too much later, Stephen added an interface so that users could write their own script. I had hoped that Stephen would have added the whole texting function, but he said writing the script was on the user. I decided to take that challenge. I am not a software coder, but after a conversation with my son, I decided to learn enough Python to write a script that would text my cell phone with alerts. After auditing a couple Python courses from Coursera and finding the needed library modules on the realpython.com site, I was able to write the script.

Operational Description

When GridTracker’s script function is enabled and callable roster gets a new hit, it writes a cr-alert.json file with all the information about the calls in the current WSJT-X time period and executes the cr-alert.bat file. The cr-alert.bat file initiates the Python script. The job of the script is to scan the json file and pull out the pertinent information about the hit, construct a message and send that message as a text to your cell phone.

There is more than one way to get a script to send a text message to your cell phone. There are online services that allow you to send text messages directly. The one I saw had a small service charge. The approach I decided to take has no service charges. The txt message is sent via an email message to your cell phone carrier’s SMS Gateway. The SMS gateway is a server that sends text messages to your cell phone.

The Python script should work with any OS listed in the system requirements as long as you download and install the correct Python interpreter for that OS. This article was written using the software on a Window 10 system, but everything should be similar for Mac. I will leave it to the non-Windows users to deal with any differences.

System Requirements

  • OS: Windows, Mac OS X
  • WSJT-X: Latest Version
  • Grid Tracker: Latest Version
  • Python Interpreter: The appropriate version for your OS.

A Note About Linux

GridTracker makes versions that work with certain versions of Linux. If you are running GridTracker over Linux, you may already have Python installed. If not, do a search to see if you can find a compatible Python package to install. If you are able to install a version of Python 3.0 or later, this script should work.

Preliminaries

Before setting up the script to work with GridTracker, you will need to do some preliminaries. Since I took the email to SMS approach, you will need to get a proper email address for you cell phone. You will also need to setup a special email account, just for the text messages. I will explain why you need a special email account a little later.

Configure and Test GridTracker

At this stage if you don’t already have GridTracker installed or don’t have the latest version, then download the software and the documentation from the GridTracker site. Follow the instructions on how to install and configure it. The most important part of the configuration is to get it communicating with WSJT-X and setup automatic logging to your logging websites.

In order to enable the script calling function, you will have to create a cr-alert.bat file and place it in the C:\Users\username\Documents\GridTracker\scripts folder. Replace "username" with your username on your computer. You can create the cr-alert.bat file with notepad or any text editor. Start by creating a new text file. It will have “txt” filename extension. Rename the text file as cr-alert.bat. When you want to edit this file in the future, you can right click on it and select edit. An empty batch file will do nothing when it is called. Any easy way to test if GridTracker is properly calling the batch file is to put the statement "notepad.exe" in the batch file. Open up WSJT-X and GridTracker on your computer.

DX Watchdog - GridTracker call roster buttonOpen up Call Roster by selecting the Call Roster button on the main menu. Make sure the script button is enabled by clicking on it, if necessary. The script button is located on the top left side of the callable roster window, under the hunting option. Select some items from the “Wanted” box until you start getting hits. When a hit occurs, it will be reverse highlighted as shown in the figure at the beginning of this article. If notepad starts popping up on your screen, GridTracker is properly calling the cr-alert.bat file. You can stop notepad from popping up, by clicking on the “Script Enabled: button or pushing the minus (-) key at the top of your keyboard. The minus key on the number pad won’t work.

DX Watchdog - GridTracker disable RealtimeIf you are getting hits on Call Roster and Notepad is not popping up on you screen, make sure Call Roster Realtime mode is disabled. The script calling function does not work in realtime mode. This can be checked by right-clicking on the Call Roster screen. In the popup window “Realtime” should be unchecked.

If the script calling function is not disabled, disable it now. Edit the cr-alert.bat file and remove the "notepad.exe" line. Save and close the batch file. Later, after you have made changes to the script, you will enter the Python script name into the cr-alert.bat batch file.

Determine Cell Phone Email Address

You can send a text message to your cell phone by sending an email to the proper email address. The email address is in the form of 8185551212@vtext.com. 818 is the area code and 5551212 is sample cell phone number. In this example vtext.com is Verizon’s server address. If you don’t use Verizon as your carrier, it will be different. You can look up the correct address for your carrier at https://freesmsgateway.info/. There are other sites that do the same thing, just google SMS gateway lookup. In this example, type in your area code and cell phone number into the “Phone:” box.

DX Watchdog - Free SMS Gateway Lookup Service

It will offer an SMS gateway address and an MMS gateway address. You’ll need to test them, because they may both not work. You can find out if it works, by sending a test email to each address. Just use your normal email program to send the test email. Send an email to each address, one at a time. The address that sends a text to your cell phone is the one that works. Write down that address, you will need it later.

Set Up a Special Gmail Account

There are a couple reasons why it is better to set up a special gmail account for using with DX watchdog. The first reason is that you don’t want to clutter up your normal email box with all the alert messages. If you clean out all the alert messages from the sent box, it is so much easier to select all and delete, rather than having to sort which you will want to keep and which needs to be trashed. The second reason is that in order for this script to work, you will need to lower the security level of the account so the mail server will accept messages from the script. You don’t want your normal email account to be downgraded in security.

When I tested this on my regular email server, I could never get it to work. Most likely because of the security level of the account and I had no way of lowering it. Nor would I want to. When I created a special gmail account and adjusted the security setting, it worked. I recommend that you take the same approach.

  • Start by Creating a new Google account. Suggest you use a unique username, so that you can identify easily that the text message is coming from the script. Write down the account username (email address) and password.
  • Change the security settings. When logging in, make sure you are logging into the text message account. Enable the “Less secure app access”. It will warn you that there are security issues. This has to be enabled or the script won’t work.
  • If you feel that you need to make this account more secure, read the Google documentation on how to modify the Python script to gain access credentials. Since this is a dedicated account, I was not concerned about the security level.
DX Watchdog - Gmail less secure app access

Install the Python Interpreter

Download and install the Python interpreter at https://www.python.org/. Place cursor over the downloads tab and select your Operating System. If you are running the 64-bit version of Windows, click on “Windows” on the left side and it will take you to another page where you can select the 64-bit version. Download the appropriate file and install it on the computer where you plan to run GridTracker and DX WatchDog. The Windows’ installation is very straight forward. If you need help, there is a step by step guide on how to install Python on the Real Python Website. Be sure to check the box that says add Python to the Path.

DX Watchdog - Python download screen

DX Watchdog - List of available Python releases

Python Script

Download the script from w0zi.com. Unzip the DX_WatchDog.zip file. You will need to modify the script by adding the information you collected during the preliminaries section of this article. Be careful when editing the script. In a Python script indentation is important to the correct operation of the script. If you change it, the script may no longer work. The script can be edited with notepad, but it would be better to use the file editor that came with the Python IDLE. The Python file editor will help you keep the syntax correct.

The Python editor can be opened by starting the Python IDLE from the start menu, then select File > Open and select the DX_WatchDog.py file. Alternatively, you can right click on the script file and select “Edit with IDLE”. Go down to the section called #Variable Assignments. It will look like the figure below.

DX Watchdog - Python script variable assignments

Except for the server, change the items in green text to the information you gathered in the preliminaries. Retain the single quotes around each string. The server is the correct one for the special gmail account and does not need to be changed. If you chose not to use gmail, you will have to change the entry for “server” and port to your ISP’s SMTP server. As I said previously, it may not work if you use a different email service. When you are done editing, the new text should still be green. If it isn’t you probably lost a quote mark. Save the script and move the script to your C:\Users\username\Documents\GridTracker\scripts folder.

Test the Script

Earlier, when you tested the GridTracker to script function, GridTracker should have created a cr-alert.json file. Check to see that it is in the C:\Users\username\Documents\GridTracker\scripts folder. If it is not there, go back and run the GridTracker test as described earlier in this article.

With the json file in the same folder as the script, you can test the script by just double clicking on the DX_WatchDog.py file. A command windows will pop-up for a second or two. Don’t expect to see anything in the window. A few second later you should get a text message on your cell phone that you got a GridTracker Alert. I have found that sometimes it takes a little more time for the text message to make it to your cell phone. This is probably during peak traffic times. If you don’t get a message right away, give it a little time before you double click on the script again.

An alternate way to test the script is to run it from the Python IDLE. This could give you some visibility if something happened that could have broken the script. Right click on the script and select “Edit with IDLE”. From the editor, select “Run > Run Module”. If the Python code got broken, it will give you an error message.

Edit Batch File

You are at the last step. Close down GridTracker. Open up cr-alert.bat for editing. It should be empty at this point. If not delete anything in the file. Now add the following line to the batch file.

start /min DX_WatchDog.py

The “start /min” will minimize the command window when it executes. I found it irritating to have the command window pop up on the screen every time there was a hit.

Operating DX Watch Dog with Call Roster

The intent of the script is to text you when you are chasing rare calls. If you are just beginning and you get hits every few minutes, I would not recommend that you use this. You cell phone will be machine-gunning messages to you.

Start by setting up callable roster. The filtering controls are on the top of the window. The “Exceptions” on the right-side act as gateway filters. Calls will not show up in callable roster unless all conditions that are checked have been met. In this case I checked “Uses LoTW”. This means it will only show calls in callable roster of operators that use LoTW. The “Wanted” box defines hits. In the example, DXCC, CQ Zone, ITU Zone and QRZ are selected. Call Roster will identify any new DX, CQ zone and ITU zone calls, highlight them and trigger a hit. QRZ is selected to let you know when someone is calling you.

DX Watchdog - GridTracker callable roster filter controls

DX Watchdog - text message screenThe green boxes on the left side of the screen are used for more filtering. These can help you tailor the filtering for specific awards or endorsements. For example, the DXCC award has endorsements for specific bands. If I was trying to get an endorsement for 40m band, I would change the Reference to say “Current Band, Any Mode” when I was operating on 40m. Since at the time I was working on the DXCC mixed, I leave it at “Any Band, Any Mode” meaning it doesn’t filter by band or mode.

I leave the Callsigns box on “All Traffic”. There are other choices that will reduce the list. I don’t need to use it because GridTracker will draw a line through any callsign that has been worked before. I sometimes like to analyze what other hams are doing. If you don’t like seeing all the traffic, you can select a different option. The Hunting box I leave it on “New+Unconfirmed” because I may have had a QSO with a certain country, but until it is confirmed, it doesn’t count for an award.

Once you have are the filters set, you can enable the script calling function by clicking on the “Script Disabled” button. The button will toggle the script calling function off and on each time you click on the button.

Modifying the Script

If you would like to modify the script, I encourage you to do what I did and learn Python and explore the possibilities. If you are wondering, if it will work with JTAlert, it probably will. JTAlert passes the message information into system environment variables. If you care about having the text message tell you who is calling, then you will have to modify the script to read the environment variables. Then you can use JTAlert’s user defined alert to call the script. I did not try it because I prefer using GridTracker.

References