Setup your own DMR Network with HBLink3

rules.py

This section can be come very confusing at the begging but like before we will walk through it. The rules file will tell HBlink how to control the Conference Bridge. Once you understand how it is setup and how it work it will be clear to you. Out of the box the default rules.py file will not work, so we will need to fix it. To view the rules.py file open it in the nano editor.

nano rules.py

Once you are in the file, scroll down past the notes at the top you will see something like the picture below.

The format of this file is very important and should not be changed. This file will define your talkgroups. At the begging you will see the BRIDGES = {. Within this section are 3 sub-sections, the first one defines the WORLDWIDE talkgroup. You can add or remove the sub-sections to fit your needs. Pay very close attention to the format and punctuation of this file, it is very important.

So let’s talk about the first sub-section.

The first part is the name of the Talkgroup, in this case WORLDWIDE. It does not matter what you name it and long as it is in upper case with no spaces. You can use a dash (-) or an underscore (_) in the name. To help you keep this file orginazed you should name it the talkgroup this rule will define, in this case WORLDWIDE.

The next line will define how the system that is defined in the hblink.cfg will behave with this talkgroup. I will break down each item in this section so you understand how it works.

{‘SYSTEM’: ‘MASTER-1’,The system is the name of the device that is connected to your HBlink. This can be an OpenBridge, a Repeater or Hotspot, or a PEER connection to another HBLink Server or XLX Reflector. The systems are define in the hblink.cfg file (see above). The name (‘MASTER-1’) must be the same name of the device that you setup in your hblink.cfg file. Again pay attention to the format of this section. The word SYSTEM is in single quotes with a colon after the name. The system name is the same way, but with a comma at the end of it.
‘TS’: 1,TS stands for Time Slot, here you are defining which Time Slot traffic should be passed on. For Simplex Hotspot this will always be TS 2, where Duplex System can use either TS1 or TS2.
‘TGID’: 1,This is the Talkgroup ID this system will use. Normally each system will use the same Talkgroup ID, but this is not required. You can use any Talkgroup ID that you want this system to use. If this system is an OpenBridge, then you would use the Talkgroup ID for the Talkgroup you want to access on that bridge.
‘ACTIVE’: True,This is the default behavior of this system. There are 2 values you can use True or False. What this really means is when the device connects to your HBLink server will this talkgroup be active for them by default. So if you have a talkgroup you want everyone to automatically have access to, then you would set this to True. If it is an OpenBridge you would normally keep it True. PEER and MASTER connections could be set to False to start with, then the user would have to Key-up that talkgroup to have access to it (see below)
‘TIMEOUT’: 2,This setting works with the next setting. It will define how long a Talkgroup will be active in minutes, depending on how you have the next setting set (see below). You can think of this time out like you would on a dynamic talkgroup on a repeater. You can key-up the talkgroup and after so many minutes if you don’t re-key the talkgroup it will automatically be dropped.
‘TO_TYPE’: ‘ON’,This is the Timeout timer type. A value of ‘ON’ activates the timeout timer for this system, then value of TIMEOUT will determine how long this talkgroup is active for the system. A value of ‘NONE’ will disable the timeout timer, then the talkgroup will be active for the system until the system turns it off.
‘ON’: [2, ],This setting will define which Talkgroup ID(s) will activate this talkgroup. I normally set it to the same value as the TGID, but it can be anything you want. You can also specify more then 1 ID by entering another number with a comma be hide it. For example you would have 2 and 25 to active this talkgroup by using the following [2, 25, ].
‘OFF’: [9, 10, ],This setting will define what Talkgroup ID(s) will disable this talkgroup for that system. In this case sending a 9 or a 10 will set this talkgroup ACTIVE to false. Really what you should to is set it to 4000, which is the default for all DMR networks. One thing to keep in mind with that, is that HBLink does not handle Private Calls, so you would send a Group Call of 4000 if you have OFF set to 4000. For systems like an OpenBridge you would just leave this blank ([]), because normally you don’t want to deactivate an OpenBridge Talkgroup..
‘RESET’: []},Reset is not really used so just leave this one blank.

That is it, once you understand which each setting does, I am sure you have a better understanding on how the rules work. You will basically define the talkgroup, then added the systems from your hblink.cfg and define what the default behavior will be for that system.

You can spend a lot of time defining your rules depending on how many talkgroups you have and how many systems will connect. If you remember when we where talking about MAX_PEERS in the hblink.cfg MASTERS stanza, this is where that becomes a little clearer. If you have 10 PEERS connected to a single MASTER, each of those PEERS will behave the same. You can only define 1 rule for each MASTER in a talkgroup. So if a device on a MASTER disables the talkgroup, then it will be disabled for all the PEERS connect to that MASTER system.

Just so you are aware, by default the SAMPLE rules.py file will not run. If you look closely you will see a CLIENT-1 system that is not defined in the hblink.cfg file. That will need to be fixed be fore you move on.

Spend some time working on your rules.py file, you can add or remove the talkgroups to fix your needs, but I would have at least 1 talkgroup defined. Below I have edited the rules file to match how the default hblink.cfg is setup.

The above image is a screen shot of what a real rules.py file might look like. I have defined 2 talkgroups (LOCAL AND NORTH_AMERICA). To help you, spend some time studying the rules. Some thing to note is in the LOCAL not all of the available systems are defined in the hblink.cfg, that is okay. In the LOCAL you will see that the REPEATER-1 system is active by default but also has a timer of 15 minutes then it will be deactivated.

Some other things you should see is in the NORTH_AMERICA talkgroup, the OPB-1 system is always active and there is not OFF talkgroup ID. You should also see that in NORTH_AMERICA a Group Call of 4000 or 9 will deactivate the talkgroup for a given system.

In the next section will wrap everything up and start our HBlink server for the first time, we will also make it so that our HBlink server will automatically start when the server it’s self is rebooted.

Leave a Reply

Your email address will not be published. Required fields are marked *