1 """Support for madVR remote control."""
3 from __future__
import annotations
5 from collections.abc
import Iterable
13 from .
import MadVRConfigEntry
14 from .coordinator
import MadVRCoordinator
15 from .entity
import MadVREntity
17 _LOGGER = logging.getLogger(__name__)
22 entry: MadVRConfigEntry,
23 async_add_entities: AddEntitiesCallback,
25 """Set up the madVR remote."""
26 coordinator = entry.runtime_data
35 """Remote entity for the madVR integration."""
41 coordinator: MadVRCoordinator,
43 """Initialize the remote entity."""
50 """Return true if the device is on."""
54 """Turn off the device."""
55 _LOGGER.debug(
"Turning off")
58 except (ConnectionError, NotImplementedError)
as err:
59 _LOGGER.error(
"Failed to turn off device %s", err)
62 """Turn on the device."""
63 _LOGGER.debug(
"Turning on device")
66 await self.
madvr_clientmadvr_client.power_on(mac=self.coordinator.mac)
67 except (ConnectionError, NotImplementedError)
as err:
68 _LOGGER.error(
"Failed to turn on device %s", err)
71 """Send a command to one device."""
72 _LOGGER.debug(
"adding command %s", command)
74 await self.
madvr_clientmadvr_client.add_command_to_queue(command)
75 except (ConnectionError, NotImplementedError)
as err:
76 _LOGGER.error(
"Failed to send command %s", err)
None async_turn_on(self, **Any kwargs)
None __init__(self, MadVRCoordinator coordinator)
None async_send_command(self, Iterable[str] command, **Any kwargs)
None async_turn_off(self, **Any kwargs)
None async_setup_entry(HomeAssistant hass, MadVRConfigEntry entry, AddEntitiesCallback async_add_entities)