platypush/plugins/esp/__init__.py
def connect(self, device: Optional[str] = None, host: Optional[str] = None, port: int = 8266,
                password: Optional[str] = None, timeout: Optional[float] = 10.0):
        """
        Open a connection to an ESP device.

        :param device: Configured device name. Either ``device`` or ``host`` and ``port`` must be provided.
        :param host: ESP host.
        :param port: ESP port (default: 8266).
        :param password: ESP WebREPL password.
        :param timeout: Connection timeout (default: 10 seconds).
        """
        device = self._get_device(device=device, host=host, port=port, password=password)
        host = device['host']
        port = device['port']
        conn = self._get_connection(host=host, port=port)
        if conn and conn.ws and conn.ws.sock.connected:
            self.logger.info('Already connected to {}:{}'.format(host, port))
            return

        conn = Connection(host=host, port=port, password=password, connect_timeout=timeout)
        self._connections[(host, port)] = conn

        ws = websocket.WebSocketApp('ws://{host}:{port}'.format(host=host, port=port),
                                    on_open=self.on_open(conn),
                                    on_message=self.on_message(conn),
                                    on_data=self.on_data(conn),
                                    on_error=self.on_error(conn),
                                    on_close=self.on_close(conn))

        conn.ws = ws
        wst = threading.Thread(target=ws.run_forever)
        wst.daemon = True
        wst.start()
        conn.wait_ready()

        Open a connection to an ESP device.

        :param device: Configured device name. Either ``device`` or ``host`` and ``port`` must be provided.
        :param host: ESP host.
        :param port: ESP port (default: 8266).
        :param password: ESP WebREPL password.
        :param timeout: Connection timeout (default: 10 seconds).
        
Open a connection to an ESP device.
Open a connection to an ESP device .
def connect(self, device: Optional[str] = None, host: Optional[str] = None, port: int = 8266,
                password: Optional[str] = None, timeout: Optional[float] = 10.0):
        device = self._get_device(device=device, host=host, port=port, password=password)
        host = device['host']
        port = device['port']
        conn = self._get_connection(host=host, port=port)
        if conn and conn.ws and conn.ws.sock.connected:
            self.logger.info('Already connected to {}:{}'.format(host, port))
            return
        conn = Connection(host=host, port=port, password=password, connect_timeout=timeout)
        self._connections[(host, port)] = conn
        ws = websocket.WebSocketApp('ws://{host}:{port}'.format(host=host, port=port),
                                    on_open=self.on_open(conn),
                                    on_message=self.on_message(conn),
                                    on_data=self.on_data(conn),
                                    on_error=self.on_error(conn),
                                    on_close=self.on_close(conn))
        conn.ws = ws
        wst = threading.Thread(target=ws.run_forever)
        wst.daemon = True
        wst.start()
        conn.wait_ready()
def connect ( self , device : Optional [ str ] = None , host : Optional [ str ] = None , port : int = 8266 , password : Optional [ str ] = None , timeout : Optional [ float ] = 10.0 ) : device = self . _get_device ( device = device , host = host , port = port , password = password ) host = device [ 'host' ] port = device [ 'port' ] conn = self . _get_connection ( host = host , port = port ) if conn and conn . ws and conn . ws . sock . connected : self . logger . info ( 'Already connected to {}:{}' . format ( host , port ) ) return conn = Connection ( host = host , port = port , password = password , connect_timeout = timeout ) self . _connections [ ( host , port ) ] = conn ws = websocket . WebSocketApp ( 'ws://{host}:{port}' . format ( host = host , port = port ) , on_open = self . on_open ( conn ) , on_message = self . on_message ( conn ) , on_data = self . on_data ( conn ) , on_error = self . on_error ( conn ) , on_close = self . on_close ( conn ) ) conn . ws = ws wst = threading . Thread ( target = ws . run_forever ) wst . daemon = True wst . start ( ) conn . wait_ready ( )
Open a connection to an ESP device.
Open a connection to an ESP device .
"""
        Open a connection to an ESP device.

        :param device: Configured device name. Either ``device`` or ``host`` and ``port`` must be provided.
        :param host: ESP host.
        :param port: ESP port (default: 8266).
        :param password: ESP WebREPL password.
        :param timeout: Connection timeout (default: 10 seconds).
        """
self
device
Optional[str]
Configured device name. Either ``device`` or ``host`` and ``port`` must be provided.
Configured device name . Either ` ` device ` ` or ` ` host ` ` and ` ` port ` ` must be provided .
host
Optional[str]
None
port
int
None
password
Optional[str]
ESP WebREPL password.
ESP WebREPL password .
timeout
Optional[float]
Connection timeout (default: 10 seconds).
Connection timeout ( default : 10 seconds ) .