Support num_repeats for roku remote (#34981)

This commit is contained in:
Chris Talkington 2020-04-30 23:08:32 -05:00 committed by Paulus Schoutsen
parent 42dd3ba748
commit 3a4b8625bd

View File

@ -7,7 +7,7 @@ from requests.exceptions import (
)
from roku import RokuException
from homeassistant.components.remote import RemoteDevice
from homeassistant.components.remote import ATTR_NUM_REPEATS, RemoteDevice
from homeassistant.config_entries import ConfigEntry
from homeassistant.helpers.typing import HomeAssistantType
@ -84,8 +84,11 @@ class RokuRemote(RemoteDevice):
def send_command(self, command, **kwargs):
"""Send a command to one device."""
for single_command in command:
if not hasattr(self.roku, single_command):
continue
num_repeats = kwargs[ATTR_NUM_REPEATS]
getattr(self.roku, single_command)()
for _ in range(num_repeats):
for single_command in command:
if not hasattr(self.roku, single_command):
continue
getattr(self.roku, single_command)()