platypush/plugins/gpio/__init__.py
def read(self, pin: Union[int, str], name: Optional[str] = None) -> Dict[str, Any]:
        """
        Reads a value from a PIN.

        :param pin: PIN number or configured name.
        :param name: Optional name for the read value (e.g. "temperature" or "humidity")

        Response::

            output = {
                "name": <pin number or pin/metric name>,
                "pin": <pin>,
                "value": <value>,
                "method": "read"
            }
        """

        import RPi.GPIO as GPIO

        self._init_board()
        name = name or pin
        pin = self._get_pin_number(pin)

        if pin not in self._initialized_pins:
            GPIO.setup(pin, GPIO.IN)
            self._initialized_pins[pin] = GPIO.IN

        val = GPIO.input(pin)

        return {
            'name': name,
            'pin': pin,
            'value': val,
            'method': 'read',
        }

        Reads a value from a PIN.

        :param pin: PIN number or configured name.
        :param name: Optional name for the read value (e.g. "temperature" or "humidity")

        Response::

            output = {
                "name": <pin number or pin/metric name>,
                "pin": <pin>,
                "value": <value>,
                "method": "read"
            }
        
Reads a value from a PIN.
Reads a value from a PIN .
def read(self, pin: Union[int, str], name: Optional[str] = None) -> Dict[str, Any]:
        import RPi.GPIO as GPIO
        self._init_board()
        name = name or pin
        pin = self._get_pin_number(pin)
        if pin not in self._initialized_pins:
            GPIO.setup(pin, GPIO.IN)
            self._initialized_pins[pin] = GPIO.IN
        val = GPIO.input(pin)
        return {
            'name': name,
            'pin': pin,
            'value': val,
            'method': 'read',
        }
def read ( self , pin : Union [ int , str ] , name : Optional [ str ] = None ) -> Dict [ str , Any ] : import RPi . GPIO as GPIO self . _init_board ( ) name = name or pin pin = self . _get_pin_number ( pin ) if pin not in self . _initialized_pins : GPIO . setup ( pin , GPIO . IN ) self . _initialized_pins [ pin ] = GPIO . IN val = GPIO . input ( pin ) return { 'name' : name , 'pin' : pin , 'value' : val , 'method' : 'read' , }
Reads a value from a PIN.
Reads a value from a PIN .
"""
        Reads a value from a PIN.

        :param pin: PIN number or configured name.
        :param name: Optional name for the read value (e.g. "temperature" or "humidity")

        Response::

            output = {
                "name": <pin number or pin/metric name>,
                "pin": <pin>,
                "value": <value>,
                "method": "read"
            }
        """
self
pin
Union[int, str]
PIN number or configured name.
PIN number or configured name .
name
Optional[str]
Optional name for the read value
Response:.


Optional name for the read value Response : .