Turn WLAN off/on via scheduler and Mode Button (adapted to latest RouterOS version)

Hello fellow members,

I have been discovering the world of RouterOS for the past two weeks. The help and knowledge of the members here is immense and I am really grateful for all the explanations. As it is, I was not able to find a script that was working straight with the RouterOS 7.x release. So as a reference for beginners like me, I am posting a working script for RouterOS 7.14.3.
There were two major changes that had to be made to available references (a. http://forum.mikrotik.com/t/schedule-to-enable-and-disable-interface-in-mikrotik/117113/1 , b. http://forum.mikrotik.com/t/mikrotik-mode-button-and-wlan2/138703/1 c. goyoambrosio.com/2017/05/how-to-turn-off-wifi-at-night-in-mikrotik-routeros/, d. http://forum.mikrotik.com/t/scheduler-wi-fi-off-on-at-night/154230/1

Change 1. “/Interface wireless” becomes “/Interface wifi
Change 2. if ([/interface wireless get wifi1 disabled]=no) becomes if ([/interface wifi get wifi1 disabled]=false)

As you will immediately recognise, the default script for LED dark mode follows the deactivation of WLAN (and also 4G / LTE):


:if ([/interface get wifi1 disabled]=false) do={
	/interface wifi disable [find]
	/log info "WiFi turned off"
	/interface lte disable [find]
	/log info "LTE turned off"
        /system leds settings set all-leds-off=immediate 
	} else={
	/interface wifi enable [find]
	/log info "WiFi turned on"
	/interface lte enable [find]
	/log info "LTE turned on"
        /system leds settings set all-leds-off=never
}

Now, to make it interesting to experienced users and to further improve myself:

  • Is there a way not to check if wifi1 is enabled but the whole wifi interface ?
    I have tried

log info “” or log info message “”

to no avail: I am not getting a log entry for the action

Thanks for reading and any comment of improvement.
Regards
CosyChateau