Init project
This commit is contained in:
parent
728ad0f981
commit
0f044a1de7
|
@ -0,0 +1,5 @@
|
||||||
|
install:
|
||||||
|
pip install -r requirements.txt
|
||||||
|
|
||||||
|
run:
|
||||||
|
FRITZ_PASSWORD=$$FRITZ_PASSWORD python main.py
|
|
@ -0,0 +1,34 @@
|
||||||
|
from itertools import count
|
||||||
|
|
||||||
|
from fritzconnection import FritzConnection
|
||||||
|
from fritzconnection.core.exceptions import FritzServiceError
|
||||||
|
from fritzconnection.core.fritzconnection import os
|
||||||
|
|
||||||
|
|
||||||
|
def turn_of_wlan(fc):
|
||||||
|
result = []
|
||||||
|
action = "SetEnable"
|
||||||
|
for n in count(1):
|
||||||
|
service = f"WLANConfiguration{n}"
|
||||||
|
try:
|
||||||
|
fc.call_action(service, action, NewEnable=False)
|
||||||
|
except FritzServiceError:
|
||||||
|
break
|
||||||
|
result.append(f"Turned off {service}")
|
||||||
|
return result
|
||||||
|
|
||||||
|
|
||||||
|
def main(address, password):
|
||||||
|
fc = FritzConnection(address=address, password=password)
|
||||||
|
for result in turn_of_wlan(fc):
|
||||||
|
print(f"{result}")
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
try:
|
||||||
|
password = os.environ["FRITZ_PASSWORD"]
|
||||||
|
except KeyError:
|
||||||
|
print("Error: FRITZ_PASSWORD environment variable not set.")
|
||||||
|
exit(1)
|
||||||
|
|
||||||
|
main(address="192.168.178.1", password=password)
|
|
@ -0,0 +1 @@
|
||||||
|
fritzconnection==1.13.2
|
Loading…
Reference in New Issue