Changes

no edit summary
Line 30: Line 30:  
Modbus TCP can be used to both '''get''' and '''set''' certain router parameters. First lets do an overview of how to obtain parameters via Modbus TCP. Please keep in mind that in order to get routers parameters when using '''[https://wiki.teltonika-networks.com/view/{{{name}}}_Modbus#Requests_configuration Request Configuration]''' you need to use '''Register Number''' instead of '''Register Address'''.{{#ifeq:RUTX12| RUTX12| To get data from the second modem, you need to execute this command:
 
Modbus TCP can be used to both '''get''' and '''set''' certain router parameters. First lets do an overview of how to obtain parameters via Modbus TCP. Please keep in mind that in order to get routers parameters when using '''[https://wiki.teltonika-networks.com/view/{{{name}}}_Modbus#Requests_configuration Request Configuration]''' you need to use '''Register Number''' instead of '''Register Address'''.{{#ifeq:RUTX12| RUTX12| To get data from the second modem, you need to execute this command:
   −
  $  modbus write -D 192.168.1.1 %MW328  12589 12590 12800
+
  $  modbus write -D {{#ifeq:{{{series}}}TRB14X|192.168.2.1|192.168.1.1}} %MW328  12589 12590 12800
    
This command sets it to primary modem:
 
This command sets it to primary modem:
   −
  $ modbus write -D 192.168.1.1 %MW328  13101 12544
+
  $ modbus write -D {{#ifeq:{{{series}}}TRB14X|192.168.2.1|192.168.1.1}} %MW328  13101 12544
    
}}
 
}}
Line 67: Line 67:  
For the first example, lets use a modbus read command to attempt to obtain the router's uptime value in seconds. If you look back at the table above, you will see that the uptime value is stored in two registers starting from the first register, therefore:
 
For the first example, lets use a modbus read command to attempt to obtain the router's uptime value in seconds. If you look back at the table above, you will see that the uptime value is stored in two registers starting from the first register, therefore:
   −
  $ modbus read -w -p 12345 192.168.1.1 %MW001 2
+
  $ modbus read -w -p 12345 {{#ifeq:{{{series}}}TRB14X|192.168.2.1|192.168.1.1}} %MW001 2
    
'''-w''' specifies the data type. In this case, unsigned 16 bit integers.
 
'''-w''' specifies the data type. In this case, unsigned 16 bit integers.
Line 73: Line 73:  
'''-p''' specifies the port number.
 
'''-p''' specifies the port number.
   −
'''192.168.1.1''' - the router's LAN IP address.
+
'''{{#ifeq:{{{series}}}TRB14X|192.168.2.1|192.168.1.1}}''' - the router's LAN IP address.
    
'''%MW001''' specifies the register address.
 
'''%MW001''' specifies the register address.
Line 104: Line 104:  
Lets examine a different, more complex example by issuing a request for the router's '''WAN IP address'''. If you look at the '''[[Monitoring_via_Modbus#List_of_parameters|table]]''' above, you will see that the WAN IP address value is contained within the 139th and 140th registers. Therefore, we should specify the 139th address and read 2 registers from that address:
 
Lets examine a different, more complex example by issuing a request for the router's '''WAN IP address'''. If you look at the '''[[Monitoring_via_Modbus#List_of_parameters|table]]''' above, you will see that the WAN IP address value is contained within the 139th and 140th registers. Therefore, we should specify the 139th address and read 2 registers from that address:
   −
  $ modbus read -w -p 12345 192.168.1.1 %MW139 2
+
  $ modbus read -w -p 12345 {{#ifeq:{{{series}}}TRB14X|192.168.2.1|192.168.1.1}} %MW139 2
    
[[File:Configuration examples modbus wan ip v2.png]]
 
[[File:Configuration examples modbus wan ip v2.png]]
Line 143: Line 143:  
Some values like Hostname, Router name, Network type are represented as text in their original form, but are stored in registers as numbers. You can interpret these values the same way as all discussed before (by converting them to binary and then to text), but a simpler way would be to get them in '''hexadecimal''' form and then convert them to text. To do so, we'll have to add the '''-D''' parameter to the command. Lets do it by asking for the router's Hostname:
 
Some values like Hostname, Router name, Network type are represented as text in their original form, but are stored in registers as numbers. You can interpret these values the same way as all discussed before (by converting them to binary and then to text), but a simpler way would be to get them in '''hexadecimal''' form and then convert them to text. To do so, we'll have to add the '''-D''' parameter to the command. Lets do it by asking for the router's Hostname:
   −
  $ modbus read -D -w -p 12345 192.168.1.1 %MW007 16
+
  $ modbus read -D -w -p 12345 {{#ifeq:{{{series}}}TRB14X|192.168.2.1|192.168.1.1}} %MW007 16
    
[[Image:Configuration examples modbus hostname example v2.png]]
 
[[Image:Configuration examples modbus hostname example v2.png]]
Line 163: Line 163:  
As you can see most of the values are '''0''' and '''1''', 0 meaning OFF and 1 meaning ON. For example, if you want to turn '''WiFi OFF''', this command should be used:
 
As you can see most of the values are '''0''' and '''1''', 0 meaning OFF and 1 meaning ON. For example, if you want to turn '''WiFi OFF''', this command should be used:
   −
  $ modbus write -w -p 12345 192.168.1.1 %MW203 0
+
  $ modbus write -w -p 12345 {{#ifeq:{{{series}}}TRB14X|192.168.2.1|192.168.1.1}} %MW203 0
    
If you want to turn '''WiFi ON''', use this command instead:
 
If you want to turn '''WiFi ON''', use this command instead:
   −
  $ modbus write -w -p 12345 192.168.1.1 %MW203 1
+
  $ modbus write -w -p 12345 {{#ifeq:{{{series}}}TRB14X|192.168.2.1|192.168.1.1}} %MW203 1
 
}}
 
}}
 
{{#ifeq:{{{mobile}}}|1|
 
{{#ifeq:{{{mobile}}}|1|
Line 174: Line 174:  
In the case of '''SIM switch''' there are three values - '''0''', '''1''' and '''2'''. 1 makes the first SIM card slot in use, 2 makes the second SIM card slot in use and 0 initiates a switc from the SIM card in use to the opposite SIM card. For example, to initiate a switch to the second SIM card the command should look like this:
 
In the case of '''SIM switch''' there are three values - '''0''', '''1''' and '''2'''. 1 makes the first SIM card slot in use, 2 makes the second SIM card slot in use and 0 initiates a switc from the SIM card in use to the opposite SIM card. For example, to initiate a switch to the second SIM card the command should look like this:
   −
  $ modbus write -w -p 12345 192.168.1.1 %MW205 2
+
  $ modbus write -w -p 12345 {{#ifeq:{{{series}}}TRB14X|192.168.2.1|192.168.1.1}} %MW205 2
    
The '''reboot''' function only takes one value: '''1'''. It simply reboots the router. To initiate a reboot, use this command:
 
The '''reboot''' function only takes one value: '''1'''. It simply reboots the router. To initiate a reboot, use this command:
   −
  $ modbus write -w -p 12345 192.168.1.1 %MW206 1
+
  $ modbus write -w -p 12345 {{#ifeq:{{{series}}}TRB14X|192.168.2.1|192.168.1.1}} %MW206 1
    
===APN===
 
===APN===
Line 186: Line 186:  
As an example lets try to change the router's first SIM card's APN to '''gprs.fix-ip.omnitel1.net''':
 
As an example lets try to change the router's first SIM card's APN to '''gprs.fix-ip.omnitel1.net''':
   −
  $ modbus write -w -D -p 12345 192.168.1.1 %MW207 <span style="color:blue">'''1'''</span> <span style="color:green">'''103 112 114 115 46 102 105 120 45 105 112 46 111 109 110 105 116 101 108 49 46 110 101 116'''</span>
+
  $ modbus write -w -D -p 12345 {{#ifeq:{{{series}}}|TRB14X|192.168.2.1|192.168.1.1}} %MW207 <span style="color:blue">'''1'''</span> <span style="color:green">'''103 112 114 115 46 102 105 120 45 105 112 46 111 109 110 105 116 101 108 49 46 110 101 116'''</span>
    
The value of the first byte is highlighted in <span style="color:blue">'''blue'''</span> and, in this case, it denotes that the APN value should be changed for the first SIM card. The value of the APN string itself is highlighted in <span style="color:green">'''green'''</span>. Use an ASCII to Decimal online converter to convert individual letters to Decimal code.
 
The value of the first byte is highlighted in <span style="color:blue">'''blue'''</span> and, in this case, it denotes that the APN value should be changed for the first SIM card. The value of the APN string itself is highlighted in <span style="color:green">'''green'''</span>. Use an ASCII to Decimal online converter to convert individual letters to Decimal code.

Navigation menu