Raspberry Pi GPIO Switch


The rpi_gpio switch platform allows you to control the GPIOs of your Raspberry Pi.

Configuration

To use your Raspberry Pi’s GPIO in your installation, add the following to your configuration.yaml file:

# Example configuration.yaml entry
switch:
  - platform: rpi_gpio
    ports:
      11: Fan Office
      12: Light Desk

Configuration Variables

ports

(list)(Required)Array of used ports.

port

(integer | string)(Required)Port numbers and corresponding names (GPIO

invert_logic

(boolean)(Optional)If true, inverts the output logic to ACTIVE LOW.

Default value: false

For more details about the GPIO layout, visit the Wikipedia article about the Raspberry Pi.

Note that a pin managed by HASS is expected to be exclusive to HASS.

A common question is what does Port refer to, this number is the actual GPIO # not the pin #. For example, if you have a relay connected to pin 11 its GPIO # is 17.

# Example configuration.yaml entry
switch:
  - platform: rpi_gpio
    ports:
      17: Speaker Relay