def update_state(self):
        """Find out whether the media box is turned on/off."""
        sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
        sock.settimeout(self._timeout)
        try:
            if sock.connect_ex((self._ip, self._port['state'])) == 0:
                self.state = True
            else:
                self.state = False
            sock.close()
        except socket.error:
            raise
def update_state ( self ) : sock = socket . socket ( socket . AF_INET , socket . SOCK_STREAM ) sock . settimeout ( self . _timeout ) try : if sock . connect_ex ( ( self . _ip , self . _port [ 'state' ] ) ) == 0 : self . state = True else : self . state = False sock . close ( ) except socket . error : raise
Find out whether the media box is turned on/off.