External button

Hi All,

For a project I need to enable/disable the WiFi interface from an external electrical contact. Is possible to use a button and a script to do this?

Thank you

Regards

Alessio

This is my first solution, using 2 ether ports (loop back on ether4 and ether5), when ether5 goes UP (by reley) the script Enable the wlan1. This is only a workaround…


# Checking ether5 link status:
:global "state"
:global "laststate"
/interface ethernet monitor ether5 once do={:set "state" $status}
:if ($"state" != $"laststate") do={
  :if ($"state" != "link-ok") do={
    # LINK DOWN
    /interface disable wlan1
  } else {
    # LINK UP
    /interface enable wlan1
  }
  :set "laststate" $"state"
}

Perhaps the router’s serial port could be used for that purpose; see http://www.papouch.com/en/shop/product/tm-routerboard-thermometer-mikrotik/ , which is a product that allows monitoring of an external switch, confirming that serial ports are usable for such purposes.