Teltonika (OpenWRT / RutOS) custom GSM modem modbus

Sorry for the slow reply – not active on the forums very much. I get correct GPS from my RUTX50 with the following:

      - name: "RUTX50: GPS Lat"
        scan_interval: 30
        slave: 192
        address: 143
        data_type: float32
        precision: 6

      - name: "RUTX50: GPS Lon"
        scan_interval: 30
        slave: 192
        address: 145
        data_type: float32
        precision: 6
1 Like

Thanks
I have already fixed with SNMP

1 Like

Hello @Karumbe

Would you mind sharing how you did that? Thank you! :grinning:

1 Like

I’ve looked into SNMP before (the links below are very well written) but hopefully @Karumbe can share an exact setup for you.

1 Like

Just enabled SNMP as in your link, so far not tested v3 Mode and in HA

sensor:

  • platform: snmp
    name: ‘Rutx_latitude’
    host: 192.168.1.1
    baseoid: .1.3.6.1.4.1.48690.3.1.0
    unique_id: rutlat
  • platform: snmp
    name: 'Rutx_longitude’
    host: 192.168.1.1
    baseoid: .1.3.6.1.4.1.48690.3.2.0
    unique_id: rutlon
  • platform: snmp
    name: ‘Rutx_date’
    host: 192.168.1.1
    baseoid: .1.3.6.1.4.1.48690.3.4.0
    unique_id: rutdat
2 Likes

Hello and thanks for both your feedback! :relaxed:

However, I’m not sure if I’m doing this correctly. Could you maybe please provide me with a hint in this regard?

On my RUTX11, I enabled SNMP like this (and left all other SNMP settings as they were per default):

On HA, I have set up /config/sensors/rutx.yaml (and I have sensor: !include_dir_merge_list sensor in configuration.yaml) as shown below (the baseoids are from Teltonika’s website):

  sensor:
    - platform: snmp
      name: 'RUTX_gps_latitude'
      host: 192.168.11.1                                           # note that this is my RUTX11's IP (not 192.168.1.1)
      baseoid: .1.3.6.1.4.1.48690.3.1.0
      accept_errors: true
      unique_id: rut_gps_latitude

    - platform: snmp
      name: 'RUTX_gps_longitude'
      host: 192.168.11.1
      baseoid: .1.3.6.1.4.1.48690.3.2.0
      accept_errors: true
      unique_id: rut_gps_longitude

    - platform: snmp
      name: 'RUTX_gps_accuracy'
      host: 192.168.11.1
      baseoid: .1.3.6.1.4.1.48690.3.3.0
      accept_errors: true
      unique_id: rut_gps_accuracy

    - platform: snmp
      name: 'RUTX_gps_fixtime'
      host: 192.168.11.1
      baseoid: .1.3.6.1.4.1.48690.3.4.0
      accept_errors: true
      unique_id: rut_gps_fixtime

    - platform: snmp
      name: 'RUTX_gps_numsat'
      host: 192.168.11.1
      baseoid: .1.3.6.1.4.1.48690.3.5.0
      accept_errors: true
      unique_id: rut_gps_numsat

I restarted HA and thought that I would now find some new entities via SNMP but there are none. What am I doing wrong or missing? Again, thanks for your help! :heart:

Well, now have another problem, when the SNMP sensor reaches the value of 2000000000
bytes falls to -2000000000.
Any idea?

Thanks, that works very fine.
Finally I receive the router coordinates by SNMP,
not unable to receive in MODBUS.

But can’t get correct daily send or received bytes after trying all in this thread.
In SNMP can’t handle the data over 2.000.000.000

In MODBUS got crazy data

Can you help me?

Yhanksy

Great progress you all made there. Is in first posts all information in example correct? I’m replacing Huawei with RUT241 in remote location, so definitely missing stats.

Looks like I will try to make it work with RUT241 now.

Well, I’m getting stuck on first steps…
On rut241 there is no slave, master, but there is package to be downloaded as modbus TCP server and client. I configured as on teltonika site.
For first command error for $, running without
getting this, and I can’t find a way to get further…

If I close putty and opening again to copy second command is not clear for me. When I just copy paste it includes enter commands and not getting any results, do I need to edit out “enter” to have it on single line? What about # in front?

Sorry for silly question but for me it isn’t as simple as it looks…

@incar Hopefully you managed to get further along. The vi command opens a linux based text editor and yes, the interface is bloody confusing! You might need to take a look at this:

Vi cheat sheet

The simplest operation is to type vi filename which creates a new empty file called filename, then press i to switch from command mode to insertion (aka typing) mode. Type or paste whatever text you want, then you are ready to save and exit press the ESC key to switch back to command (aka menu) mode. Type :w + ENTER to save the file, and :q + ENTER to quit Vi. You could also type :q! + ENTER to force exit Vi without saving any changes.

