KNOT - Execute AT commands through a script

Hello,

I have Mikrotik KNOT and I would like to ask if it’s possible to send AT commands through a script. For example a basic script which connects to the serial-terminal and sends the testing “AT” command.

I’ve been able to connect to NB-IoT network through SIM card, connect to public MQTT broker and successfuly subscribe/publish. Now I’ve connected a basic button to GPIO pins and after testing it out the button works fine, so what I’m trying to figure out now is how to publish a MQTT message by pressing the button - which I thought would be possible through a script, but I’m a bit stuck here.

Maybe this is a stupid question, but I haven’t been able to find anything regarding this.

Thanks for all of your help

It is not easy/straightforward, and there are limitations.

For ARM devices there is a “better” solution through a container:
http://forum.mikrotik.com/t/serial2http-container-to-bridge-serial-to-the-routeros-cli/164589/1
the same thread contains some hints towards the possibility of using /interface/ppp-client/at-chat:
http://forum.mikrotik.com/t/serial2http-container-to-bridge-serial-to-the-routeros-cli/164589/1

But it has to be seen how it works in practice on the Knot.

Check also:
http://forum.mikrotik.com/t/how-script-sending-an-at-command-to-a-gsm-modem/175576/1
https://wiki.mikrotik.com/Sending_text_out_over_a_serial_port
http://forum.mikrotik.com/t/lte-at-chat-command-formatting/144459/1

I’ve found another post which uses /interface/ppp-client/at-chat. This works for me just fine, so I’m putting a link here in case someone needs it in the future:

http://forum.mikrotik.com/t/how-script-sending-an-at-command-to-a-gsm-modem/175576/1

Yep :slight_smile: , the link to thread #207137 you just posted looks very different from the link to the thread #207137 I suggested. :laughing: