11311 questions

13473 answers


31499 members

0 votes
989 views 1 comments
Hi, I'm trying to read the analog input value via cli on a 955 using the analog_calc command as described here: https://wiki.teltonika.lt/view/RUT955_Input/Output

The command returns:

root@Teltonika-RUT955:~# analog_calc
lua: /usr/sbin/analog_calc:31: attempt to perform arithmetic on global 'gresistor' (a nil value)
stack traceback:
/usr/sbin/analog_calc:31: in main chunk
[C]: ?

Is this an internal script problem or am I missing a setting that defines 'gresistor' somewhere in the gui?

Running firmware RUT9XX_R_00.06.00. I had the same result on the previous firmware (5.04 i think).


1 Answer

0 votes


Thank you for the information.

This issue occurs when user creates analog input rule (Services -> Input/output -> Input), which measures current.

We informed our RnD team about issue and with next firmware release, this will be fixed.

For now the fix would be to edit analog_calc script.

To open analog_calc script with vi editor enter this text in command line:

vi /usr/sbin/analog_calc

 In vi editor press Shift+i to enable edit mode and after local ganalog = exec("cat /sys/class/hwmon/hwmon0/device/in0_input") in the new line enter this text:

local gresistor = 1200

Now press "Esc" button to disable edit mode and enter :wq and press "Enter" to save changes and exit vi editor.

With this changes analog_calc will work correctly.

Best answer
Thank you for the info, I can look into that.

I've been trying to get a 4-20mA sensor/transmitter logging in the 955 but the values I'm seeing don't make sense (not seeing logical resistance changes from the temperature sensor). Is it possible that the problem you have mentioned affects the displayed current value? Should I make a new post/question?