def __init__(self, name, host, optimistic=False, timeout=DEFAULT_TIMEOUT): """Initialize the device.""" from pymediaroom import Remote self.stb = Remote(host, timeout=timeout) _LOGGER.info("Found %s at %s%s", name, host, " - I'm optimistic" if optimistic else "") self._name = name self._is_standby = not optimistic self._current = None self._optimistic = optimistic self._state = STATE_STANDBY
def __init__(self, host, device_id, optimistic=False, timeout=DEFAULT_TIMEOUT): """Initialize the device.""" self.host = host self.stb = Remote(host) _LOGGER.info( "Found STB at %s%s", host, " - I'm optimistic" if optimistic else "" ) self._channel = None self._optimistic = optimistic self._state = STATE_PLAYING if optimistic else STATE_STANDBY self._name = "Mediaroom {}".format(device_id if device_id else host) self._available = True if device_id: self._unique_id = device_id else: self._unique_id = None
async def main(loop): stbs = await discover(max_wait=5, loop=loop) stbs = sorted(list(stbs)) if stbs: logging.info("Found {}".format(stbs)) remote = Remote(stbs[0]) #remote = Remote("192.168.1.69", loop=loop) await install_mediaroom_protocol( responses_callback=remote.notify_callback) while remote.state == State.UNKNOWN: await asyncio.sleep(5) await remote.turn_on() await remote.send_cmd('Rose') await remote.send_cmd('Rose') await asyncio.sleep(10) else: logging.error("No STB Found")