Skip to main content

Compal-Wifi-Switch

PyPI PyPI - Python Version

Project Maintenance License

Build Status Deploy Status

A command line tool to switch on/off the wifi signal of a Compal-CH7465LG cablemodem.

Turn wifi signal off when not in use! Compal-CH7465LG cablemodem front with UPC design Compal-CH7465LG cablemodem back

Wifi radiation should be turned off if not used (better for your health and for IT security reasons). Unfortunattly the Compal-CH7465LG cablemodem does not offer a physical button to switch on/off the wifi signal. There is also no configuration available to switch the wifi signal on/off based on a time schedule.

The compal-wifi-switch tool can switch the wifi signal on/off via a command line interface. The tool can be installed on any device where Python3 runtime is available (NAS, Raspberry Pi, etc.). To schedule compal-wifi-switch you can use any scheduling mechanism (e.g. cron, Synology task scheduler, ...).

For the use within Home Assistant use the custom component hass-compal-wifi.

This module is not official developed, supported or endorsed by Compal.

Installation

Using pip

  1. Install python3.7 or higher
  2. Install compal-wifi-switch with pip install compal-wifi-switch.
  3. Run compal-wifi-switch with compal-wifi-switch --help.

Without pip (e.g. on Synology DSM)

  1. Download package from PyPi (tar.gz) to your server.
  2. Run the following commands:
# Install
user@dsm:~> tar xfv compal-wifi-switch-<version>.tar.gz
user@dsm:~> cd compal-wifi-switch-<version>
user@dsm:~/compal-wifi-switch> python3 setup.py install --user

# Run
user@dsm:~> python3 ~/compal-wifi-switch-<version>/compal_wifi_switch/main.py --help

Usage

General syntax

usage: compal-wifi-switch [-h] [--version] {status,switch,reboot} ...

Compal-Wifi-Switch configuration

optional arguments:
  -h, --help       show this help message and exit
  --version, -v    show program's version number and exit

command:
  {status,switch}
    status         shows the current status of the cablemodem
    switch         switches the wifi state of the cabelmodem  
    reboot         reboots the cabelmodem      

Command switch

Usage

usage: compal-wifi-switch switch [-h] [--band {2g,5g,all}] [--guest]
                      [--pause PAUSE] [--host HOST] [--password PASSWORD]
                      [--verbose]
                      {on,off}

positional arguments:
  switch
  {on,off}

optional arguments:
  -h, --help            show this help message and exit
  --band {2g,5g,all}, -b {2g,5g,all}
                        band to switch power state for (default = all)
  --guest, -g           activate guest network while switching ON wifi
  --pause PAUSE, -p PAUSE
                        number of seconds to pause after wifi state change
                        (default = 60); when the pause is too short, the
                        following modem commands may block forever
  --host HOST           host name or IP of compal cablemodem, or use env
                        variable COMPAL_WIFI_SWITCH_HOST
  --password PASSWORD   password of compal cablemodem, or use env variable
                        COMPAL_WIFI_SWITCH_PASSWORD
  --verbose             verbose logging

Example

To enable the wifi signal for the 2GHz band including the activation of the guest network, use the following command:

> compal-wifi-switch switch on --host 192.168.0.1 --password <YOUR_PW> --band 2g --guest

Switching wifi ON (band = 2g)
Wait 60s till wifi state is changed ...
Finished.

Command status

Usage

usage: main.py status [-h] [--format {json,text}] [--host HOST]
                      [--password PASSWORD] [--verbose]

positional arguments:
  status

optional arguments:
  -h, --help            show this help message and exit
  --format {json,text}, -f {json,text}
                        output format
  --host HOST           host name or IP of compal cablemodem, or use env
                        variable COMPAL_WIFI_SWITCH_HOST
  --password PASSWORD   password of compal cablemodem, or use env variable
                        COMPAL_WIFI_SWITCH_PASSWORD
  --verbose             verbose logging

Example

To show the status of the wifi signal, use the following command:

> compal-wifi-switch status --host 192.168.0.1 --password <YOUR_PW>

==============================================================
 Modem
==============================================================
 Model               : CH7465LG
 HW Version          : 5.01
 SW Version          : CH7465LG-NCIP-6.15.31p1-NOSH
 Serial Number       : ************
 Modem MAC Address   : **:**:**:**:**:**
 Operator ID         : LIBERTYGLOBAL
 Network Mode        : IPv4
 Uptime              : 50day(s)0h:12m:28s

==============================================================
 WIFI BANDS
==============================================================
 State Band Hidden SSID
 ----- ---- ------ ----------------
 ON    2g   OFF    FRIMTEC
 OFF   5g   OFF    FRIMTEC

==============================================================
 WIFI GUEST NETWORKS
==============================================================
 State Band MAC               Hidden SSID
 ----- ---- ----------------- ------ ----------------
 ON    2g   92:5C:34:DD:6F:0A OFF    FRIMTEC-GUEST
 OFF   5g   92:5C:44:DD:6D:CA OFF    FRIMTEC-GUEST

Command reboot

Usage

usage: compal-wifi-switch reboot [-h] [--host HOST] [--password PASSWORD] [--verbose]

positional arguments:
  reboot

optional arguments:
  -h, --help           show this help message and exit
  --host HOST          host name or IP of compal cablemodem, or use env
                       variable COMPAL_WIFI_SWITCH_HOST
  --password PASSWORD  password of compal cablemodem, or use env variable
                       COMPAL_WIFI_SWITCH_PASSWORD
  --verbose            verbose logging

Example

To reboot the cabelmodem, use the following command:

> compal-wifi-switch reboot --host 192.168.0.1 --password <YOUR_PW>

Credits

Metadata

Release files for compal-wifi-switch 1.2.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for compal-wifi-switch 1.2.2
File Size Uploaded
compal-wifi-switch-1.2.2.tar.gz 11.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for compal-wifi-switch 1.2.2
File Interpreter ABI Platform
compal_wifi_switch-1.2.2-py3-none-any.whl Python 3 none any Details

Total release size: 23.0 kB

Release files / compal-wifi-switch-1.2.2.tar.gz

Download URL compal-wifi-switch-1.2.2.tar.gz
Size 11.2 kB
Tags Source
SHA-256 checksum
How to use checksums
8cb4791fceb1b3e3ce1a6b306e338b1f3ff0d0f8dc1d35c6b9b0e5ce25b8e967
BLAKE2b-256 checksum
How to use checksums
4cf4ad5813704d3b803f9b0f302ea3d3bd28f1a75d0069fdf07c3ffb95f622b2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.9.13

Release files / compal_wifi_switch-1.2.2-py3-none-any.whl

Download URL compal_wifi_switch-1.2.2-py3-none-any.whl
Size 11.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
103575b885cbb91f1e64f76b3b72dd64216e01e5693b89b899a5c2b08825b698
BLAKE2b-256 checksum
How to use checksums
61c094c98bbde6c8f092b2534451134eb56e9660dacee7b98b7a0b5f2aaedc5d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.9.13

Release history Release notifications | RSS feed

This release

1.2.2 This release

2 release files

1.2.1

2 release files

1.2.0

2 release files

1.1.6

2 release files

1.1.5

2 release files

1.1.4

2 release files

1.1.3

2 release files

1.1.2

2 release files

1.1.1

2 release files

1.1.0

2 release files

1.0.7

2 release files

1.0.6

2 release files

1.0.5

2 release files

1.0.4

2 release files

1.0.3

2 release files

1.0.2

2 release files

1.0.1

2 release files

1.0.0

2 release files

0.2.0

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page