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
907 views 27 comments
by anonymous

In coming releases, can we expect a "Periodic control of output" like on the RUT240  that allows to set up automatic output control rules that trigger output state changes at the specified period or interval ?

by anonymous

The action I want to initiate is: every day at 12:00, put the output (4) to HIGH for 1 minute

 So I wrote the following various crontabs, but did not succeed (on each, got a reply “not found”):

0012***configurable output 4 high

0012***\output4\high

0012***\pin=dout1\state=1

0012***\pin=dout4\state=1

0012***\pin=dout4\state=high

 root@Teltonika-TRB140:~# -ash: 0012***pin=dout1: not found 

So what is the syntax to use for output 4 ?

What is my error ?

Thank you.

 

 

 

by anonymous

Hi,

Please take a look to this link, you're trying to use http requests into bash.

You can use uci commands. in there is the details on how to power up/off and output in TRB devices.

https://wiki.teltonika-networks.com/view/UCI_command_usage

Also, crontabs call an script path into your folder. You should create an script and call it with crontabs.

https://wiki.teltonika-networks.com/view/Crontabs

In case of checking your crontab syntax, you can use an external page like this one.

https://crontab.guru/
 

To get status from cli:

 ubus call ioman.gpio.dio0 status or ubus call ioman.gpio.dio1 status


Regards.

by anonymous

Hi again,

After consultation of "UCI_command_usage" and of "Crontabs" pages, here under are the commands I introduced, but did not succeed to get the expected result. Could you review them and point to my errors ? Thank you so much for your support.

root@Teltonika-TRB140:~# uci get <config> <ioman>

-ash: syntax error: unexpected redirection

root@Teltonika-TRB140:~# uci get <config>,<ioman>

-ash: syntax error: unexpected newline

root@Teltonika-TRB140:~# uci get <config> ioman

-ash: can't open config: no such file

root@Teltonika-TRB140:~# uci get <config>.ioman

-ash: can't open config: no such file 

root@Teltonika-TRB140:~# 0012*** uci set ioman.dio1.value='1' && uci commit ioman

-ash: 0012***: not found

root@Teltonika-TRB140:~# 0012*** uci set ioman.dio1.value='1'

-ash: 0012***: not found                                       

2 Answers

+1 vote
by anonymous
Hi,

Did you read about the scheduler function?

https://wiki.teltonika-networks.com/view/TRB140_Input/Output#Scheduler

Regards.
by anonymous
Yes, but the scheduler function does not allow for a recurrent daily 1 minute (i.e.) activation of the output. On top of that we need to activate the output by a sms command, which is incompatible with the scheduler (as stated by the system when we try it).
by anonymous
Hi, I didn't quite understand your needing.

Do you need to enable/disable the output every minute?

If so, probably would be great to use the POST/GET feature and use crontabs to execute the commands/scripts you need to power up/off the output.

https://wiki.teltonika-networks.com/view/TRB140_Input/Output#Post.2FGet_examples

https://wiki.teltonika-networks.com/view/Crontabs

Regards.
by anonymous

Hi Oscar,

1. No, not every minute, but recurrent daily 1 minute (i.e.) activation of the output (which means for 1 minute every day at the same time of the day).

2. The ideal solution is that of "Periodic control of output" like on the RUT240. So I ask again, if there is a chance to get it in the future on the TRB140 ?

3. I tried the scheduler of the TRB140, but it is not working for that . I got a "server error".

4. Your proposal POST/GET suppose the command is coming from outside the TRB140 (am I right?) which is not convenient

5. Your other proposal with Crontabs does not seem to be applicable to TRBxx, but for RUTxx

Thank you for your effort. Luc

by anonymous

Hello,

1. No, not every minute, but recurrent daily 1 minute (i.e.) activation of the output (which means for 1 minute every day at the same time of the day).

  • Did you check the scheduler parameters? You can set up the interval parameter, also you can choose between Week days, or Month days, even you can set up start time and end time. Which firmware are you using rigth now? If you're not using the last one, can you please upgrade it? --> https://wiki.teltonika-networks.com/view/TRB140_Firmware_Downloads

2. The ideal solution is that of "Periodic control of output" like on the RUT240. So I ask again, if there is a chance to get it in the future on the TRB140 ?

  • I think the TRB140 has already added the feature you want to achieve in the lastest firmware. Please let me know if I'm wrong

3. I tried the scheduler of the TRB140, but it is not working for that . I got a "server error".

  • If you're using an older firmware, probably you'll get erros, due the structure was changed from  TRB1_R_00.02.06 | 2020.12.31 version.

4. Your proposal POST/GET suppose the command is coming from outside the TRB140 (am I right?) which is not convenient

  • You can issue this command from outside and inside the router, so in both cases you can issue the commands you want to use.

5. Your other proposal with Crontabs does not seem to be applicable to TRBxx, but for RUTxx

  • It's applicable for all our Teltonika devices.
Any further doubt, please let me know.
Regards.
by anonymous

Hi again,

1. We use FW 02.06.1

2. ? I do not see this feature on TRB140 !

3. I can send you the report error, but how to attach it to this comment ?

4. I do not see how to issue the command automatically from inside the router ?

5. I do not see any "CLI" on the "Services" tab of the TRB140, able to initiate a Crontab 

Thank you Oscar for the follow-up. Luc

by anonymous
Hi, can you please confirm if you're using the "basic" or "advanced" mode?

Take a look to this link:

https://wiki.teltonika-networks.com/view/TRB141_WebUI

