change dynamic tg from cmd line

Help with DMR issues
Post Reply
PD9MWO
Posts: 6
Joined: Thu Jul 02, 2020 5:41 pm

change dynamic tg from cmd line

Post by PD9MWO »

Hi all
first of all merry christmas and a happy new year ;-)

i just have a small question.
I am running pi-star 4.1.3 and want to change the talkgroup from my command line.

i already found dropping tg via the BM api .. but not to change the dynamic group from the command line, not from my radio
again this is NOT the static but the DYNAMIC tg change

or...
is there a way to send some data to an udp port , just like the ysf reflectors ???
for example if you want to change the YSFReflector from the command line we can use:
echo -n "LinkYSF21080" |nc -u 127.0.0.1 6073 -w 2

is there such a way for the dmr talkgroups ???

i hope someone can help me with this
Many thanks in advance

pd9mwo
User avatar
MW0MWZ
Site Admin
Posts: 1505
Joined: Wed Apr 04, 2018 9:15 pm
Location: Wales, UK
Contact:

Re: change dynamic tg from cmd line

Post by MW0MWZ »

PD9MWO wrote: Sat Dec 26, 2020 2:48 pm Hi all
first of all merry christmas and a happy new year ;-)

i just have a small question.
I am running pi-star 4.1.3 and want to change the talkgroup from my command line.

i already found dropping tg via the BM api .. but not to change the dynamic group from the command line, not from my radio
again this is NOT the static but the DYNAMIC tg change

or...
is there a way to send some data to an udp port , just like the ysf reflectors ???
for example if you want to change the YSFReflector from the command line we can use:
echo -n "LinkYSF21080" |nc -u 127.0.0.1 6073 -w 2

is there such a way for the dmr talkgroups ???

i hope someone can help me with this
Many thanks in advance

pd9mwo
Well we have the other option for YSF also;

Code: Select all

$ sudo pistar-ysflink
To unlink from any connected reflector, use: pistar-ysflink unlink
To link to YSF31672, use: pistar-ysflink ysf31672
To link to FCS002-90, use: pistar-ysflink fcs00290
The current BM API will only let us clear dynamic TGs, but they are working on a new one (coming very soon) that may well have this feature.
Andy

73 de MW0MWZ
http://pistar.uk
F4BVC
Posts: 4
Joined: Sat Jan 30, 2021 3:38 pm

Re: change dynamic tg from cmd line

Post by F4BVC »

Hello Andy,

BM API is working very well but just for BM network.
I run multiple DMR networks attachements, so do you have news about the next "pistar-dmrlink" feature ?

Thanks for all.
73 de Sebastien
KN2TOD
Posts: 305
Joined: Sun Nov 11, 2018 6:36 pm

Re: change dynamic tg from cmd line

Post by KN2TOD »

No pistar-dmrlink, but the next best thing: add these functions (commands) to your .bash_aliases file (or store in a file and "source" it at the start of your SSH session):

Code: Select all

# addtg ts tg
# deltg ts tg
# dropqso ts
# dropdyn ts

function addtg () {
  local dmrid bmkey req ts tg post
  ts=${1:-2}
  tg=${2:-0}
  post="{\"slot\":${ts},\"group\":${tg}}"
  dmrid=$(sed -n "/^Id=[0-9]\{9\}/p" /etc/mmdvmhost | cut -c 4-)
  bmkey=$(sed -n 's/.*apikey=\(.*\)/\1/p' /etc/bmapi.key)
  req="https://api.brandmeister.network/v2/device/${dmrid}/talkgroup"
  sudo curl -X 'POST' -s "${req}" -d "${post}" -H 'accept: application/json' -H 'Content-Type: application/json' -H "Authorization: Bearer ${bmkey}" -H 'X-CSRF-TOKEN: smal04YhQGHAyHPu5xXfTZPAYXDJm7iDGME8f6XF'
  echo -e "\n$?"
  logger "BM Admin --> ${req} POST ${post}" 
}

function deltg () {
  local dmrid bmkey req ts tg
  ts=${1:-2}
  tg=${2:-0}
  dmrid=$(sed -n "/^Id=[0-9]\{9\}/p" /etc/mmdvmhost | cut -c 4-)
  bmkey=$(sed -n 's/.*apikey=\(.*\)/\1/p' /etc/bmapi.key)
  req="https://api.brandmeister.network/v2/device/${dmrid}/talkgroup/${ts}/${tg}"
  sudo curl -X 'DELETE' -s "${req}" -d "${post}" -H 'accept: application/json' -H 'Content-Type: application/json' -H "Authorization: Bearer ${bmkey}" -H 'X-CSRF-TOKEN: smal04YhQGHAyHPu5xXfTZPAYXDJm7iDGME8f6XF'
  echo -e "\n$?"
  logger "BM Admin --> ${req} DELETE ${post}" 
}

function dropqso () {
  local dmrid bmkey req ts
  ts=${1:-2}
  dmrid=$(sed -n "/^Id=[0-9]\{9\}/p" /etc/mmdvmhost | cut -c 4-)
  bmkey=$(sed -n 's/.*apikey=\(.*\)/\1/p' /etc/bmapi.key)
  req="https://api.brandmeister.network/v2/device/${dmrid}/action/dropCallRoute/${ts}"
  sudo curl -X 'GET' -s "${req}" -H 'accept: application/json' -H "Authorization: Bearer ${bmkey}" -H 'X-CSRF-TOKEN: LcZMFZ4YUnQQYtPCdZHqhP7edhoE6PNHZZtKYaTf'
  echo -e "\n$?"
  logger "BM Admin --> ${req} GET" 
}

function dropdyn () {
  local dmrid bmkey req ts
  ts=${1:-2}
  dmrid=$(sed -n "/^Id=[0-9]\{9\}/p" /etc/mmdvmhost | cut -c 4-)
  bmkey=$(sed -n 's/.*apikey=\(.*\)/\1/p' /etc/bmapi.key)
  req="https://api.brandmeister.network/v2/device/${dmrid}/action/dropDynamicGroups/${ts}"
  sudo curl -X 'GET' -s "${req}" -H 'accept: application/json' -H "Authorization: Bearer ${bmkey}" -H 'X-CSRF-TOKEN: LcZMFZ4YUnQQYtPCdZHqhP7edhoE6PNHZZtKYaTf'
  echo -e "\n$?"
  logger "BM Admin --> ${req} GET" 
}
Post Reply