avm_sid.py aktualisiert
This commit is contained in:
54
avm_sid.py
54
avm_sid.py
@@ -16,6 +16,12 @@ import requests
|
||||
|
||||
LOGIN_SID_ROUTE = "/login_sid.lua?version=2"
|
||||
|
||||
global login_user
|
||||
global login_pw
|
||||
|
||||
login_user = "fritzuser"
|
||||
login_pw = "fritzpw"
|
||||
|
||||
class LoginState:
|
||||
def __init__(self, challenge: str, blocktime: int):
|
||||
self.challenge = challenge
|
||||
@@ -99,14 +105,13 @@ def send_response(box_url: str, username: str, challenge_response: str) ->str:
|
||||
|
||||
def lights_on():
|
||||
url = 'http://192.168.178.1'
|
||||
username = 'hier_user_eintragen'
|
||||
password = 'hier_pw_eintragen'
|
||||
username = login_user
|
||||
password = login_pw
|
||||
sid = get_sid(url, username, password)
|
||||
print(f"Successful login for user: {username}")
|
||||
print(f"sid: {sid}")
|
||||
fritzurl = 'http://192.168.178.1/webservices/homeautoswitch.lua'
|
||||
ain = 'Z881A14FFFE2345EC01' #esstisch
|
||||
#ain = 'Z881A14FFFE23467A01' #julius
|
||||
ain = 'eureAINgeraet'
|
||||
|
||||
#payload_get_switch_list = {'switchcmd': 'getdevicelistinfos', 'sid': sid}
|
||||
payload_on = {'ain': ain, 'switchcmd': 'setswitchon', 'sid': sid}
|
||||
@@ -115,14 +120,43 @@ def lights_on():
|
||||
|
||||
def lights_off():
|
||||
url = 'http://192.168.178.1'
|
||||
username = 'hier_user_eintragen'
|
||||
password = 'hier_pw_eintragen'
|
||||
username = login_user
|
||||
password = login_pw
|
||||
sid = get_sid(url, username, password)
|
||||
print(f"Successful login for user: {username}")
|
||||
print(f"sid: {sid}")
|
||||
fritzurl = 'http://192.168.178.1/webservices/homeautoswitch.lua'
|
||||
ain = 'Z881A14FFFE2345EC01' #esstisch
|
||||
#ain = 'Z881A14FFFE23467A01' #julius
|
||||
ain = 'eureAINgeraet'
|
||||
|
||||
#payload_get_switch_list = {'switchcmd': 'getdevicelistinfos', 'sid': sid}
|
||||
payload_on = {'ain': ain, 'switchcmd': 'setswitchon', 'sid': sid}
|
||||
payload_off = {'ain': ain, 'switchcmd': 'setswitchoff', 'sid': sid}
|
||||
x = requests.get(fritzurl, params=payload_off)
|
||||
|
||||
def coffee_on():
|
||||
url = 'http://192.168.178.1'
|
||||
username = login_user
|
||||
password = login_pw
|
||||
sid = get_sid(url, username, password)
|
||||
print(f"Successful login for user: {username}")
|
||||
print(f"sid: {sid}")
|
||||
fritzurl = 'http://192.168.178.1/webservices/homeautoswitch.lua'
|
||||
ain = 'eureAINgeraet'
|
||||
|
||||
#payload_get_switch_list = {'switchcmd': 'getdevicelistinfos', 'sid': sid}
|
||||
payload_on = {'ain': ain, 'switchcmd': 'setswitchon', 'sid': sid}
|
||||
payload_off = {'ain': ain, 'switchcmd': 'setswitchoff', 'sid': sid}
|
||||
x = requests.get(fritzurl, params=payload_off)
|
||||
|
||||
def coffee_off():
|
||||
url = 'http://192.168.178.1'
|
||||
username = login_user
|
||||
password = login_pw
|
||||
sid = get_sid(url, username, password)
|
||||
print(f"Successful login for user: {username}")
|
||||
print(f"sid: {sid}")
|
||||
fritzurl = 'http://192.168.178.1/webservices/homeautoswitch.lua'
|
||||
ain = 'eureAINgeraet'
|
||||
|
||||
#payload_get_switch_list = {'switchcmd': 'getdevicelistinfos', 'sid': sid}
|
||||
payload_on = {'ain': ain, 'switchcmd': 'setswitchon', 'sid': sid}
|
||||
@@ -131,8 +165,8 @@ def lights_off():
|
||||
|
||||
def main():
|
||||
url = 'http://192.168.178.1'
|
||||
username = 'hier_user_eintragen'
|
||||
password = 'hier_pw_eintragen'
|
||||
username = login_user
|
||||
password = login_pw
|
||||
sid = get_sid(url, username, password)
|
||||
print(f"Successful login for user: {username}")
|
||||
print(f"sid: {sid}")
|
||||
|
||||
Reference in New Issue
Block a user