luci/applications/luci-app-wifischedule
Hosted Weblate eabf1d020f Translated using Weblate (Polish)
Currently translated at 100.0% (139 of 139 strings)

Translation: OpenWrt/LuCI/applications/adblock-fast
Translate-URL: https://hosted.weblate.org/projects/openwrt/luciapplicationsadblock-fast/pl/

Translated using Weblate (Polish)

Currently translated at 100.0% (127 of 127 strings)

Translation: OpenWrt/LuCI/applications/pbr
Translate-URL: https://hosted.weblate.org/projects/openwrt/luciapplicationspbr/pl/

Translated using Weblate (Polish)

Currently translated at 100.0% (211 of 211 strings)

Translation: OpenWrt/LuCI/applications/dockerman
Translate-URL: https://hosted.weblate.org/projects/openwrt/luciapplicationsdockerman/pl/

Translated using Weblate (Polish)

Currently translated at 100.0% (52 of 52 strings)

Translation: OpenWrt/LuCI/applications/ttyd
Translate-URL: https://hosted.weblate.org/projects/openwrt/luciapplicationsttyd/pl/

Translated using Weblate (Polish)

Currently translated at 100.0% (38 of 38 strings)

Translation: OpenWrt/LuCI/applications/advanced-reboot
Translate-URL: https://hosted.weblate.org/projects/openwrt/luciapplicationsadvanced-reboot/pl/

Translated using Weblate (Polish)

Currently translated at 100.0% (33 of 33 strings)

Translated using Weblate (Polish)

Currently translated at 100.0% (374 of 374 strings)

Translated using Weblate (Polish)

Currently translated at 100.0% (2264 of 2264 strings)

Translation: OpenWrt/LuCI/modules/luci-base
Translate-URL: https://hosted.weblate.org/projects/openwrt/luci/pl/

Translated using Weblate (Lithuanian)

Currently translated at 20.4% (10 of 49 strings)

Translated using Weblate (Lithuanian)

Currently translated at 12.0% (15 of 124 strings)

Translation: OpenWrt/LuCI/applications/nlbwmon
Translate-URL: https://hosted.weblate.org/projects/openwrt/luciapplicationsnlbwmon/lt/

Translated using Weblate (Lithuanian)

Currently translated at 6.0% (8 of 133 strings)

Translated using Weblate (Lithuanian)

Currently translated at 51.0% (71 of 139 strings)

Translation: OpenWrt/LuCI/applications/https-dns-proxy
Translate-URL: https://hosted.weblate.org/projects/openwrt/luciapplicationshttps-dns-proxy/lt/

Translated using Weblate (Lithuanian)

Currently translated at 41.1% (14 of 34 strings)

Translation: OpenWrt/LuCI/applications/wifischedule
Translate-URL: https://hosted.weblate.org/projects/openwrt/luciapplicationswifischedule/lt/

Translated using Weblate (Lithuanian)

Currently translated at 9.8% (37 of 374 strings)

Translated using Weblate (Lithuanian)

Currently translated at 62.1% (1408 of 2264 strings)

Translation: OpenWrt/LuCI/modules/luci-base
Translate-URL: https://hosted.weblate.org/projects/openwrt/luci/lt/

Translated using Weblate (Polish)

Currently translated at 100.0% (195 of 195 strings)

Translation: OpenWrt/LuCI/applications/travelmate
Translate-URL: https://hosted.weblate.org/projects/openwrt/luciapplicationstravelmate/pl/

Translated using Weblate (Chinese (Simplified))

Currently translated at 100.0% (195 of 195 strings)

Translation: OpenWrt/LuCI/applications/travelmate
Translate-URL: https://hosted.weblate.org/projects/openwrt/luciapplicationstravelmate/zh_Hans/

Translated using Weblate (Russian)

Currently translated at 100.0% (195 of 195 strings)

