RUT901 SMS utilities Modbus custom script

Hi, i would like help with using SMS utilities with SMS rules, use custom script.

How can i make it send SMS like “Power: 100kW, voltage: 400V” ?

if i use CLI i get:

root@RUT901:~# ubus call modbus_client tcp.test '{"ip":"192.168.1.251", "port":"502", "id":1, "timeout":1, "function":3, "first_reg":1, "reg_count":"2", "
data_type":"16bit_int_hi_first", "no_brackets":1}'                                                                                                        
{                                                                                                                                                         
        "error": 0,                                                                                                                                       
        "result": "100,0"                                                                                                                                 
}                                                                                                                                                                                                                                                                                                                

Sms is like:

"v?error":0
"result: "100"
Status code: 0"

Also, can i make this script run as Modbus client Event (from PLC request) or at a set time, for example midnight?

Thank you.

Hi Mskrepsky,

Welcome to Teltonika Networks Community!

You can refer to this file as a guide for your script.
script.zip (383 Bytes)

Basically, this script uses the jsonfilter command to only pull out the value of “result”.

If you want to run this script at a set time, you can use crontabs. More information HERE. Example (0 0 * * * /path/to/your/script.sh)

Let me know if this helps.

Regards,

This topic was automatically closed 40 hours after the last reply. New replies are no longer allowed.