Serial-terminal output read from script

Hi there,

Is there any possibility to read output of RS232 attached device from script ? Maybe serial-terminal ? But how to read it in script ?

Attached device sends every x seconds plain text to RS232 and output of serial terminal is:

/system serial-terminal 0
3452;8457
(x seconds)
2854;4788

And I need to read these semicolon separated data - a RS232 output …

I’ve tried almost everything I think … :laughing:

Thanks a lot ! :sunglasses:

Have you gone to “/system ports” and setup the a new remote port? This will allow you to remotely access something attached to the serial port. Note, the serial port has to not be in use for system management to use the remote port feature.

Check this out for more info:
http://wiki.mikrotik.com/wiki/Serial_Port_Usage#Accessing_a_serial_device_from_within_RouterOS

Yes, I’ve tried this. Even I have made special-login user to talk with serial device directly. But this does not work for me. I need to make set of two devices RouterBoard + RS232 device and these set will send RS232 device provided data (fetch tool) to remote server even when RB is behind NAT or with dynamic address. That is because I need to read data from serial-terminal …

Thanks … :sunglasses:

I need do the same, some result?

Well, I’ve found this ugly solution which works for me, but it may not for you.
It is based on /port remote-access which allows to log serial console …

/port remote-access add allowed-addresses=0.0.0.0/0 channel=0 disabled=“no” log-file=“tm.dat” port=“serial0” protocol=“raw” tcp-port=0

… this will make /file tm.dat which will log console output (therefore you’ll need to manage its delete and recreate …) …

Something about it (in czech (use google to translate/or ask me)) is at http://www.papouch.com/cz/shop/product/tm-teplomer-mikrotik/

Hope it will help you :sunglasses:

great! i think it will help me! thank you!

just for your knowledge, i wanna do a power loss warning. Like something that will notice by the serial port when the power is loss.
But I think, i will have to do some serial controller to send any information (can be just a bit) to the mikrotik serial, mikrotik reads it them do some other thing to notice the NOC.

But you will need to send alarm via serial am I right ?

Our solution to alarm 230V blackout is based on 230V relay to connect to GIOM 300 with GSM module and so on … :sunglasses:

http://www.mikrovlny.cz/en/product/32

http://www.mikrovlny.cz/en/produkt/27

Solution revealed …
More on http://www.papouch.com/en/shop/product/tm-routerboard-thermometer-mikrotik/

:sunglasses: coool …