Changes

Line 12: Line 12:  
Modbus enables communication among many devices connected to the same network, for example, a system that measures temperature and humidity and communicates the results to a computer. Modbus is often used to connect a supervisory computer with a remote terminal unit (RTU) in supervisory control and data acquisition (SCADA) systems. Many of the data types are named from its use in driving relays: a single-bit physical output is called a coil, and a single-bit physical input is called a discrete input or a contact.
 
Modbus enables communication among many devices connected to the same network, for example, a system that measures temperature and humidity and communicates the results to a computer. Modbus is often used to connect a supervisory computer with a remote terminal unit (RTU) in supervisory control and data acquisition (SCADA) systems. Many of the data types are named from its use in driving relays: a single-bit physical output is called a coil, and a single-bit physical input is called a discrete input or a contact.
   −
This article provides a guide on how to use Modbus TCP to monitor {{{name}}} routers with a PC using a Linux Operating System. However, the same principles apply to RUTXxx and TRBxx family devices, but the holding register information will differ. You can find this information in the links below:
+
This article provides a guide on how to use Modbus TCP to monitor {{{name}}} routers with a PC using a Linux Operating System.
*'''[[RUTXR1 Monitoring via Modbus]]'''
  −
*'''[[RUTX12 Monitoring via Modbus]]'''
  −
*'''[[RUTX11 Monitoring via Modbus]]'''
  −
*'''[[RUTX10 Monitoring via Modbus]]'''
  −
*'''[[RUTX09 Monitoring via Modbus]]'''
  −
*'''[[RUTX08 Monitoring via Modbus]]'''
  −
*'''[[TRB245 Monitoring via Modbus]]'''
  −
*'''[[TRB255 Monitoring via Modbus]]'''
  −
*'''[[TRB140 Monitoring via Modbus]]'''
  −
*'''[[TRB141 Monitoring via Modbus]]'''
  −
*'''[[TRB142 Monitoring via Modbus]]'''
  −
*'''[[TRB145 Monitoring via Modbus]]'''
   
==Configuring the router==
 
==Configuring the router==
    
In order to start using Modbus TCP, we must first configure the router. Modbus TCP configuration from the router's side is very simple. All you need to do is log in to the router's WebUI, go to '''Services → Modbus''', '''Enable''' the Modbus TCP service, enter a '''Port''' number through which the Modbus TCP communication will take place and '''Allow remote access''' if you wish to connect to the router remotely (from WAN).
 
In order to start using Modbus TCP, we must first configure the router. Modbus TCP configuration from the router's side is very simple. All you need to do is log in to the router's WebUI, go to '''Services → Modbus''', '''Enable''' the Modbus TCP service, enter a '''Port''' number through which the Modbus TCP communication will take place and '''Allow remote access''' if you wish to connect to the router remotely (from WAN).
   −
[[File:Networking_rutos_manual_modbus_modbus_tcp_slave_v2.png]]
+
[[File:Networking_rutos_manual_modbus_modbus_tcp_slave.png|border|class=tlt-border]]
    
==Installing the necessary software==
 
==Installing the necessary software==
Line 40: Line 28:  
==Getting router parameters==
 
