1 """Support for the SamsungTV remote."""
3 from __future__
import annotations
5 from collections.abc
import Iterable
12 from .
import SamsungTVConfigEntry
13 from .const
import LOGGER
14 from .entity
import SamsungTVEntity
19 entry: SamsungTVConfigEntry,
20 async_add_entities: AddEntitiesCallback,
22 """Set up the Samsung TV from a config entry."""
23 coordinator = entry.runtime_data
28 """Device that sends commands to a SamsungTV."""
34 """Handle data update."""
39 """Turn the device off."""
43 """Send a command to a device.
45 Supported keys vary between models.
46 See https://github.com/jaruba/ha-samsungtv-tizen/blob/master/Key_codes.md
48 if self.
_bridge_bridge.power_off_in_progress:
49 LOGGER.debug(
"TV is powering off, not sending keys: %s", command)
52 num_repeats = kwargs[ATTR_NUM_REPEATS]
53 command_list =
list(command)
55 for _
in range(num_repeats):
56 await self.
_bridge_bridge.async_send_keys(command_list)
59 """Turn the remote on."""
None _async_turn_off(self)
None _async_turn_on(self)
None async_turn_on(self, **Any kwargs)
None async_send_command(self, Iterable[str] command, **Any kwargs)
None async_turn_off(self, **Any kwargs)
None _handle_coordinator_update(self)
None async_write_ha_state(self)
None async_setup_entry(HomeAssistant hass, SamsungTVConfigEntry entry, AddEntitiesCallback async_add_entities)