Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
FlyingDiver committed Apr 16, 2022
1 parent 2ee9949 commit a8f6737
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,13 @@

Plugin to get alerts and send commands to the Camect Home security camera controller.

| Requirement | | |
|------------------------|---------------------|---|
| Minimum Indigo Version | 2022.1 | |
| Python Library (API) | Official | |
| Requires Local Network | Yes | |
| Requires Internet | No | |
| Hardware Interface | None | |


[Camect Home](https://camect.com)
6 changes: 2 additions & 4 deletions camect.indigoPlugin/Contents/Server Plugin/camect.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,7 @@ def on_error(ws, error):
self.logger.debug(f"{self.hub_id}: websocket thread is still alive!")

# try to recover from the error
self.thread_start_delay += 10.0 # wait 10 more seconds, max 1 minute
if self.thread_start_delay > 60.0:
self.thread_start_delay = 60.0
self.thread_start_delay += 10.0 if self.thread_start_delay < 50.0 else 60.0 # wait 10 more seconds, max 1 minute

self.thread = threading.Thread(target=ws_client)
self.logger.debug(f"{self.hub_id}: restarting websocket thread in {self.thread_start_delay} seconds")
Expand All @@ -95,7 +93,7 @@ def _do_request(self, api_call, params=None):
self.logger.debug(f"{self.hub_id}: _do_request api_call = {api_call}, params = {params}")
try:
resp = requests.get(self._api_prefix + api_call, timeout=10.0, verify=False, headers={'Authorization': self.authorization}, params=params)
except ConnectionError as err:
except requests.exceptions.ConnectionError as err:
self.delegate.hub_error(dev_id=self.hub_id, error=f"{api_call} request failure")
return None
except requests.exceptions.Timeout as err:
Expand Down

0 comments on commit a8f6737

Please sign in to comment.