Hi,
just wanted to add to a closed topic (of the same subject) that I found very helpful. I noticed that the solution uses the uci system, and seems to update the config on the flash twice a day. I know it's not a big deal, but I've worn out the flash on several devices by inadvertently writing to them every day. So I thought I'd offer an alternative.
It works just as well to make these ephemeral changes using the low level wireless Utilities talked abut here: https://openwrt.org/docs/guide-user/network/wifi/wireless-tool/wireless.utilities
Here are my updated power control scripts:
cd /root
cat <<EOF > wifidown.sh
#/bin/sh
lowpower=1
# The old way that rewrites the config on the flash card each time
# /sbin/uci set wireless.radio0.txpower="$lowpower"
# /sbin/uci set wireless.radio1.txpower="$lowpower"
# /sbin/uci commit wireless
# /sbin/wifi reload
# The new way, that just changes the driver parameter
iw phy phy0 set txpower limit "${lowpower%%.*}00"
iw phy phy1 set txpower limit "${lowpower%%.*}00"
EOF
cat <<EOF > wifiup.sh
#/bin/sh
hipower=15
# The old way that rewrites the config on the flash card each time
# /sbin/uci set wireless.radio0.txpower="$hipower"
# /sbin/uci set wireless.radio1.txpower="$hipower"
# /sbin/uci commit wireless
# /sbin/wifi reload
# The new way, that just changes the driver parameter
iw phy phy0 set txpower limit "${hipower%%.*}00"
iw phy phy1 set txpower limit "${hipower%%.*}00"
EOF
Now go over to System --> Scheduled Tasks, and add:
# (Crontab for root)
# m h dom mon dow command
# Turn WiFi power down at night.
30 7 * * * /root/wifiup.sh
0 23 * * * /root/wifidown.sh
Happy Trails!