Skip to content

Commit

Permalink
Mention @TA2k's work, increase remote service timeout & error message
Browse files Browse the repository at this point in the history
  • Loading branch information
rikroe committed Aug 16, 2021
1 parent effdeba commit 120e500
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
1 change: 1 addition & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ to be used in Home Assistant and is available on pypi.
* https://github.com/edent/BMW-i-Remote
* https://github.com/jupe76/bmwcdapi
* https://github.com/frankjoke/iobroker.bmw
* https://github.com/TA2k/ioBroker.bmw

Thank you for your great software!

Expand Down
9 changes: 6 additions & 3 deletions bimmer_connected/remote_services.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
_POLLING_CYCLE = 3

#: maximum number of seconds to wait for the server to return a positive answer
_POLLING_TIMEOUT = 120
_POLLING_TIMEOUT = 240

#: time in seconds to wait before updating the vehicle state from the server
_UPDATE_AFTER_REMOTE_SERVICE_DELAY = 10
Expand Down Expand Up @@ -245,8 +245,11 @@ def _block_until_done(self, service: _Services = None, event_id: str = None) ->
if status.state not in [ExecutionState.UNKNOWN, ExecutionState.PENDING, ExecutionState.DELIVERED]:
return status
if datetime.datetime.now() > fail_after:
raise IOError(
'Timeout on getting final answer from server. Current state: {}'.format(status.state.value))
raise TimeoutError(
'Did not receive remote service result in {} seconds. Current state: {}'.format(
_POLLING_TIMEOUT,
status.state.value
))
time.sleep(_POLLING_CYCLE)

def _get_remote_service_status(self, service: _Services = None, event_id: str = None) -> RemoteServiceStatus:
Expand Down

0 comments on commit 120e500

Please sign in to comment.