Skip to content

Commit

Permalink
Restart timer thread correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
zim514 committed Dec 31, 2023
1 parent 9571fcb commit dcd9f22
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion script.service.hue/addon.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<addon id="script.service.hue" name="Hue Service" provider-name="zim514" version="1.5.3">
<addon id="script.service.hue" name="Hue Service" provider-name="zim514" version="1.5.4">
<requires>
<import addon="xbmc.python" version="3.0.0"/>
<import addon="script.module.requests" version="2.27.1"/>
Expand Down
1 change: 1 addition & 0 deletions script.service.hue/resources/lib/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ def run(self):

# If the bridge gets reconnected, restart the timers
if self.bridge.connected and not self.timers.is_alive():
self.timers = Timers(self.monitor, self.bridge, self)
self.timers.start()

# Update the previous state for the next iteration
Expand Down
2 changes: 1 addition & 1 deletion script.service.hue/resources/lib/hue.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ def make_api_request(self, method, resource, discovery=False, **kwargs):
reporting.process_exception(f"Response: {x.response.text}, Exception: {x}", logging=True)
return x.response.status_code
except (Timeout, json.JSONDecodeError) as x:
xbmc.log(f"[script.service.hue] v2 make_request: Timeout/JSONDecodeError: Response: {x.response.text}\n{x}")
xbmc.log(f"[script.service.hue] v2 make_request: Timeout/JSONDecodeError: Response: {x.response}\n{x}")
except requests.RequestException as x:
# Report other kinds of RequestExceptions
xbmc.log(f"[script.service.hue] v2 make_request: RequestException: {x}")
Expand Down

0 comments on commit dcd9f22

Please sign in to comment.