Skip to content

Instantly share code, notes, and snippets.

@chris03
Created September 29, 2023 16:02
Show Gist options
  • Select an option

  • Save chris03/5de87821a25102167fd94b99e000295a to your computer and use it in GitHub Desktop.

Select an option

Save chris03/5de87821a25102167fd94b99e000295a to your computer and use it in GitHub Desktop.
#!/usr/bin/python3
# pip install sagemcom_api
import asyncio
import urllib.parse
from sagemcom_api.enums import EncryptionMethod
from sagemcom_api.client import SagemcomClient
from getpass import getpass
HOST = "192.168.2.1"
USERNAME = "admin"
PASSWORD = getpass()
ENCRYPTION_METHOD = EncryptionMethod.SHA512 # or EncryptionMethod.MD5
async def main() -> None:
async with SagemcomClient(HOST, USERNAME, PASSWORD, ENCRYPTION_METHOD) as client:
try:
await client.login()
except Exception as exception: # pylint: disable=broad-except
print(exception)
return
# Print device information of Sagemcom F@st router
device_info = await client.get_device_info()
print(f"Device: {device_info.id} {device_info.model_name}")
print("Disable 2.4GHz")
await client.set_value_by_xpath(urllib.parse.quote("Device/WiFi/Radios/Radio[Alias='RADIO2G4']/Enable"), "false")
print("Disable 5GHz")
await client.set_value_by_xpath(urllib.parse.quote("Device/WiFi/Radios/Radio[Alias='RADIO5G']/Enable"), "false")
print("Disable 6GHz")
await client.set_value_by_xpath(urllib.parse.quote("Device/WiFi/Radios/Radio[Alias='RADIO6G']/Enable"), "false")
asyncio.run(main())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment