Bpq32 MHeard Beacon

G7TAJ/GB7BEX is sending out a MHeard beacon. I thought that would be fun to try it to.
You can find out how Steve GT7TAJ did it here.  https://github.com/TAj-src/BPQ-MHeardBeacon

I use for this the Docker from M0LTE. You can find it here. https://github.com/M0LTE/bpqapi?tab=readme-ov-file

#!/bin/bash
# Create a beacon file with the bpqapi.
# https://github.com/M0LTE/bpqapi?tab=readme-ov-file
# 18-11-2024 Mheard beacon v1.0a
work_dir=/home/pi/linbpq/script
bc_dir=/home/pi/linbpq
# Get the mh list.
curl -X GET http://pi1lap:8080/native/v1/mheard/1 -H accept > "$work_dir/mheard.json"
# Some file manipulation (trouble with {"mheard":[{"callSign":. remove {"mheard":
sed -i 's/^.\{10\}//' "$work_dir/mheard.json"
sed -i 's/.$//' "$work_dir/mheard.json"
# Remove double call`s.
jq 'unique_by(.callSign)' "$work_dir/mheard.json" > "$work_dir/unique-mh.json"
# Only the call`s received today.
jq '[.[] | select(.lastHeard > (now | strftime("%Y-%m-%d")))]' "$work_dir/unique-mh.json" > "$work_dir/today-mh.json"
# Not received any call after 24:00 uur (next day) So today-mh.json is empty [] exit program. If not empty extract callsign`s.
if cat "$work_dir/today-mh.json" | jq -e '. == []'
then
rm -f "$bc_dir/beacon.txt" && exit
else
jq -r '.[] | .callSign' "$work_dir/today-mh.json" > "$work_dir/format.txt"
fi
# Delete the beacon.txt and Change the output format.
rm -f "$bc_dir/beacon.txt"
sed -i '1s/^/Mheard:\n/' "$work_dir/format.txt"
awk ' /^ *$/ {print} !/^ *$/ {printf $0 " "} END {print ""}' "$work_dir/format.txt" > "$bc_dir/beacon.txt"

If you not have received any calll after 24:00 hour midnight on the hf bands the beacon.txt get deleted. You can do also some thing like this to send out a beacon.

# Not received any call after 24:00 uur (next day) So today-mh.json is empty [] exit program. If not empty extract callsign`s. 
if cat today-mh.json | jq -e '. == []' 
then 
  echo "PI1LAP-7 Node - PI8LAP BBS JO11VN" > "bc_dir/beacon.txt" && exit 
else 
  jq -r '.[] | .callSign' "$work_dir/today-mh.json" > "work_dir/format.txt" 
fi 

Config BPQ32 to send out the beacon.


Beacon looks like this

16:45:41T PI1LAP-7>HF Port=1 :
Mheard: GB7BEX GB7BPQ GB7CNR GB7HIB-1 GB7HIB-7 GB7IOW GB7IOW-1 GB7NOT M7TAW M7TAW-3

Add a crontab every 10 minutes. (crontab -e)
*/10 * * * * /home/pi/linbpq/script/get-mh.sh

Ok, Have Fun