Closed OomJ closed 4 years ago
Fix issue within encoding of the password Domoticz 2020.1
def onConnect(self, Connection, Status, Description): if (Status == 0): Domoticz.Debug("Growatt connected successfully.") password=Parameters["Mode3"] password_md5 = hashlib.md5(password.encode("utf-8")).hexdigest() for i in range(0, len(password_md5), 2): if password_md5[i] == "0": password_md5 = password_md5[0:i] + "c" + password_md5[i + 1 :] sendData = { 'Verb' : 'POST', 'URL' : '/newTwoLoginAPI.do', 'Headers' : self.apiRequestHeaders(), 'Data': "password="+password_md5+"&userName="+Parameters["Mode2"] } Domoticz.Debug("Step 1. Login SendData: "+str(sendData)) Connection.Send(sendData) UpdateDevice(Unit=3, nValue=1, sValue="On", TimedOut=0) # Inverter device is on else: Domoticz.Log("Failed to connect ("+str(Status)+") to: "+Parameters["Address"]+":"+Parameters["Mode1"]+" with error: "+Description) UpdateDevice(Unit=3, nValue=0, sValue="Off", TimedOut=0) # Inverter device is off
Fix issue within encoding of the password Domoticz 2020.1