platypush/plugins/esp/__init__.py
def uart_write(self, data: str, binary: bool = False, **kwargs):
        """
        Write data to the UART bus.

        :param data: Data to be written.
        :param binary: By default data will be treated as a string. Set binary to True if it should
            instead be treated as a base64-encoded binary string to be decoded before being sent.
        :param kwargs: Parameters to pass to :meth:`platypush.plugins.esp.EspPlugin.uart_open` and
            :meth:`platypush.plugins.esp.EspPlugin.execute`.
        """
        if binary:
            data = base64.decodebytes(data.encode())
        else:
            data = data.encode()

        data = 'b"' + ''.join(['\\x{:02x}'.format(b) for b in data]) + '"'
        self.uart_open(**kwargs)

        code = 'uart.write({data})'.format(data=data)
        self.execute(code, **kwargs)

        Write data to the UART bus.

        :param data: Data to be written.
        :param binary: By default data will be treated as a string. Set binary to True if it should
            instead be treated as a base64-encoded binary string to be decoded before being sent.
        :param kwargs: Parameters to pass to :meth:`platypush.plugins.esp.EspPlugin.uart_open` and
            :meth:`platypush.plugins.esp.EspPlugin.execute`.
        
Write data to the UART bus.
Write data to the UART bus .
def uart_write(self, data: str, binary: bool = False, **kwargs):
        if binary:
            data = base64.decodebytes(data.encode())
        else:
            data = data.encode()
        data = 'b"' + ''.join(['\\x{:02x}'.format(b) for b in data]) + '"'
        self.uart_open(**kwargs)
        code = 'uart.write({data})'.format(data=data)
        self.execute(code, **kwargs)
def uart_write ( self , data : str , binary : bool = False , ** kwargs ) : if binary : data = base64 . decodebytes ( data . encode ( ) ) else : data = data . encode ( ) data = 'b"' + '' . join ( [ '\\x{:02x}' . format ( b ) for b in data ] ) + '"' self . uart_open ( ** kwargs ) code = 'uart.write({data})' . format ( data = data ) self . execute ( code , ** kwargs )
Write data to the UART bus.
Write data to the UART bus .
"""
        Write data to the UART bus.

        :param data: Data to be written.
        :param binary: By default data will be treated as a string. Set binary to True if it should
            instead be treated as a base64-encoded binary string to be decoded before being sent.
        :param kwargs: Parameters to pass to :meth:`platypush.plugins.esp.EspPlugin.uart_open` and
            :meth:`platypush.plugins.esp.EspPlugin.execute`.
        """
self
data
str
Data to be written.
Data to be written .
binary
bool
By default data will be treated as a string. Set binary to True if it should
instead be treated as a base64-encoded binary string to be decoded before being sent.
By default data will be treated as a string . Set binary to True if it should instead be treated as a base64 - encoded binary string to be decoded before being sent .
kwargs
Parameters to pass to :meth:`platypush.plugins.esp.EspPlugin.uart_open` and
:meth:`platypush.plugins.esp.EspPlugin.execute`.
Parameters to pass to : meth : ` platypush . plugins . esp . EspPlugin . uart_open ` and : meth : ` platypush . plugins . esp . EspPlugin . execute ` .