FOR TIPS, gUIDES & TUTORIALS

subscribe to our Youtube

GO TO YOUTUBE

14455 questions

17168 answers

28195 comments

0 members

We are migrating to our new platform at https://community.teltonika.lt. Moving forward, you can continue discussions on this new platform. This current platform will be temporarily maintained for reference purposes.
0 votes
959 views 4 comments
by anonymous
Hi,

I am using a RUTX50 in my RV / Camper and a Raspberry Pi with Homeassistant HASSIO installed. I want to display the health of my RUTX50 in Homeassistant. I already have the MQTT-Addon installed. How do I get mobile connection parameters published via MQTT on my RUTX50?

Thanks for your precious time!
by anonymous

Hi DaumantasG,

I attached the troubleshot file as wanted and screenshots of the Modbus config. Thank you again for your help and please excuse my lack of knowledge!

Hannes

by anonymous
Hello,

The correct function would be Read Holding Registers (3). Everything else seems to be good. Let me know if this helps.

Best regards,
DaumantasG

1 Answer

0 votes
by anonymous

Hello,

  

The easiest way to achieve this would be by using Modbus TCP Slave + Modbus TCP Master + Data to Server configuration.

To achieve this:

  • Navigate to Modbus → Modbus TCP Slave;
    • Enable the instance;
    • Select the mobile data measurement that will be provided to the broker;
    • Press Save & Apply;
  • Navigate to Modbus TCP Master and create a new instance;
    • Enable the instance;
    • Slave ID: 1 (make sure it's the same as in the Modbus Slave configuration);
    • IP address: 127.0.0.1;
    • Port: 502;
    • Period: how often you'd like the data to be polled (not sent);
    • In the Requests configuration, create a separate request for each parameter you'd like to obtain. The full table of parameters can be found here. Make sure to use Register numbers and not register addresses.
    • Press Save & Apply. If you'd like to test if each of the parameters is represented correctly, you can use the Test button in the request configuration.
  • Navigate to Services → Data to Server
    • Create a new instance;
    • Select the Data Source as Modbus data;
    • Protocol: MQTT;
    • JSON format is how the message JSON contents will look. In this case, the best option might be to use a format like this :
    • {"%r":"%a"} which represents {"<Request name>":"<Register data>"}
    • So the actual received data will look like this:
    • {"modem_temperature":"356"}
    • Keep in mind that every message will be in this format, so I'd recommend against using static text;
    • Select the segment count (how many JSON objects will be sent in one string);
    • In the URL / Host / Connection string specify the broker IP address. Internal MQTT Broker can be used if the router is connected to the HA machine or appropriate firewall rules are set up and the broker is enabled;
    • Specify the topic that the messages will be published on;
    • It's highly recommended to leave the Client ID empty if you're unsure of its purpose. This way a random ID will be generated.
    • If the broker supports it, set QoS to 2;
    • Enable the Retry on fail option;
    • Press Save & Apply;
And this should be it!

I've also noticed, that HA has an OpenWRT ubus integration, which could be quite useful if you are familiar with ubus functionality.

If the Modbus method does not have enough variables available, SNMP is also a quite simple option with much more modem values available.

One more option would be to use Custom Modbus Registers and gather the mobile connection information that way to send it using the previously described method.

Let me know if there are any further questions!

  

Best regards,
DaumantasG

by anonymous

Hi DaumantasG,

thank you for this help. I did want you have written, but always get "Request failed, result: Failed to get response: Illegal function" when testing when testing Request configuration! Is there a trick to do it right?

by anonymous
Hello,

Could you attach a screenshot of what your Modbus Master request configuration looks like? It would be even if you could generate a troubleshoot file (System → Administration → Troubleshoot) and attach it to the original post. It will only be visible to Teltonika moderators.

Best regards,
DaumantasG