Translation: OpenWrt/LuCI/applications/travelmate
Translate-URL: https://hosted.weblate.org/projects/openwrt/luciapplicationstravelmate/ru/

Translated using Weblate (Lithuanian)

Currently translated at 61.9% (1402 of 2264 strings)

Translation: OpenWrt/LuCI/modules/luci-base
Translate-URL: https://hosted.weblate.org/projects/openwrt/luci/lt/

Translated using Weblate (Italian)

Currently translated at 100.0% (2264 of 2264 strings)

Translation: OpenWrt/LuCI/modules/luci-base
Translate-URL: https://hosted.weblate.org/projects/openwrt/luci/it/

Translated using Weblate (Spanish)

Currently translated at 55.5% (111 of 200 strings)

Translation: OpenWrt/LuCI/applications/smartdns
Translate-URL: https://hosted.weblate.org/projects/openwrt/luciapplicationssmartdns/es/

Translated using Weblate (Russian)

Currently translated at 100.0% (279 of 279 strings)

Translated using Weblate (Russian)

Currently translated at 100.0% (374 of 374 strings)

Translated using Weblate (Spanish)

Currently translated at 94.9% (355 of 374 strings)

Translated using Weblate (Russian)

Currently translated at 100.0% (2264 of 2264 strings)

Translation: OpenWrt/LuCI/modules/luci-base
Translate-URL: https://hosted.weblate.org/projects/openwrt/luci/ru/

Translated using Weblate (Spanish)

Currently translated at 95.4% (2162 of 2264 strings)

Translation: OpenWrt/LuCI/modules/luci-base
Translate-URL: https://hosted.weblate.org/projects/openwrt/luci/es/

Co-authored-by: Džiugas J <dziugas1959@hotmail.com>
Co-authored-by: Eric <hamburger2048@users.noreply.hosted.weblate.org>
Co-authored-by: Franco Castillo <castillofrancodamian@gmail.com>
Co-authored-by: Hosted Weblate <hosted@weblate.org>
Co-authored-by: Matthaiks <kitynska@gmail.com>
Co-authored-by: Random <random-r@users.noreply.hosted.weblate.org>
Co-authored-by: st7105 <st7105@gmail.com>
Signed-off-by: Džiugas J <dziugas1959@hotmail.com>
Signed-off-by: Eric <hamburger2048@users.noreply.hosted.weblate.org>
Signed-off-by: Franco Castillo <castillofrancodamian@gmail.com>
Signed-off-by: Matthaiks <kitynska@gmail.com>
Signed-off-by: Random <random-r@users.noreply.hosted.weblate.org>
Signed-off-by: st7105 <st7105@gmail.com>
Translate-URL: https://hosted.weblate.org/projects/openwrt/luciapplicationscommands/pl/
Translate-URL: https://hosted.weblate.org/projects/openwrt/luciapplicationsfirewall/ru/
Translate-URL: https://hosted.weblate.org/projects/openwrt/luciapplicationsnut/lt/
Translate-URL: https://hosted.weblate.org/projects/openwrt/luciapplicationsstatistics/es/
Translate-URL: https://hosted.weblate.org/projects/openwrt/luciapplicationsstatistics/lt/
Translate-URL: https://hosted.weblate.org/projects/openwrt/luciapplicationsstatistics/pl/
Translate-URL: https://hosted.weblate.org/projects/openwrt/luciapplicationsstatistics/ru/
Translate-URL: https://hosted.weblate.org/projects/openwrt/luciapplicationsupnp/lt/
Translation: OpenWrt/LuCI/applications/commands
Translation: OpenWrt/LuCI/applications/firewall
Translation: OpenWrt/LuCI/applications/nut
Translation: OpenWrt/LuCI/applications/statistics
Translation: OpenWrt/LuCI/applications/upnp
2023-10-27 17:21:58 +03:00
..
luasrc applications: add ACL dependency annotations to legacy controllers 2020-04-19 17:17:26 +02:00
po Translated using Weblate (Polish) 2023-10-27 17:21:58 +03:00
root/usr/share/rpcd/acl.d treewide: stage ACL rules for legacy applications 2020-04-10 23:21:35 +02:00
Makefile applications: add missing dependency to luci-base 2023-09-24 11:11:42 +03:00
README.md treewide: Fix typos in comments 2018-10-10 15:00:07 +08:00

