Skip to content

Commit

Permalink
Fixed local re-authentication.
Browse files Browse the repository at this point in the history
Added cloud requests debug logs.
  • Loading branch information
slydiman committed Nov 11, 2024
1 parent 33f18d1 commit 9d784db
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
5 changes: 4 additions & 1 deletion custom_components/sscpoe/config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,10 @@ async def async_step_reauth_confirm(
else:

def login():
return SSCPOE_local_login(sn, password, "activate")
res = SSCPOE_local_login(sn, password, "activate")
if res:
res = SSCPOE_local_login(sn, password)
return res

err = await self.hass.async_add_executor_job(login)
if err:
Expand Down
2 changes: 1 addition & 1 deletion custom_components/sscpoe/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@
"iot_class": "cloud_polling",
"issue_tracker": "https://github.com/slydiman/sscpoe/issues",
"requirements": ["requests"],
"version": "2024.10.11",
"version": "2024.11.11",
"zeroconf": []
}
3 changes: 3 additions & 0 deletions custom_components/sscpoe/protocol.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,7 @@ def dencrypt(s: str, key: bytes) -> str:
def SSCPOE_cloud_request(act: str, dt, key: str, uid: str):
_key = strToUtf8Bytes(key)
_act = None
LOGGER.debug(f"SSCPOE_cloud_request: act {act} request: {dt}")
_dt = encrypt(strToUtf8Bytes(json_to_str(dt)), _key) if dt else "undefined"

match act:
Expand Down Expand Up @@ -369,6 +370,8 @@ def SSCPOE_cloud_request(act: str, dt, key: str, uid: str):
LOGGER.error(f"SSCPOE_cloud_request: act {act}: Invalid JSON received: {data}")
return None

LOGGER.debug(f"SSCPOE_cloud_request: act {act} response: {j}")

errcode = j["errcode"]
if errcode != 0:
LOGGER.error(f"SSCPOE_cloud_request: act {act}: errcode: {errcode}")
Expand Down

0 comments on commit 9d784db

Please sign in to comment.