Using the BrandMeister API

By Vladimir, AC2F

1) Overview

Here is my approach to using talkgroups and my AnyTone radio on BrandMeister.

1a) Basic setup

1b) The role and function of the hotspot

2) Using the BrandMeister API

In order to use the features available via the BrandMeiser API, you need to get a BrandMeister API key. You should make a note of it as you can view it in BrandMeister SelfCare only once, and you'll need it for the automation commands described below. (You also can use it to enable the BrandMeister Manager Module in Pi-Star for your hotspot.) See the instructions for getting a BrandMeister API Key on the Pi-Star Wiki: PI-Star integration with BrandMeister API.

Once you have a BrandMeister API key, you can monitor your hotspot's settings on the BrandMeister dashboard where you can see which talkgroups are static or auto-static. You can use this to verify things while you're testing your automation commands and scripts:

  1. Log into your BrandMeister SelfCare account:
    https://brandmeister.network/
  2. Find the My hotspots option in the BrandMeister menu:
    • In a wide browser window, it's the open left panel.
    • On a mobile device or in a narrower browser window, it can be opened by clicking the top left Menu button (looks like three lines stacked on each other, and is commonly called the "hamburger" button).
      BrandMeister Menu link
  3. Click My hotspots to open a list of your hotspots, and then click the CCS7 ID associated with the hotspot you want to look at.
    BrandMeister My hotspots
  4. In the hotspot Settings window that opens, scroll down to the Static Talkgroups section to see which talkgroups are static or auto-static.
    BrandMeister Static Talkgroups
    Note: It can take a minute or so for an auto-static talkgroup to show up in the Static Talkgroups list (sometimes you must refresh to see the change).
  5. In a desktop browser window, if you point your mouse cursor at a listed auto-static talkgroup, you'll see a tooltip identifying it as "Auto Static."
    BrandMeister Auto-Static Talkgroups
    Note 1: The rest of the tooltip hasn't been updated to accurately reflect how the auto-static feature is working as of Mar 2019. The tooltip should read: "This talkgroup was set automatically as auto-static due to it being the last talkgroup keyed up."

2a) Checking current talkgroups status in a browser

Once you have your BrandMeister SelfCare account set up, you can use the "My hotspots" ID for your active hotspot to check the status of static and auto-static talkgroups right in your browser using this URL:

https://api.brandmeister.network/v1.0/repeater/?action=profile&q=[My hotspot ID]
Checking BrandMeister talkgroups status in a browser

2b) Running commands in Terminal

You can use these commands in any Linux Terminal. They also should work in Windows Subsystem for Linux or even a router shell. A few general notes:

i) Drop the current QSO

curl -s --user '[BM API Key]:' "https://api.brandmeister.network/v1.0/repeater/setRepeaterDbus.php?action=dropCallRoute&slot=[0/1/2]&q=[My hotspot ID]"

ii) Drop all dynamic talkgroups

If you are stuck on a talkgroup, you can use this command together with the Drop the current QSO command to get out. If you make a desktop shortcut for these commands, it takes just a few seconds to drop it.

curl -s --user '[BM API Key]:' "https://api.brandmeister.network/v1.0/repeater/setRepeaterTarantool.php?action=dropDynamicGroups&slot=[0/1/2]&q=[My hotspot ID]"

iii) Add static talkgroup

curl -s --user '[BM API Key]:' --data "talkgroup=[Talkgroup #]&timeslot=[0/1/2]" "https://api.brandmeister.network/v1.0/repeater/talkgroup/?action=ADD&id=[My hotspot ID]"

iv) Remove static talkgroup

curl -s --user '[BM API Key]:' --data "talkgroup=[Talkgroup #]&timeslot=[0/1/2]" "https://api.brandmeister.network/v1.0/repeater/talkgroup/?action=ADD&id=[My hotspot ID]"

v) Putting it all together in a script

Using the above commands, you can create a shell script (.sh) to perform tasks on a schedule using Cron (Linux scheduler). For example, if you want to participate in the Colorado HD net, which is on talkgroup 31088 on Tuesdays (day # 2) from 7:30 PM to 10:50 PM Mountain Time, you can create one script to drop all other talkgroups, including dynamic, and add 31088, and a second script to restore things to how they were after the net is over.

In these examples, the time is converted to Eastern Time:

A few notes:

Here's an example of tgcoloradohd.sh for a simplex hotspot (timeslot=0), which drops two static talkgroups (31075 and 25701), adds talkgroup 31088, and finally drops all dynamic talkgroups:

#!/bin/bash
curl -s --user '[BM API Key]:' --data "talkgroup=31075&timeslot=0" "https://api.brandmeister.network/v1.0/repeater/talkgroup/?action=DEL&id=[My hotspot ID]"
curl -s --user '[BM API Key]:' --data "talkgroup=25701&timeslot=0" "https://api.brandmeister.network/v1.0/repeater/talkgroup/?action=DEL&id=[My hotspot ID]"
curl -s --user '[BM API Key]:' --data "talkgroup=31088&timeslot=0" "https://api.brandmeister.network/v1.0/repeater/talkgroup/?action=ADD&id=[My hotspot ID]"
curl -s --user '[BM API Key]:' "https://api.brandmeister.network/v1.0/repeater/setRepeaterTarantool.php?action=dropDynamicGroups&slot=0&q=[My hotspot ID]"

And here's an example of tgrestoreall.sh, also for a simplex hotspot:

#!/bin/bash
curl -s --user '[BM API Key]:' --data "talkgroup=31088&timeslot=0" "https://api.brandmeister.network/v1.0/repeater/talkgroup/?action=ADD&id=[My hotspot ID]"
curl -s --user '[BM API Key]:' --data "talkgroup=31075&timeslot=0" "https://api.brandmeister.network/v1.0/repeater/talkgroup/?action=ADD&id=[My hotspot ID]"
#curl -s --user '[BM API Key]:' --data "talkgroup=25701&timeslot=0" "https://api.brandmeister.network/v1.0/repeater/talkgroup/?action=ADD&id=[My hotspot ID]"