mirror of
https://github.com/home-assistant/core.git
synced 2026-12-02 11:33:11 -04:00
Use the action field enums in lg_netcast (#195939)
This commit is contained in:
@@ -8,10 +8,9 @@ from pylgnetcast import LG_COMMAND, LgNetCastClient, LgNetCastError
|
||||
from requests import RequestException
|
||||
|
||||
from homeassistant.components.remote import (
|
||||
ATTR_DELAY_SECS,
|
||||
ATTR_NUM_REPEATS,
|
||||
DEFAULT_DELAY_SECS,
|
||||
RemoteEntity,
|
||||
RemoteServiceArgument,
|
||||
)
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.exceptions import ServiceValidationError
|
||||
@@ -60,8 +59,8 @@ class LgNetCastRemote(RemoteEntity):
|
||||
@override
|
||||
def send_command(self, command: Iterable[str], **kwargs: Any) -> None:
|
||||
"""Send commands to the TV."""
|
||||
num_repeats = kwargs[ATTR_NUM_REPEATS]
|
||||
delay_secs = kwargs.get(ATTR_DELAY_SECS, DEFAULT_DELAY_SECS)
|
||||
num_repeats = kwargs[RemoteServiceArgument.NUM_REPEATS]
|
||||
delay_secs = kwargs.get(RemoteServiceArgument.DELAY_SECS, DEFAULT_DELAY_SECS)
|
||||
|
||||
commands: list[int] = []
|
||||
for cmd in command:
|
||||
@@ -92,4 +91,4 @@ class LgNetCastRemote(RemoteEntity):
|
||||
@override
|
||||
def turn_off(self, **kwargs: Any) -> None:
|
||||
"""Turn off the TV."""
|
||||
self.send_command(["POWER"], **{ATTR_NUM_REPEATS: 1})
|
||||
self.send_command(["POWER"], **{RemoteServiceArgument.NUM_REPEATS: 1})
|
||||
|
||||
Reference in New Issue
Block a user