==Getting router parameters==
   −
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'''.
+
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:{{{name}}}|RUTX12| To get data from the second modem, you need to execute this command:
    +
$  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:
 +
 +
$ modbus write -D {{#ifeq:{{{series}}}|TRB14X|192.168.2.1|192.168.1.1}} %MW328  13101 12544
 +
 +
}}
 
===List of parameters===
 
===List of parameters===
 
----
 
----
 
Router parameters are held within '''registers'''. Each register contains 2 bytes of information. For simplification the number of registers for storing numerical values is 2, while the number of registers for storing text information is 16. The register addresses and corresponding system values are described in the table below:
 
Router parameters are held within '''registers'''. Each register contains 2 bytes of information. For simplification the number of registers for storing numerical values is 2, while the number of registers for storing text information is 16. The register addresses and corresponding system values are described in the table below:
   −
<table class="nd-othertables">
+
{{Template:Networking_rutos_manual_modbus_modbus_tcp_get_parameters_table
    <tr>
+
|mobile = {{{mobile}}}  
        <th width="546">required value</th>
+
|series = {{{series}}}
      <th width="200">register address</th>
+
|name = {{{name}}}
        <th width="200">register number</th>
+
|analog = {{{analog}}}
      <th width="200">number of registers</th>
+
|gps = {{{gps}}}
      <th width="200">representation</th>
+
|dualsim = {{{dualsim}}}
    </tr>
  −
    <tr>
  −
      <td>System uptime</td>
  −
      <td>1</td>
  −
        <td>2</td>
  −
      <td>2</td>
  −
        <td>32 bit unsigned integer</td>
  −
    </tr>
  −
{{#ifeq:{{{mobile}}}| 1 |
  −
    <tr>
  −
      <td>Mobile signal strength ([[RSSI]] in dBm)</td>
  −
      <td>3</td>
  −
        <td>4</td> 
  −
      <td>2</td>
  −
        <td>32 bit integer</td>
  −
    </tr>
  −
{{#ifeq:{{{series}}}|TRB14X||
  −
    <tr>
  −
      <td>System temperature (in 0.1 °C)</td>
  −
      <td>5</td>
  −
        <td>6</td>
  −
      <td>2</td>
  −
        <td>32 bit integer</td>
  −
    </tr>
  −
}}
  −
}}
  −
    <tr>
  −
      <td>System hostname</td>
  −
      <td>7</td>
  −
        <td>8</td>
  −
      <td>16</td>
  −
        <td>Text</td>
  −
    </tr>
  −
{{#ifeq:{{{mobile}}}| 1 |
  −
    <tr>
  −
      <td>GSM operator name</td>
  −
      <td>23</td>
  −
        <td>24</td>
  −
      <td>16</td>
  −
        <td>Text</td>
  −
    </tr>
  −
}}
  −
    <tr>
  −
      <td>Router serial number</td>
  −
      <td>39</td>
  −
        <td>40</td>
  −
      <td>16</td>
  −
        <td>Text</td>
  −
    </tr>
  −
{{#switch:{{{name}}}
  −
|TRB141=
  −
|TRB142=
  −
|TRB145=
  −
|
  −
    <tr>
  −
      <td>LAN MAC address</td>
  −
      <td>55</td>
  −
        <td>56</td>
  −
      <td>16</td>
  −
        <td>Text</td>
  −
    </tr>
  −
}}
  −
    <tr>
  −
      <td>Router name</td>
  −
      <td>71</td>
  −
        <td>72</td>
  −
      <td>16</td>
  −
        <td>Text</td>
  −
    </tr>
  −
{{#ifeq:{{{mobile}}}| 1 |
  −
    <tr>
  −
      <td>Currently active SIM card slot</td>
  −
      <td>87</td>
  −
        <td>88</td>
  −
      <td>16</td>
  −
        <td>Text</td>
  −
    </tr>
  −
    <tr>
  −
      <td>Network registration info</td>
  −
      <td>103</td>
  −
        <td>104</td>
  −
      <td>16</td>
  −
        <td>Text</td>
  −
    </tr>
  −
    <tr>
  −
      <td>Network type</td>
  −
      <td>119</td>
  −
        <td>120</td>
  −
      <td>16</td>
  −
        <td>Text</td>
  −
    </tr>
  −
}}
  −
    <tr>
  −
      <td>Current WAN IP address</td>
  −
      <td>139</td>
  −
        <td>140</td>
  −
      <td>2</td>
  −
        <td>32 bit unsigned integer</td>
  −
    </tr>
  −
{{#ifeq:{{{analog}}}| 1|
  −
    <tr>
  −
      <td>Analog input value</td>
  −
      <td>141</td>
  −
        <td>142</td> 
  −
      <td>2</td>
  −
        <td>32 bit integer</td>
  −
    </tr>
  −
}}
  −
{{#ifeq:{{{gps}}}| 1|
  −
    <tr>
  −
      <td>GPS latitude coordinate</td>
  −
      <td>143</td>
  −
        <td>144</td>
  −
      <td>2</td>
  −
        <td>32 bit float</td>
  −
    </tr>
  −
    <tr>
  −
      <td>GPS longitude coordinate</td>
  −
      <td>145</td>
  −
        <td>146</td>
  −
      <td>2</td>
  −
        <td>32 bit float</td>
  −
    </tr>
  −
    <tr>
  −
      <td>GPS fix time</td>
  −
      <td>147</td>
  −
        <td>148</td>
  −
      <td>16</td>
  −
        <td>Text (Unix timestamp×1000)</td>
  −
    </tr>
  −
    <tr>
  −
      <td>GPS date and time</td>
  −
      <td>163</td>
  −
        <td>164</td>
  −
      <td>16</td>
  −
        <td>Text (DDMMYYhhmmss)</td>
  −
    </tr>
  −
    <tr>
  −
      <td>GPS speed</td>
  −
      <td>179</td>
  −
        <td>180</td>
  −
      <td>2</td>
  −
        <td>32 bit integer</td>
  −
    </tr>
  −
    <tr>
  −
      <td>GPS satellite count</td>
  −
      <td>181</td>
  −
        <td>182</td>
  −
      <td>2</td>
  −
        <td>32 bit integer</td>
  −
    </tr>
  −
    <tr>
  −
      <td>GPS accuracy</td>
  −
      <td>183</td>
  −
        <td>184</td>
  −
      <td>2</td>
  −
        <td>32 bit float</td>
  −
    </tr>
  −
}}
  −
{{#ifeq:{{{mobile}}}| 1|
  −
    <tr>
  −
      <td>Mobile data received today (SIM1)</td>
  −
      <td>185</td>
  −
      <td>186</td>
  −
      <td>2</td>
  −
      <td>32 bit unsigned integer</td>
  −
    </tr>
  −
    <tr>
  −
      <td>Mobile data sent today (SIM1)</td>
  −
      <td>187</td>
  −
      <td>188</td>
  −
      <td>2</td>
  −
      <td>32 bit unsigned integer</td>
  −
    </tr>
  −
    <tr>
  −
      <td>Mobile data received this week  (SIM1)</td>
  −
      <td>189</td>
  −
      <td>190</td>
  −
      <td>2</td>
  −
      <td>32 bit unsigned integer</td>
  −
    </tr>
  −
    <tr>
  −
      <td>Mobile data sent this week  (SIM1)</td>
  −
      <td>191</td>
  −
      <td>192</td>
  −
      <td>2</td>
  −
      <td>32 bit unsigned integer</td>
  −
    </tr>
  −
    <tr>
  −
      <td>Mobile data received this month  (SIM1)</td>
  −
      <td>193</td>
  −
      <td>194</td>
  −
      <td>2</td>
  −
      <td>32 bit unsigned integer</td>
  −
    </tr>
  −
    <tr>
  −
      <td>Mobile data sent this month  (SIM1)</td>
  −
      <td>195</td>
  −
      <td>196</td>
  −
      <td>2</td>
  −
      <td>32 bit unsigned integer</td>
  −
    </tr>
  −
    <tr>
  −
        <td>Mobile data received last 24h  (SIM1)</td>
  −
        <td>197</td>
  −
        <td>198</td>
  −
        <td>2</td>
  −
        <td>32 bit unsigned integer</td>
  −
    </tr>
  −
    <tr>
  −
        <td>Mobile data sent last 24h  (SIM1)</td>
  −
        <td>199</td>
  −
        <td>200</td>
  −
        <td>2</td>
  −
        <td>32 bit unsigned integer</td>
  −
    </tr>
  −
}}
  −
{{#ifeq:{{{mobile}}}| 1|
  −
      <tr>
  −
        <td>Active SIM card</td>
  −
        <td>205</td>
  −
        <td>206</td>
  −
        <td>1</td>
  −
        <td>32 bit unsigned integer</td>
  −
      </tr>
  −
      <tr>
  −
        <td>Mobile data received last week (SIM1)</td>
  −
        <td>292</td>
  −
        <td>293</td>
  −
        <td>2</td>
  −
        <td>32 bit unsigned integer</td>
  −
      </tr>
  −
      <tr>
  −
        <td>Mobile data sent last week (SIM1)</td>
  −
        <td>294</td>
  −
        <td>295</td>
  −
        <td>2</td>
  −
        <td>32 bit unsigned integer</td>
  −
      </tr>
  −
      <tr>
  −
        <td>Mobile data received last month (SIM1)</td>
  −
        <td>296</td>
  −
        <td>297</td>
  −
        <td>2</td>
  −
        <td>32 bit unsigned integer</td>
  −
      </tr>
  −
      <tr>
  −
        <td>Mobile data sent last month (SIM1)</td>
  −
        <td>298</td>
  −
        <td>299</td>
  −
        <td>2</td>
  −
        <td>32 bit unsigned integer</td>
  −
      </tr>
  −
{{#ifeq:{{{name}}}|TRB14X| |
  −
      <tr>
  −
          <td>Mobile data received today (SIM2)</td>
  −
          <td>300</td>
  −
          <td>301</td>
  −
          <td>2</td>
  −
          <td>32 bit unsigned integer</td>
  −
      </tr>
  −
      <tr>
  −
        <td>Mobile data sent today (SIM2)</td>
  −
        <td>302</td>
  −
        <td>303</td>
  −
        <td>2</td>
  −
        <td>32 bit unsigned integer</td>
  −
      </tr>
  −
      <tr>
  −
        <td>Mobile data received  this week  (SIM2)</td>
  −
        <td>304</td>
  −
        <td>305</td>
  −
        <td>2</td>
  −
        <td>32 bit unsigned integer</td>
  −
    </tr>
  −
    <tr>
  −
        <td>Mobile data sent  this week  (SIM2)</td>
  −
        <td>306</td>
  −
        <td>307</td>
  −
        <td>2</td>
  −
        <td>32 bit unsigned integer</td>
  −
    </tr>
  −
    <tr>
  −
        <td>Mobile data received  this month  (SIM2)</td>
  −
        <td>308</td>
  −
        <td>309</td>
  −
        <td>2</td>
  −
        <td>32 bit unsigned integer</td>
  −
    </tr>
  −
    <tr>
  −
        <td>Mobile data sent  this month  (SIM2)</td>
  −
        <td>310</td>
  −
        <td>311</td>
  −
        <td>2</td>
  −
        <td>32 bit unsigned integer</td>
  −
    </tr>
  −
    <tr>
  −
      <td>Mobile data received last 24h (SIM2)</td>
  −
      <td>312</td>
  −
      <td>313</td>
  −
      <td>2</td>
  −
      <td>32 bit unsigned integer</td>
  −
    </tr>
  −
    <tr>
  −
        <td>Mobile data sent last 24h (SIM2)</td>
  −
        <td>314</td>
  −
        <td>315</td>
  −
        <td>2</td>
  −
        <td>32 bit unsigned integer</td>
  −
    </tr>
  −
    <tr>
  −
      <td>Mobile data received last week (SIM2)</td>
  −
      <td>316</td>
  −
      <td>317</td>
  −
      <td>2</td>
  −
      <td>32 bit unsigned integer</td>
  −
    </tr>
  −
    <tr>
  −
      <td>Mobile data sent last week (SIM2)</td>
  −
      <td>318</td>
  −
      <td>319</td>
  −
      <td>2</td>
  −
      <td>32 bit unsigned integer</td>
  −
    </tr>
  −
    <tr>
  −
      <td>Mobile data received last month(SIM2)</td>
  −
      <td>320</td>
  −
      <td>321</td>
  −
      <td>2</td>
  −
      <td>32 bit unsigned integer</td>
  −
    </tr>
  −
    <tr>
  −
      <td>Mobile data sent last month (SIM2)</td>
  −
      <td>322</td>
  −
      <td>323</td>
  −
      <td>2</td>
  −
      <td>32 bit unsigned integer</td>
  −
    </tr>
  −
}}
  −
}}
  −
{{#switch:{{{name}}}
  −
|RUTXR1=
  −
|TRB255=
  −
    <tr>
  −
      <td>PIN 3 status</td>
  −
      <td>324</td>
  −
      <td>325</td>
  −
      <td>1</td>
  −
      <td>16 bit unsigned integer</td>
  −
    </tr>
  −
    <tr>
  −
      <td>PIN 4 status</td>
  −
      <td>325</td>
  −
      <td>326</td>
  −
      <td>1</td>
  −
      <td>16 bit unsigned integer</td>
  −
    </tr>
  −
    <tr>
  −
      <td>PIN 2 status</td>
  −
      <td>336</td>
  −
      <td>337</td>
  −
      <td>1</td>
  −
      <td>16 bit unsigned integer</td>
  −
    </tr>
  −
|TRB245=
  −
    <tr>
  −
      <td>PIN 3 status</td>
  −
      <td>324</td>
  −
      <td>325</td>
  −
      <td>1</td>
  −
      <td>16 bit unsigned integer</td>
  −
    </tr>
  −
    <tr>
  −
      <td>PIN 4 status</td>
  −
      <td>325</td>
  −
      <td>326</td>
  −
      <td>1</td>
  −
      <td>16 bit unsigned integer</td>
  −
    </tr>
  −
    <tr>
  −
      <td>PIN 2 status</td>
  −
      <td>336</td>
  −
      <td>337</td>
  −
      <td>1</td>
  −
      <td>16 bit unsigned integer</td>
  −
    </tr>
  −
|
  −
    <tr>
  −
      <td>Digital non-isolated input (4 PIN connector)</td>
  −
      <td>324</td>
  −
      <td>325</td>
  −
      <td>1</td>
  −
      <td>32 bit unsigned integer</td>
  −
    </tr>
  −
    <tr>
  −
      <td>Digital open collector output (4 PIN connector)</td>
  −
      <td>325</td>
  −
      <td>326</td>
  −
      <td>1</td>
  −
      <td>32 bit unsigned integer</td>
  −
</tr>
  −
}}
  −
{{#switch:{{{series}}}
  −
|RUTX=
  −
|
  −
    <tr>
  −
      <td> PIN 3 direction {{#ifeq:{{{series}}}|TRB14X|(4 PIN connector)}}</td>
  −
      <td>326</td>
  −
      <td>327</td>
  −
      <td>1</td>
  −
      <td>16 bit unsigned integer</td>
  −
    </tr>
  −
    <tr>
  −
      <td> PIN 4 direction {{#ifeq:{{{series}}}|TRB14X|(4 PIN connector)}} </td>
  −
      <td>327</td>
  −
      <td>328</td>
  −
      <td>1</td>
  −
      <td>16 bit unsigned integer</td>
  −
  </tr>
  −
}}
  −
{{#ifeq:{{{mobile}}}|1|
  −
    <tr>
  −
      <td> Modem ID </td>
  −
      <td>328</td>
  −
      <td>329</td>
  −
      <td>8</td>
  −
      <td>Text</td>
  −
  </tr>
   
}}
 
}}
{{#ifeq:{{{name}}}|TRB141|
  −
    <tr>
  −
      <td> Relay </td>
  −
      <td>337</td>
  −
      <td>338</td>
  −
      <td>1</td>
  −
      <td>16 bit unsigned integer</td>
  −
  </tr>
  −
    <tr>
  −
      <td> Latching relay </td>
  −
      <td>338</td>
  −
      <td>339</td>
  −
      <td>1</td>
  −
      <td>16 bit unsigned integer</td>
  −
  </tr>
  −
    <tr>
  −
      <td> Isolated input </td>
  −
      <td>339</td>
  −
      <td>340</td>
  −
      <td>1</td>
  −
      <td>16 bit unsigned integer</td>
  −
  </tr>
  −
    <tr>
  −
      <td> 1-wire </td>
  −
      <td>340</td>
  −
      <td>341</td>
  −
      <td>1</td>
  −
      <td>16 bit unsigned integer</td>
  −
  </tr>
  −
    <tr>
  −
      <td> PIN 1 input status </td>
  −
      <td>341</td>
  −
      <td>342</td>
  −
      <td>1</td>
  −
      <td>16 bit unsigned integer</td>
  −
  </tr>
  −
    <tr>
  −
      <td> PIN 2 input status </td>
  −
      <td>342</td>
  −
      <td>343</td>
  −
      <td>1</td>
  −
      <td>16 bit unsigned integer</td>
  −
  </tr>
  −
    <tr>
  −
      <td> PIN 1 (Dry/Wet) status </td>
  −
      <td>343</td>
  −
      <td>344</td>
  −
      <td>1</td>
  −
      <td>16 bit unsigned integer</td>
  −
  </tr>
  −
    <tr>
  −
      <td> PIN 2 (Dry/Wet) status </td>
  −
      <td>344</td>
  −
      <td>345</td>
  −
      <td>1</td>
  −
      <td>16 bit unsigned integer</td>
  −
  </tr>
  −
    <tr>
  −
      <td> ACL status </td>
  −
      <td>346</td>
  −
      <td>347</td>
  −
      <td>1</td>
  −
      <td>32 bit integer</td>
  −
  </tr>
  −
}}
  −
{{#ifeq:{{{mobile}}}|1|
  −
    <tr>
  −
      <td> IMSI </td>
  −
      <td>348</td>
  −
      <td>349</td>
  −
      <td>16</td>
  −
      <td>Text</td>
  −
  </tr>
  −
}}
  −
</table>
  −
      
===Modbus read===
 
===Modbus read===
Line 577: Line 68:  
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 583: Line 74:  
'''-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 614: Line 105:  
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 653: Line 144:  
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 663: Line 154:  
==Setting router values==
 
