Skip to content

Commit

Permalink
Improved stability while fetching data locally.
Browse files Browse the repository at this point in the history
  • Loading branch information
slydiman committed Oct 10, 2024
1 parent 07cda37 commit 33f18d1
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
5 changes: 4 additions & 1 deletion custom_components/sscpoe/coordinator.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,10 @@ def _fetch_data(self) -> None:
if self._sn:
j, err = SSCPOE_local_request({"callcmd": "detail", "sn": self._sn})
if j is None:
raise ApiError(f"SSCPOE_local_request(detail, {self._sn}): timeout")
# Second try
j, err = SSCPOE_local_request({"callcmd": "detail", "sn": self._sn})
if j is None:
raise ApiError(f"SSCPOE_local_request(detail, {self._sn}): timeout")
if isinstance(j, str):
raise ApiAuthError(j)
if err != 0:
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.09.30",
"version": "2024.10.11",
"zeroconf": []
}
4 changes: 2 additions & 2 deletions custom_components/sscpoe/protocol.py
Original file line number Diff line number Diff line change
Expand Up @@ -502,9 +502,9 @@ def SSCPOE_local_search():

def SSCPOE_local_request(dt):
sock, syn = SSCPOE_local_send(dt)
res = SSCPOE_local_recv(sock, syn)
d, err = SSCPOE_local_recv(sock, syn)
sock.close()
return res
return d, err


def SSCPOE_local_login(sn: str, password: str, cmd="login"):
Expand Down

0 comments on commit 33f18d1

Please sign in to comment.