Raspberry Pi Remote GPIO


The remote_rpi_gpio integration is the base for all related GPIO platforms in Home Assistant. For the platform configurations, please check their corresponding sections.

The remote Raspberry Pi, and the control computer where Home Assistant is running must be configured to be able to run remote_rpi_gpio, see Configuring Remote GPIO for more details.

Note that for virtual environments, you may need to set an environment variable when starting the environment to set the pin factory, for example:

Environment = GPIOZERO_PIN_FACTORY=pigpio PIGPIO_ADDR=YOUR_RPi_IP_ADDRESS

Binary sensor

The remote_rpi_gpio binary sensor platform allows you to read sensor values of the GPIOs of a remote Raspberry Pi.

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

# Example configuration.yaml entry
binary_sensor:
  - platform: remote_rpi_gpio
    host: IP_ADDRESS_OF_REMOTE_PI
    ports:
      11: PIR Office
      12: PIR Bedroom

Configuration Variables

host string Required

IP Address of remote Raspberry Pi.

ports map Required

List of used ports.

port: name string Required

The port numbers (BCM mode pin numbers) and corresponding names.

invert_logic boolean (Optional)

If true, inverts the output logic

Default:

false (ACTIVE HIGH)

pull_mode string (Optional, default: UP)

Type of internal pull resistor to use. Options are UP - pull-up resistor and DOWN - pull-down resistor. Pull-Up defaults to active LOW and Pull-down defaults to active HIGH. This can be adjusted with invert_logic

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

Switch

The remote_rpi_gpio switch platform allows you to control the GPIOs of a Remote Raspberry Pi.

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

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

Configuration Variables

host string Required

IP Address of remote Raspberry Pi.

ports list Required

Array of used ports.

port integer | string Required

Port numbers and corresponding names (GPIO

invert_logic boolean (Optional, default: false)

If true, inverts the output logic to ACTIVE LOW.

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

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

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: remote_rpi_gpio
    host: 192.168.0.123
    ports:
      17: Speaker Relay

Troubleshooting

If you receive an error such as gpiozero.exc.BadPinFactory: Unable to load any default pin factory! try changing the GPIOZERO_PIN_FACTORY environment variable from pigpio to mock, as this addresses a known issue.