I found no single source of information about getting the RUTX50 and HA happily working together, so I have written up this page. At the least it will help me remember what I have done!!
Home Assistant is running in a VM in PROXMOX on a GMKtec Mini (N150, 1TB 16GB DDR4)
The RUTX50 and GMKtec are connected via an Ethernet cable and both run off the Lithium batteries in the van (13-14V, 240AH). Also, I am using tailscale for remote access to everything when away from the van.
Rutx50 modem API
The modem has a Telstra (Australia) sim, number is +614XXXXXXX (04XXXXXXXX)
To test the API for sending SMS, I opened the shell in Proxmox (192.168.1.3) and used curl commands.
The API in the modem requires an authentication token to be sent along with most commands.
To get the token you initially use this command
curl -k -X POST "https://192.168.1.1/api/login" -H "Content-Type:application/json" -d '{"username": "admin", "password": "youadminpassword"}'
This returns a json string e.g. {"success":true,"data":{"username":"admin","expires":299,"token":"0e653e4c05ac87f20aca4b04eb578abe","group":"root"}}
Note this token will timeout in 299 seconds, so will have to be refreshed.
The next thing to know is the modem slot the sim is in. Change the token to one that is valid and use this command:
curl -k -X GET https://192.168.1.1/api/modems/apns/status -H 'Content-Type: application/json' -H 'Authorization: Bearer 0e653e4c05ac87f20aca4b04eb578abe'
You should get a json string like this. Note the 2-1 that is returned for the modem, yours may be different.
{"success":true,"data":[{"apns":[{"password":"","apn":"telstra.internet","user":"","id":2540,"carrier":"Telstra","pdptype":"0","auth":"none"}],"modem":"**2-1**"}]}
Now you can send an SMS using this curl command:
curl -k -X POST https://192.168.1.1/api/messages/actions/send -H 'Content-Type: application/json' -H 'Authorization: Bearer 611cb66530ad3cf9a38c150d73429dd3' -d '{"data":{"number":"04XXXXXXXX", "message":"test 1", "modem":"2-1"}}'
It should return a json string, something like this:
{"success":true,"data":{"sms_used":1}}
There are a lot more API end points in the modem. See https://developers.teltonika-networks.com/
On this page you need to select your modem and its software version to see the valid api calls. Remember to use a valid token and GET or POST as applicable.
So with understanding of the Rutx50 API, the next step…
Home Assistant send SMS via API
This requires modifying configuration.yaml, adding the rutx admin login to secrets.yaml, setting up helpers, a script and adding a card.
Configuration.yaml
I added these direct into the file for testing purposes, I will move them into their own yaml and include that file within configuration.yaml later
sensor:
- platform: rest
name: rutx_auth_token
resource: https://192.168.1.1/api/login
verify_ssl: false
method: POST
headers:
content-type: "application/json"
payload: !secret rutx_login
value_template: "{{ value_json.data.token }}"
scan_interval: 290
rest_command:
send_sms_rutx:
url: https://192.168.1.1/api/messages/actions/send
verify_ssl: false
method: POST
headers:
authorization: "Bearer {{ states('sensor.rutx_auth_token') }}"
content-type: "application/json"
payload: '{"data":{"number":"{{ number }}", "message":"{{ message }}", "modem":"2-1"}}'
and in secrets.yaml add:
rutx_login: '{"username": "admin", "password": "myadminpassword"}'
Sensor: is a Restful sensor see RESTful Sensor - Home Assistant
This will query the router every 290 seconds for a token and store it in sensor.rutx_auth_token
I’ve added that to a card in my Status page in HA, where I can see the token is updated regularly.
Remember the returned data was a json string in the form {“success”:true,“data”:{“username”:“admin”,“expires”:299,“token”:“0e653e4c05ac87f20aca4b04eb578abe”,“group”:“root”}} and the token is extracted using value_template: “{{ value_json.data.token }}”
Rest_command is used to send the SMS along with the current value of the token
The token is brought in using a Jinja2 template
{{ states('sensor.rutx_auth_token') }}"
The number and phone will be pushed in from the script.
Create two text helpers.
Settings → Devices & Services → Helpers. I used Text for both of these (in case using + and country code are required for the phone number)
Next the script
This is used to trigger the rest_command named send_sms_text in configuration.yaml, as well as to push the number and message values into it.
Settings → Automations & Scenes → and add a script called Send RUTX SMS
The script uses the helper entities to build the data values number and message.
data:
number: "{{ states('input_text.sms_phone_number') }}"
message: "{{ states('input_text.sms_message') }}"
action: rest_command.send_sms_rutxScripts
Add a card
Here is the yaml for a card with two text entities and a button.
type: entities
title: Send SMS
entities:
- entity: input_text.sms_phone_number
- entity: input_text.sms_message
- type: button
name: Send SMS
icon: mdi:message-text-outline
tap_action:
action: call-service
service: script.send_rutx_sms
With all this working, I should be able to send SMS from any event in HA.
Rutx50 Modbus.
I am using Modbus to get data into HA from the modem.
I want GPS data, temperature, RSSI (signal level) , network usage, etc to show on an HA card.
First step is to enable Modbus in the router, taking note of the Port and Device ID parameters
The parameters from the modem that I want are added to configuration.yaml (or into a separate file what is included with configuration.yaml), Remember after each modification of configuration.yaml to restart HA.
After configuring these they can easily be added to an Entities Card.
modbus:
- name: rutx50
type: tcp
host: 192.168.1.1
port: 502
sensors:
- name: "rutx50_uptime"
slave: 1
address: 1
input_type: holding
data_type: uint32
- name: "rutx50_rssi"
slave: 1
address: 3
input_type: holding
data_type: int32
- name: "rutx50_temperature"
slave: 1
address: 5
input_type: holding
data_type: int32
- name: "rutx50_latitude"
slave: 1
address: 143
input_type: holding
data_type: float32
- name: "rutx50_longitude"
slave: 1
address: 145
input_type: holding
data_type: float32
- name: "rutx50_speed"
slave: 1
address: 179
input_type: holding
data_type: float32
- name: "rutx50_sats"
slave: 1
address: 181
input_type: holding
data_type: uint32
Hers is my card with these parameters and the Rutx50 token (which is updated every 290 seconds)
Something extra
Sending SMS via Modbus.
I have used the Rux50’s internal Modbus Client to undertake some testing of sending SMS. I may go further with this and try tinkering with HA at some stage to do this, however it is reasonably complex and I am happy with sending SMS from HA via API calls.
This info relies on these sites. RUTX50 Monitoring via Modbus - Teltonika Networks Wiki and RUTX50 Modbus - Teltonika Networks Wiki and Modbus TCP Server Send SMS example - Teltonika Networks Wiki
Here are my values: my router is on 192.168.1.1, the name can be anything, ServerID and Port must match the TCP Client settings you have.
Then scroll down this page, and enter some values in the Requests Configuration.
Note there is a lot to Modbus registers as there are different register types - There are two address schemes, the real address ranges start from 0, but human readable addresses start from 1 (which is real address 0), So if something doesn’t work, try adding /subtracting 1 to/from the address. This can be well explained by querying an AI.
The data type and address ranges are linked. Single bits (coils) start at 0XXXX, Input registers (read only) start at 3XXXX. Holding Registers (you can both read and write these) start at 4XXXX, and the Teltonika ASCII registers start at 16XXXX for writing and 6XXXX for reading. This means that in the Teltonika webpage the registers are not exactly sequential even though the numbers might seem to suggest they are. This is important if you are using other software to get and send data across the Modbus, as that might require the full address e.g. 40006 and not 6.
As an example, reading the modem temperature.
Start by selecting Edit for the Test device
Then Add a new request
Next select
16Bit INT, high byte first, Read holding registers (3), first register 6 and register count as 2
I did not have to select enable to get it to work in the software version I was using at the time (even though one of the webpages says you have to). You can see the link between the data type and the address range as Reading Holding Registers starts at 3XXXX, so while we enter 6, the address is actually 30006.
Note that the temperature is a read only value but stored in 2 (16-bit) holding registers. If I were to guess I’d say you would select Read input register (4) to get the temperature as it is not something you write to, but if you do that it fails. Note the Teltonika webpage refers to Temperature register address as 5 and register number as 6. You need to use register numbers here in their TCP Client. Also you need to get both registers. And the value is stored in the second register as 0.1 degree increments, my result above is 500 i.e. 50.0 degrees C. I did test reading a single register starting at register 7, and this also worked.
Sending an SMS using Modbus is a two-step process. First set up the correct registers with the number and message and then setup a second register to send it.
This is very well described here Modbus TCP Server Send SMS example - Teltonika Networks Wiki
Just a note though. In Australia on Telstra 00614XXXXXXXX does not work. We can use without area code (04XXXXXXXX) or with area code (+614XXXXXXXX).
If using hex rather than ASCII use 2b for +.
The number and message need to be formatted exactly and written into register numbers from 398 on. Here is an example that worked for me.
The value entered above in SMS_Ascii must have 10 digits for the number followed by the message. It looks like this.
![]()
This is a two step process. Select SMS_Ascii and press test, then select SMS_send and press test.
This resulted in the message appearing in my phone.
I hope this helps someone, have fun!!








