Support num_repeats for directv remote (#34982)
parent
7b90cbd2b2
commit
1f66821256
|
@ -5,7 +5,7 @@ from typing import Any, Callable, Iterable, List
|
|||
|
||||
from directv import DIRECTV, DIRECTVError
|
||||
|
||||
from homeassistant.components.remote import RemoteEntity
|
||||
from homeassistant.components.remote import ATTR_NUM_REPEATS, RemoteEntity
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.helpers.typing import HomeAssistantType
|
||||
|
||||
|
@ -95,12 +95,15 @@ class DIRECTVRemote(DIRECTVEntity, RemoteEntity):
|
|||
blue, chanup, chandown, prev, 0, 1, 2, 3, 4, 5,
|
||||
6, 7, 8, 9, dash, enter
|
||||
"""
|
||||
for single_command in command:
|
||||
try:
|
||||
await self.dtv.remote(single_command, self._address)
|
||||
except DIRECTVError:
|
||||
_LOGGER.exception(
|
||||
"Sending command %s to device %s failed",
|
||||
single_command,
|
||||
self._device_id,
|
||||
)
|
||||
num_repeats = kwargs[ATTR_NUM_REPEATS]
|
||||
|
||||
for _ in range(num_repeats):
|
||||
for single_command in command:
|
||||
try:
|
||||
await self.dtv.remote(single_command, self._address)
|
||||
except DIRECTVError:
|
||||
_LOGGER.exception(
|
||||
"Sending command %s to device %s failed",
|
||||
single_command,
|
||||
self._device_id,
|
||||
)
|
||||
|
|
Loading…
Reference in New Issue