Use cron to adjust wifi signal strength

Hi.
I am using OpenWRT on a TP-Link TL-WDR4300 v1 (and shortly also a Ubiquiti UniFi UAP AC Lite).
Is it possible to create a macro and use cron to schedule it, so that the wifi broadcast strength is reduced at night?
Many thanks in advance for any help received.

2 Likes

@jdkp, welcome to the community.

Yes, it's possible. Just cron the commands/script that edits that and commits.

Something like:

uci set wireless.radio0.txpower='13'
uci commit

?

1 Like

Thank @aboaboit, I edit the files...so thanks for the command UCI pseudocode example!

@jdkp, be sure to look at the Wiki and your own device to ensure it's: named radio0, correct maximum power, etc.

1 Like

I also edit the files normally but I got curious to try this way since my first idea was a direct call to "iw" :smiley:

1 Like

Thanks for the welcome and not least the help.
Good to know its possible but now I need to read the wiki through to see how to do it in practice with an ssh connection :grinning:

2 Likes

Through SSH, you edit /etc/crontabs/root to add to the cron.

Great! Many thanks. I’ll give it a go tomorrow :wink:

1 Like

Hello, good idea. I tried to add it to cron, but no change. On cli command is working fine.
I created wifidown.sh chmoded -X and added to cron but still not working. Can you help me?

wifidown.sh
#/bin/sh
/sbin/uci set wireless.radio0.txpower='5'
/sbin/uci commit
/sbin/wifi reload

wifiup.sh
#/bin/sh
/sbin/uci set wireless.radio0.txpower='20'
/sbin/uci commit
/sbin/wifi reload

in cron:
53 13 * * * /bin/sh /skripty/wifidown.sh

time is because of testing

edit:
I tried running script manually via cli and change was applied.

edit2 solved by enabling and starting cron. (I thinkd, it is enabled :open_mouth:

1 Like

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.