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
256 views 5 comments
by anonymous

Hi,

We have many RUTX14 devices for our development. We are possible to on/off both wifi interfaces by rising/falling edge of Input pin(3). Sad is that when the device is shutdown and state of connected switch is changed and device turned on again, RUTX14 memmories the last state (e.g. switch is disconnected and wifi interface is on).

We need react on actual state of Input(3) not only on comming edge.

Please, exist any solution how to manage reaction of wifi interface on actual state of Input pin - not only based on comming falling/rising edge?

As it happens, this is a very urgent situation, can you please help?

Many thanks!

JK

2 Answers

0 votes
by anonymous

Hi,

it does not exist, but you can always build your own using shell scripts.

To turn on/off the interface you can use /etc/init.d/wpad stop and start

In the IO juggler, create an action, that writes some value to a file on a device.

Create a script, that checks, if the current state of WiFi matches the state written in the file

by anonymous
Hi,

many thanks for fast response!

Yes, I am actually testing scripting - thanks for idea (I tried only fconfig wlan0 up/down' first...)

But, what I am not sure - you write "IO juggler, create an action, that writes some value to a file" - but how I can to triger any action else way than input(3)? There should be constant state (low/high) which I would like to read....

Maybe, it can be done by constantly running script in RUTX14 (runned automaticaly). But there I need to reed input(3) from GPIO... Do we have how to read this HW state from bash?

Many thanks!

JK
by anonymous
Sorry, my mind wondered in the wrong place,

Here you can find a tutorial on how to read the state using CLI

https://wiki.teltonika-networks.com/view/RUTX14_Input/Output#Status_from_command_line
by anonymous
Yes, I flow with it....

Thanks for help!
by anonymous

Dear PauliusRug,

I have almost done - thanks for idea with wpad service - it is wery easy now.

Last thing what is related to whole my issue, it is feedback of out new cool feature. I would like controll Output (4) pin based on wpad service state. Script will be easy, but I am not possible to control Output(4) from inside of RUTX14:

If I try to call output pin from my labtop by:

"http://192.168.1.1/cgi-bin/io_state?username=user1&password=user1&pin=dout1&state=off"

I see the working response in webgui (Services -> Input/Output -> Status -> Output -> State switch.

But when I call any command below from inside of SSH terminal:

"curl -X GET "http://192.168.1.1/cgi-bin/io_state?username=user1&password=user1&pin=dout1&state=on"

or

"curl -X GET "http://127.0.0.1/cgi-bin/io_state?username=user1&password=user1&pin=dout1&state=on"

or

"curl -X GET "http://localhost/cgi-bin/io_state?username=user1&password=user1&pin=dout1&state=on"

Command passes but I don't have response on Output pin.

Do you have idea why it could be, please?

If you will help me with this last thin I will have compleet"

Thanks!

by anonymous
I am not really sure, I just tested on a RUTX50 with the same commands on 7.4.2 and it seems to working fine both from SSH and from Web

So not sure why
0 votes
by anonymous

Related to this topic I did testing and suggested control of wifi by "/etc/init.d/wpad stop/start" is not stable.

After longger time of stopped service (30 sec about) is interwace definatly unturnable and must be started in webgui again.

Better way for WiFi controll is to use uci directly. So based on https://openwrt.org/docs/guide-quick-start/basic_wifi it can be for defaultly 2.4GHz wifi interface activation:

     uci set wireless.default_radio0.disabled='0'
     uci commit wireless
     wifi reload
And for deactivation:
     uci set wireless.default_radio0.disabled='1'
     uci commit wireless
     wifi reload