Nevertheless, if you want to send files, you can do it via DM, click on my username and you can send there.

Regards.
by anonymous
Thank you Oscar to point on the "advanced" mode. We were indeed in "Basic".

So now in advanced mode, we are able to use the CLI. We will try a crontab an keep you informed next week.

Regards.
by anonymous
Hi,

Ok, I'll be looking forward to your feedback.

Regards.
by anonymous
Hi, did you try restarting the service with this command?

/etc/init.d/ioman restart

Regards.
0 votes
by anonymous

Hello,

You should replace the <config> with the config file you want to use, for example to get the Wireless SSID /etc/config/wireless  you should use this command:

uci get wireless.@wifi-iface[0].ssid

Also, you can access via ssh/cli to your device and check all the configuration files availables using the command:

 ls /etc/config

Once, you know which file to edit/get information, you can use show to see all the possible options.:

For instance:

uci show wireless

Any further doubt please let me know.

Regards.

by anonymous

Hello again,

Indeed, I already followed the instructions you mention, which are the ones described in the UCI command usage - Teltonika Networks Wiki (teltonika-networks.com), but my trial does not work - I got a "-ash: 0012***: not found"!

May I ask again you have a precise look at my trial which is:  have a "daily at 12:00 output HIGH for 1 minute " that I explain here:

The command line (I know I have to add a second command line to shut the output to LOW one minute later) is:

root@Teltonika-TRB140:~# 0012*** uci set ioman.dio1.value='1' && uci commit ioman

 where the "crontab" is: 0012*** 

and the command : uci set ioman.dio1.value='1' && uci commit ioman

where dio1 is the output name and "ioman" is the "config section" concerning the output, which I extracted from the TRB140 :  "root@Teltonika-TRB140:~# ls /etc/config "

Thank you.

                                 

by anonymous

Hi,

Please take a look to this guide. You should put into /etc/crontabs/root file the config you want to achieve, not in the CLI/SSH.

You can write the whole command into the /etc/crontabs/root file and it should work as expected.

https://wiki.teltonika-networks.com/view/Crontabs

If you want to test, only issue the uci command without crontabs syntax in CLI/SSH.

Regards.

by anonymous

Hi,

Please find 2 different commands I put in the crontabs, but with no results on the output (which should put the output to High after 5 minutes). Where is the fault ? I am not sure I understand your quote "You should put into /etc/crontabs/root file the config you want to achieve, not in the CLI/SSH). Thank you.

*/5**** uci set ioman.gpio.dio1.value="1" && uci commit ioman && luci-reload

~

/etc/crontabs.29837 1/1 100%

*/5**** uci set ioman.gpio.dout1.value="1" && uci commit ioman && luci-reload

~

- /etc/crontabs.15787 1/2 50%

by anonymous

Hi,

Seems you forgot the spaces between ***** in the crontab syntax

Should be * /5 * * * * instead of */5****.

Regards.

by anonymous

Oh.. yes thank you for the syntax error in Crontabs : must be space between the ***.

However there seem to be an issue in the syntax of my command line, because when I put this command uci set ioman.gpio.dio1.value="1" && uci commit ioman && luci-reload  - in the CLI to test it, there is a RELOAD, but i can not get the expected result (output to High):

Thank you for your further advise.

by anonymous
Hi, the right commands to set up confiurable input/outputs via uci API are these ones.

To set values:  -->        uci set ioman.dio0.value=1

To get the value -->      uci get ioman.dio1.value

You can use the commit and luci-reload as you tried.

Regards.
by anonymous

<!--[if !supportLists]-->1.    Hi,

      Via UCI, I can read the value with this syntax “uci get ioman.dio1.value

But when I set “uci set ioman.dio1.value=1”, it does not produce any effect on the output,

and with this syntax uci set ioman.dio1.value=1 && ioman commit, I receive this answer : "-ash: commit: not found# uci set ioman.dio1.value=1 && commit ioman "

Thank you for further explanation.

by anonymous

Hi, seems you missed the "uci" string before the commit.

To set values:  -->        uci set ioman.dio0.value=1
To get the value -->      uci get ioman.dio1.value 

To commit changes -->       uci commit ioman
To Reload luci -->               luci-reload 

Regards.

by anonymous

Hi,

Thank you,...indeed "uci" string was missing,...but now with the following command:

root@Teltonika-TRB140:~# uci set ioman.dio1.value=1 && uci commit ioman && luci-reload          

Reloading ...                                                                                  

Reloading ...                                                                                   

root@Teltonika-TRB140:~#

the output does not change status anyway, while the "get" command provides a result indicating a status change. So where could be the issue ?

Best regards.

by anonymous

What means: "the output does not change status anyway,?"

The WebUI is not showing the change? Or the output is not changing in a physical way?

by anonymous

Sorry for my inaccurate statement: 

it means that the physical output and the user interface (Services/input-output/status) do not show a status change, while the "get" command via the CLI shows a status change !

Thank you.

by anonymous

Hi,

When I put this command : uci set ioman.dio1.value=0 && uci commit ioman && etc/init.d/ioman restart

i receive this answer -ash: etc/init.d/ioman: not found      

Regards.

by anonymous

Hi,

Seems you missed the "/" character

by anonymous

Hi Oscar,

Indeed, I missed the "/" character. 

Everything is now working as we wish...smiley

I would like to thank you very much for all your advices, and for your patience with me !

Luc

by anonymous
Hi,

Thanks for your feedback and good luck with the solution.

Regards.