def turn_off(self):
    'Turn off media player.'
    self._end_of_power_off = (dt_util.utcnow() + timedelta(seconds=15))
    if (self._config['method'] == 'websocket'):
        self.send_key('KEY_POWER')
    else:
        self.send_key('KEY_POWEROFF')
    try:
        self.get_remote().close()
        self._remote = None
    except OSError:
        _LOGGER.debug('Could not establish connection.')
Turn off media player.
def turn_off(self):
    
    self._end_of_power_off = (dt_util.utcnow() + timedelta(seconds=15))
    if (self._config['method'] == 'websocket'):
        self.send_key('KEY_POWER')
    else:
        self.send_key('KEY_POWEROFF')
    try:
        self.get_remote().close()
        self._remote = None
    except OSError:
        _LOGGER.debug('Could not establish connection.')