wifischedule

Turns WiFi on and off according to a schedule on an openwrt router

Components

  • wifischedule: Shell script that creates cron jobs based on configuration provided in UCI and does all the other logic of enabling and disabling wifi with the use of /sbin/wifi and /usr/bin/iwinfo. Can be used standalone.
  • luci-app-wifischedule: LUCI frontend for creating the UCI configuration and triggering the actions. Depends on wifischedule.

Use cases

You can create user-defined events when to enable or disable WiFi. There are various use cases why you would like to do so:

  1. Reduce power consumption and therefore reduce CO2 emissions.
  2. Reduce emitted electromagnatic radiation.
  3. Force busincess hours when WiFi is available.

Regarding 1: Please note, that you need to unload the wireless driver modules in order to get the most effect of saving power. In my test scenario only disabling WiFi saves about ~0.4 Watt, unloading the modules removes another ~0.4 Watt.

Regarding 2: Think of a wireless accesspoint e.g. in your bedrom, kids room where you want to remove the amount of radiation emitted.

Regarding 3: E.g. in a company, why would wireless need to be enabled weekends if no one is there working? Or think of an accesspoint in your kids room when you want the youngsters to sleep after 10 pm instead of facebooking...

Configuration

You can create an arbitrary number of schedule events. Please note that there is on sanity check done whether the start / stop times overlap or make sense. If start and stop time are equal, this leads to disabling the WiFi at the given time.

Logging if enabled is done to the file /var/log/wifi_schedule.log and can be reviewed through the "View Logfile" tab. The cron jobs created can be reviewed through the "View Cron Jobs" tab.

Please note that the "Unload Modules" function is currently considered as experimental. You can manually add / remove modules in the text field. The button "Determine Modules Automatically" tries to make a best guess determining regarding the driver module and its dependencies. When un-/loading the modules, there is a certain number of retries (module_load) performed.

The option "Force disabling wifi even if stations associated" does what it says - when activated it simply shuts down WiFi. When unchecked, its checked every recheck_interval minutes if there are still stations associated. Once the stations disconnect, WiFi is disabled.

Please note, that the parameters module_load and recheck_interval are only accessible through uci.

UCI Configuration wifi_schedule

UCI configuration file: /etc/config/wifi_schedule:

config global
        option logging '0'
        option enabled '0'
        option recheck_interval '10'
        option modules_retries '10'

config entry 'Businesshours'
        option enabled '0'
        option daysofweek 'Monday Tuesday Wednesday Thursday Friday'
        option starttime '06:00'
        option stoptime '22:00'
        option forcewifidown '0'

config entry 'Weekend'
        option enabled '0'
        option daysofweek 'Saturday Sunday'
        option starttime '00:00'
        option stoptime '00:00'
        option forcewifidown '1'

Script: wifi_schedule.sh

This is the script that does the work. Make your changes to the UCI config file: /etc/config/wifi_schedule

Then call the script as follows in order to get the necessary cron jobs created:

wifi_schedule.sh cron

All commands:

wifi_schedule.sh cron|start|stop|forcestop|recheck|getmodules|savemodules|help

    cron: Create cronjob entries.
    start: Start wifi.
    stop: Stop wifi gracefully, i.e. check if there are stations associated and if so keep retrying.
    forcestop: Stop wifi immediately.
    recheck: Recheck if wifi can be disabled now.
    getmodules: Returns a list of modules used by the wireless driver(s)
    savemodules: Saves a list of automatic determined modules to UCI
    help: This description.