Fix call to ha_send_commands (#8956)

* Name keyword arguments correctly according to dependency lib.
* Only pass keyword arguments that are not None.
This commit is contained in:
Martin Hjelmare 2017-08-13 20:28:33 +02:00 committed by Paulus Schoutsen
parent 811fdc5533
commit cbe5225e04

View File

@ -214,14 +214,15 @@ class HarmonyRemote(remote.RemoteDevice):
if device is None:
_LOGGER.error("Missing required argument: device")
return
params = {}
num_repeats = kwargs.pop(ATTR_NUM_REPEATS, None)
if num_repeats is not None:
kwargs[ATTR_NUM_REPEATS] = num_repeats
params['repeat_num'] = num_repeats
delay_secs = kwargs.pop(ATTR_DELAY_SECS, None)
if delay_secs is not None:
kwargs[ATTR_DELAY_SECS] = delay_secs
params['delay_secs'] = delay_secs
pyharmony.ha_send_commands(
self._token, self.host, self._port, device, command, **kwargs)
self._token, self.host, self._port, device, command, **params)
def sync(self):
"""Sync the Harmony device with the web service."""