Skip to content

Commit

Permalink
Libcoap observer timeout fix (#137)
Browse files Browse the repository at this point in the history
* Added -B flag to command
* Raise error instead of fixing the users mistake
  • Loading branch information
Lakitna authored and Patrik committed Jan 16, 2018
1 parent 1639592 commit d54ce1f
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion pytradfri/api/libcoap_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,10 +103,13 @@ def _observe(self, api_command):
"""Observe an endpoint."""
path = api_command.path
duration = api_command.observe_duration
if duration <= 0:
raise ValueError("Observation duration has to be greater than 0.")
url = api_command.url(self._host)
err_callback = api_command.err_callback

command = self._base_command('get') + ['-s', str(duration), url]
command = (self._base_command('get')
+ ['-s', str(duration), '-B', str(duration), url])

kwargs = {
'stdout': subprocess.PIPE,
Expand Down

0 comments on commit d54ce1f

Please sign in to comment.