# Script to ensure wireless lan radio Power Safer is ON or OFF # # To use in Tropical, Hot Countrys, where have extremly

Script to ensure wireless lan radio Power Safer is ON or OFF

To use in Tropical, Hot Countrys, where have extremly high Daytime Temperatures

between user selected times

The radio ON/OFF operation will not be performed if the system

clock is not in sync with local time, unless so required

Remember router is set back to default time after a reboot

Schedule this script at required intervals

Power Safer ON ( /interface $RadioName tx-power=20 tx-power-mode=all-rates-fixed )

Power Safer OFF ( /interface $RadioName tx-power-mode=default )

#####################################

Set the Radio Power Safer ON and OFF times here

:local SaferOnTime “07:00”;
:local SaferOffTime “20:00”;

set to “no” if clock is being set manually after each reboot

set to “yes” if clock is being set using NTP client

:local UseNTPClientStatus “yes”;
#####################################

:log info “RadioOnOff Script Starting”;

get the name of the wlan radio interface

:local RadioName [/interface get [find type=wlan] name];
:log info “Radio Name = $RadioName”;

First check if system clock has been syncronized with local time

:local NTPSyncState [/system ntp client get status];
:log info “NTP Client Status = $NTPSyncState”;

Don’t perform radio On or Off operation, if current real time is unknown, unless required

:if (($NTPSyncState=“synchronized”) or ($UseNTPClientStatus=“no”)) do {

:local CurrentTime [/system clock get time];
:log info “Current Time = $CurrentTime”;

Check current ON or OFF status of Safer Mode

:local SaferOff [/interface get $RadioName default tx-power-mode]; # I think the Problem is here !!! #
:log info “Safer Off = $Radio Safer Off”;

\

Where the ON time is set earlier than the OFF time

:if ($SaferOnTime < $SaferOffTime) do {

Radio should be ON between these times

:if (($CurrentTime > $SaferOnTime) and ($CurrentTime < $SaferOffTime)) do {

if ($SaferOff=true) do {
:log info “Safer was OFF, now switching ON”;
/interface set $RadioName tx-power=20 tx-power-mode=all-rates-fixed;
}
} else {

if ($SaferOff=false) do {
:log info “Safer was ON, now switching OFF”;
/interface set $RadioName tx-power-mode=default;
}

}

}

Where the ON time is set later than the OFF time

:if ($SaferOnTime > $SaferOffTime) do {

Safer should be OFF between these times

:if (($CurrentTime < $SaferOnTime) and ($CurrentTime > $SaferOffTime)) do {

if ($SaferDisabled=false) do {
:log info “Safer was ON, now switching OFF”;
/interface set $RadioName tx-power-mode=default;
}
} else {

if ($SaferDisabled=true) do {
:log info “Safer was OFF, now switching ON”;
/interface set $RadioName tx-power=20 tx-power-mode=all-rates-fixed;
}

}

}

} else {

:log info “System clock may not be synchronized to local time, unable to perform operation”;

}

:log info “SaferOnOff Script completed”;



This Script doesn’t Work, Who can Help me to edit the Script to Run with Router Os 6.31, I’ve createt a Hotspot Network with any Groove’s in WDS, Antena Omni Hyperlink 15 Dbi, my Link is only for Android and Portable Devices, I do not work with long distances, Iám living in Brazil and here we have very high Daytime Temperatures, Groove comes over 55C, because this I think is better to work with low TX Power by Day and use Default TX Power by the Night.

What about having two scrips (on/off) running by scheduler in desired time instead continuously run a script that would be checking the time?