diff --git a/pytradfri/api/libcoap_api.py b/pytradfri/api/libcoap_api.py index 0832902c..028ffa1a 100644 --- a/pytradfri/api/libcoap_api.py +++ b/pytradfri/api/libcoap_api.py @@ -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,