From 3a4b8625bdbf9cd3542c54074622063ebad3c9bb Mon Sep 17 00:00:00 2001 From: Chris Talkington Date: Thu, 30 Apr 2020 23:08:32 -0500 Subject: [PATCH] Support num_repeats for roku remote (#34981) --- homeassistant/components/roku/remote.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/homeassistant/components/roku/remote.py b/homeassistant/components/roku/remote.py index 999747c9a27..9a61ec8d5d8 100644 --- a/homeassistant/components/roku/remote.py +++ b/homeassistant/components/roku/remote.py @@ -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)()