Thank You. No I couldn’t get any further.
Ok so after running first command I need to exit. How about nexr one? It doesn’t look like it is simple copy paste line. Or is it content of that new modbus file?

Hello!

Can somebody please explain a bit further how values coming via SNMP can be used in Home Assistant (HA)? I have SNMP enabled on my Teltonika RUTX11 and set up a few SNMP platform sensors in HA (see my post dated 03 Nov 2023: Teltonika (OpenWRT / RutOS) custom GSM modem modbus - #49 by 7wells).

However, I fail to understand what to do then in HA. I thought that there must be entities appearing, but the only entities that I see in HA in connection with my RUTX11 are from Modbus (which I want to replace by SNMP).

What am I missing? Do I also have to enable Trap service settings on my RUTX11 and enter my HA’s IP in the “Host” field (and add Trap rules, too)? I do not (yet) need alerts via Trap, but just would like to see values of RUTX11 parameters defined in HA via the SNMP platform, but there are none.

EDIT:
Why have the OIDs on Teltonika’s website trailing periods (.1.3.6.1.4.1.48690)? In all examples from HA, the OIDs start without a trailing period (1.3.6.1.4.1.xxx).

Thanks a lot for your help!

PS:
From another Linux machine, I can read values from my RUTX11 like this:

$ snmpget -v2c -c public 192.168.11.1 1.3.6.1.4.1.48690.2.2.1.12.1
iso.3.6.1.4.1.48690.2.2.1.12.1 = INTEGER: -85

However, I do not understand where/how in HA I can get this value.

Is the following in configuration.yaml not enough?

    sensor:
    - platform: snmp
      host: 192.168.11.1
      port: 161
      version: 2c
      community: public
      accept_errors: true
      name: 'Teltonika mobile signal strength'
      unique_id: "Teltonika_mobile_signal_strength"
      unit_of_measurement: "dBm"
      baseoid: 1.3.6.1.4.1.48690.2.2.1.12.1

What else do I have to set up in HA to see a corresponding entity and to be able to create a lovelace card with this parameter and value (and others)?

@disuye @Karumbe and others:
Any hints? Thank you so much! :heart:

PS2 - solution found!

I had various sensor files in a sensors folder and referred to all of them from my configuration.yaml like this:

sensor: !include_dir_merge_list sensors

However, the teltonika.yaml in that sensors folder started with sensor: , which ruined all (without any error messages in the logs):

    sensor:
    - platform: snmp
      host: 192.168.11.1
      port: 161
      version: 2c
      community: public
      accept_errors: true
      name: 'Teltonika mobile signal strength'
      unique_id: "Teltonika_mobile_signal_strength"
      unit_of_measurement: "dBm"
      baseoid: 1.3.6.1.4.1.48690.2.2.1.12.1

Why? Well, because the configuration.yaml already contains a sensor: group. :face_with_hand_over_mouth:

I just mention this here for completeness, in case others stumble over this, too. My problem had nothing to do with SNMP itself, but rather with my own stupidity. :crazy_face:

Cheers!

Users who still prefer Modbus (which is the topic of this thread :wink:) over SNMP, might be interested in this (German) blog:

There I found the below way (again, Modbus) to toggle in HA between 2 SIM cards inserted in the router:

    switches:
      - name: Sim Switches
        unique_id: "Sim Switches"
        slave: 1
        address: 205
        write_type: holdings
        # OFF Sim1, ON Sim2
        command_on: 2
        command_off: 1

If somebody had a wink if/how to achieve this via SNMP, I would be even happier. :grinning:

1 Like

@disuye
Are you aware how to monitor the GSM bands via SNMP instead of Modbus? I can only find these via SNMP:

.1.3.6.1.4.1.48690.2.2.1.12.1 Signal strength level (RSSI)
.1.3.6.1.4.1.48690.2.2.1.18.1 Cell (Base transceiver station) ID
.1.3.6.1.4.1.48690.2.2.1.19.1 SINR value in dB
.1.3.6.1.4.1.48690.2.2.1.20.1 RSRP value in dBm
.1.3.6.1.4.1.48690.2.2.1.21.1 RSRQ value in dB

(RUTX11 SNMP - Teltonika Networks Wiki)

Not GSM bands, though. Maybe they are not available at all via SNMP?

PS1: I asked Teltonika, too, and referred to your thread here. :wink:

PS2 - here is the reply from Teltonika:

This information doesn’t have an OID, so it can’t be accessed. Trying to access it via SNMP won’t work.

If you truly need it, I suggest following the tutorial you provided in your post. Alternatively, you can use MQTT instead of Modbus.

Also, you can utilize “Data to Server” where you can extract the Band from “Serving cell information”.