==Setting router values==
   −
The Modbus daemon also supports the setting of some system parameters. To accomplish this task the '''modbus write''' command is used. System related parameters and how to use them are described below. The register address specifies from which register to start writing the required values. All commands, except “Change APN”, accepts only one input parameter {{#ifeq:{{{mobile}}}|1|(more on changing APN can be found below)}}.
+
The Modbus daemon also supports the setting of some system parameters. To accomplish this task the '''modbus write''' command is used. System related parameters and how to use them are described below. The register address specifies from which register to start writing the required values. All commands, except “Change APN”, accepts only one input parameter {{#ifeq:{{{mobile}}}|1|(more on changing APN can be found below)}}.  
<table class="nd-othertables">
+
{{Template:Networking_rutos_manual_modbus_modbus_tcp_set_parameters_table
    <tr>
+
|wifi={{{wifi}}}
        <th width="350">value to set</th>
+
|mobile={{{mobile}}}
      <th width="180">register address</th>
+
|series={{{series}}}
      <th width="150">register value</th>
+
|name={{{name}}}
      <th width="466">description</th>
  −
    </tr>
  −
{{#ifeq:{{{wifi}}}|1|
  −
    <tr>
  −
      <td>Switch WiFi ON/OFF</td>
  −
      <td>203</td>
  −
      <td>1 {{!}} 0</td>
  −
        <td>Turns WiFi ON or OFF</td>
  −
    </tr>
  −
}}
  −
{{#ifeq:{{{mobile}}}|1|
  −
    <tr>
  −
      <td>Switch mobile data connection (ON/OFF<span class="asterisk">*</span>)</td>
  −
      <td>204</td>
  −
      <td>1 {{!}} 0</td>
  −
        <td>Turns mobile data connection ON or OFF</td>
  −
    </tr>
  −
    <tr>
  −
      <td>Switch SIM card</td>
  −
      <td>205</td>
  −
      <td>1 {{!}} 2 {{!}} 0</td>
  −
        <td>Changes the active SIM card slot
  −
            <ul>
  −
                <li>1 - switch to SIM1</li>
  −
                <li>2 - switch to SIM2</li>
  −
    <li>0 - switch from the the SIM card opposite of the one currently in use (SIM1 → SIM2 or SIM2 → SIM1</li>
  −
            </ul>
  −
</td>
  −
    </tr>
  −
}}
  −
    <tr>
  −
    <td>Reboot</td>
  −
        <td>206</td>
  −
        <td>1</td>
  −
        <td>Reboots the router</td>
  −
    </tr>
  −
{{#ifeq:{{{mobile}}}|1|
  −
    <tr>
  −
    <td>Change APN</td>
  −
        <td>207</td>
  −
        <td>APN code</td>
  −
        <td>Changes APN. <br> The number of input registers may vary depending on the length of the APN, but the very first byte of the set APN command denotes the number of the SIM card for which to set the APN. This byte should be set to:
  −
            <ul>
  −
                <li>1 - to set APN for SIM1</li>
  −
                <li>2 - to set APN for SIM2</li>
  −
    </ul>
  −
        </td>
  −
    </tr>
  −
}}
  −
{{#switch:{{{name}}}
  −
|RUTXR1=
  −
|
  −
    <tr>
  −
      <td> Switch PIN 3 state </td>
  −
      <td>324</td>
  −
      <td>1{{!}}0</td>
  −
      <td>Toggles PIN 3 ON or OFF, when output is selected</td>
  −
  </tr>
  −
    <tr>
  −
      <td> Switch PIN 4 state </td>
  −
      <td>325</td>
  −
      <td>1{{!}}0</td>
  −
      <td>Toggles PIN 4 ON or OFF, when output is selected</td>
  −
  </tr>
  −
}}
  −
{{#ifeq:{{{series}}}|TRB2XX|
  −
    <tr>
  −
      <td> Switch PIN2 state </td>
  −
      <td>336</td>
  −
      <td>1{{!}}0</td>
  −
      <td>Toggles PIN 2 ON or OFF, when output is selected</td>
  −
  </tr>
  −
}}
  −
 
  −
{{#ifeq:{{{name}}}|TRB141|
  −
    <tr>
  −
      <td> Switch relay state </td>
  −
      <td>337</td>
  −
      <td>1{{!}}0</td>
  −
      <td>Turns Relay ON or OFF</td>
  −
  </tr>
  −
    <tr>
  −
      <td> Switch latching relay state </td>
  −
      <td>338</td>
  −
      <td>1{{!}}0</td>
  −
      <td>Turns latching relay ON or OFF</td>
  −
  </tr>
  −
    <tr>
  −
      <td>Switch PIN 1 (Dry/Wet) state</td>
  −
      <td>343</td>
  −
      <td>1{{!}}0</td>
  −
      <td>Switches PIN 1 state to 0 (dry) / 1 (wet)</td>
  −
  </tr>
  −
    <tr>
  −
      <td>Switch PIN 2(Dry/Wet) state</td>
  −
      <td>344</td>
  −
      <td>1{{!}}0</td>
  −
      <td>Switches PIN 2 state to 0 (dry) / 1 (wet)</td>
  −
  </tr>
  −
    <tr>
  −
      <td> Switch ACL ON/OFF </td>
  −
      <td>345</td>
  −
      <td>1{{!}}0</td>
  −
      <td>Turns ACL functionality ON or OFF</td>
  −
  </tr>
   
}}
 
}}
</table>
  −
   
{{#ifeq:{{{wifi}}}|1|
 
{{#ifeq:{{{wifi}}}|1|
 
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 791: Line 175:  
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 803: Line 187:  
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.
 
}}
 
}}
 +
 
==External links==
 
==External links==
   Line 812: Line 197:  
**http://www.unit-conversion.info/
 
**http://www.unit-conversion.info/
 
**http://www.binaryhexconverter.com/
 
**http://www.binaryhexconverter.com/
 +
 +
[[Category:{{{name}}} Configuration Examples]]

Navigation menu