Add update-credentials command (#620)

* Add change credentials command

* Rename command and add prompts for credential update
This commit is contained in:
Teemu R
2024-01-05 02:25:15 +01:00
committed by GitHub
parent 554fe0a96e
commit 2d8a8d9511
2 changed files with 38 additions and 0 deletions

View File

@@ -321,3 +321,18 @@ class TapoDevice(SmartDevice):
raise
_LOGGER.debug("Received an expected for wifi join, but this is expected")
async def update_credentials(self, username: str, password: str):
"""Update device credentials.
This will replace the existing authentication credentials on the device.
"""
t = self.internal_state["time"]
payload = {
"account": {
"username": base64.b64encode(username.encode()).decode(),
"password": base64.b64encode(password.encode()).decode(),
},
"time": t,
}
return await self.protocol.query({"set_qs_info": payload})