Closed Shariner closed 1 month ago
Fixed by edited the both functions to:
def connect_data(self):
cookie = self.getCookie(password=self.password, LD=self.get_LD())
AD = self.get_AD()
header = {"Referer": self.referer, "Cookie": cookie}
payload = f'isTest=false&goformId=CONNECT_NETWORK&AD=' + AD
print(payload)
r = s.post(self.referer + "goform/goform_set_cmd_process", headers=header, data=payload, verify=False)
return r.status_code
def disconnect_data(self):
cookie = self.getCookie(password=self.password, LD=self.get_LD())
AD = self.get_AD()
header = {"Referer": self.referer, "Cookie": cookie}
payload = f'isTest=false&goformId=DISCONNECT_NETWORK&AD=' + AD
print(payload)
r = s.post(self.referer + "goform/goform_set_cmd_process", headers=header, data=payload, verify=False)
return r.status_code
Maybe you edit it, or I have to make some modifications to your integration, by goal is it to change the network from 5G NSA to 5G SA later. I can create a push commit i na few days/weeks including this fix. (and i don't know if this is specific for MC888 and will breakt operation on MC801 and MC899.
You can push it, i think this is the only part i didnt test it :) but it should work for all models
@Kajkac
where can I spend you a beer, this integration is amazing work. I was looking a few hours for options to control my router. I first wanted to go with NodeRED pupeteer, but couldn't install a browser on HA.
Then i wanted to go with python selenium - but the webdriver could't be loaded. I am very glad that this Router is very "easy" to access, once you made the authentication and recorded the network traffic with post/get commands.
I was having the same problem, i bought the router and have issues with this data switching so i went find all about zte goform system, first edition was apache php code, dont ask it :) (snifing the data of some chinese android app to get the methods and stuff) that was me trying to do anything, and i am not even developer or have any knowledge about python , php etc… i am mainly powershell and system engineer. Authentication was pain in the a*** no documentation online. So after numerus trial and errors i did the python edition, and few weeks ago i did have time to make home assistant full integration edition, which is not perfect but it will improve it by time. For now i have mc889, 801 and 888 at home, and when g5 ultra gets available i will bought that.
Hey,
yeah funny thing, I installed your old integration and wrote my own disconnect data/connect data functions - working.
Then I found your new integration, installed it and the disconnect button does not work..
Failed to execute Disconnect Data command: Command '['python3', '/config/custom_components/zte_router/mc.py', '192.168.1.1', 'XXXXXXXX', '10']' returned non-zero exit status 1. Failed to execute Connect Data command: Command '['python3', '/config/custom_components/zte_router/mc.py', '192.168.1.1', 'XXXXXXX', '9']' returned non-zero exit status 1.
Do you have an idea whats causing this, i will trouble shoot on my own in the next days. At first look, i couldn't find any problem. The FormID is correct for the MC888
Best regards