Remote DXalert and cqrlog

1 post / 0 new
oh1kh
Remote DXalert and cqrlog

Hi!

During nice summer days it would be fun to spent days in garden, not by waiting a certain spot from DX cluster.
One solution could be remote alerting.

It can be done with your smartphone and application "Telegram" messenger. For those who have never heard about that before, like I myself was a while ago, it is a "WhatsApp" like messenger.

Install Telegram to your smartphone and create account. You can install it to your computers as well.
See: GooglePlay or AppStore for your smartphone and for your Linux https://desktop.telegram.org .

And maybe you can also then join to cqrlog Telegram community at https://t.me/cqrlog although it is not needed for remote alarms with cqrlog.

Once Telegram is installed and tested you can start remote alert creation.

First you have to make a new telegram account that you can "chat" with, they call them "bot"s. It is done this way:

Step 1: Set up your bot. All Telegram bots have global visibility. ...

open a chat with @BotFather . It is a robot that helps you to create your own bot. At the start of chat BotFather sends a message with available commands.
Send /newbot as first command. Then a name for bot will be asked. It is best to use your callsign as the first part of the name.
Send domething like: AB1CDE_DX
Then user name for bot is asked. It must have "bot" at the end.
Send something like: ab1cde_dx_bot
Then you will receive an API key. Save it for future use.

Step 2: Get your chat id.
To get your chat id you will need to start a chat with robot called @idbot
Send command: /getid
You will receive an ID number. Save it for future use.

Open linux command console and give command
curl
You should get:
curl: try 'curl --help' or 'curl --manual' for more information
If your linux says it does not know "curl" then you must install package called "curl"

After that you can create a script file with text editor. Lets put it to ~/.config/cqrlog folder. I use text editor "nano" here, but you can use what ever you prefer.

nano ~/.config/cqrlog/sendbot.sh

#!/bin/bash
message=$1
api_key="3456754315:AAFfx-5adas_a1ZasdasdasdQ_geF4IBMIQ"
chat_id="1234567854"
curl -s "https://api.telegram.org/bot$api_key/sendMessage?chat_id=$chat_id&text=$message"

After entering those five lines save the file. Note that you must use YOUR api-key and YOUR chat id you just did create.
Close text editor and set execute bit for script file.

chmod a+x ~/.config/cqrlog/sendbot.sh

Next we test script. Type:

~/.config/cqrlog/sendbot.sh Hello

After pressing enter you should receive message "Hello" to your smart phone's Telegram messenger.
At linux console side you should get text like:
{"ok":true,"result":{"message_id":2,"from":{"id":1234567854,"is_bot":true,"first_name":"AB1CDE_dx","username":"ab1cde_dx_bot"},"chat":{"id":1234567854,"first_name":"your telegram name","username":"your telegram usr name","type":"private"},"date":1625376172,"text":"Hello"}}

When everything works so far it is time to connect it to cqrlog.

See: "NewQSO/Help/Help index/Operation/DX cluster operation" how to set up callsign alerts.

At preferences/DXcluster you must set up the sendbot.sh to column:
"Run this command when callsign is spotted"
/home/saku/.config/cqrlog/sendbot.sh "$CALLSIGN $BAND $MODE $FREQ $MSG"

NOTE: THERE IS A BUG (OR PROPERTY)
You must replace "~" here with your /home/username. In this example I used my home folder "/home/saku"
If you use "~" in alert command line cqrlog telnet cluster connects and shows everything else but no spots. Not with sh/dx or when they arrive.
You can not get rid of this before you set another command line without "~" close DXCluster and restart cqrlog.
So do not use "~" on command line.

You can set your own text and use those $ macros as you wish but sendbot.sh must see the message as one word without space(s) between (closed with" ".

Now you should have your remote alert working. Go out and enjoy the summer.