Orange Pi GPIO

The orangepi_gpio integration is the base for all related GPIO platforms in Home Assistant. There is no setup needed for the integration itself, for the platforms please check their corresponding pages.

This integration provides the following platforms:

  • Binary sensor: The orangepi_gpio binary sensor platform allows you to read sensor values of the GPIOs of your Orange Pi or NanoPi.


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

# Example configuration.yaml entry
  - platform: orangepi_gpio
    pin_mode: pc
      11: PIR Office
      12: PIR Bedroom

Configuration Variables

pin_mode string Required

Type of pin mode to use. This depends on which device you are actually using (Pin modes).

ports map Required

List of used ports.

port: name string Required

The port numbers (physical pin numbers) and corresponding names.

invert_logic boolean (Optional)

If true, inverts the output logic to ACTIVE LOW.



Compared to the Raspberry Pi GPIO component, this integration does not support pull-up resistors or port debouncing. Use external pull-ups and external port-debouncing.

Pin modes

As this platform supports different types of GPIO pinouts for difference Orange Pi or Nano Pi devices, we use the pin_mode value to specify which one to use. Enabled values are:

Value Description
lite Supports the Orange Pi Lite
lite2 Supports the Orange Pi Lite 2
one Supports the Orange Pi One
oneplus Supports the Orange Pi One Plus
pc Supports the Orange Pi PC
pc2 Supports the Orange Pi PC 2
pcplus Supports the Orange Pi PC Plus
pi3 Supports the Orange Pi 3
plus2e Supports the Orange Pi Plus 2E
prime Supports the Orange Pi Prime
r1 Supports the Orange Pi R1
winplus Supports the Orange Pi WinPlus
zero Supports the Orange Pi Zero
zeroplus Supports the Orange Pi Zero Plus
zeroplus2 Supports the Orange Pi Zero Plus 2
duo Supports the NanoPi Duo
neocore2 Supports the NanoPi Neocore 2
pi4 Supports the Orange pi 4
pi4B Supports the Orange pi 4B

Additional steps

This integration uses the SYSFS filesystem to get control of the GPIOs. Therefore an operating system with CONFIG_GPIO_SYSFS is required. As far as I know, most out-of-the-box distributions still enable this by default.

As of Linux 4.8 sysfs-gpio is marked as obsolete. However as of today, the alternative GPIO character device is not widely used. Therefore we will use this until the new character device is more widely supported.

Normally the /sys/class/gpio path is owned by root, so Home Assistant does not have access. As we don’t want to run Home Assistant as root, we will add the group gpio to have control over this path. I will assume you added the homeassistant user already to the gpio group as recommended in the Manual installation guide

Create a new file in /etc/udev/rules.d/ named 10-gpio.rules with the following contents:

SUBSYSTEM=="gpio*", PROGRAM="/bin/sh -c 'find -L /sys/class/gpio/ -maxdepth 2 -exec chown root:gpio {} \; -exec chmod 770 {} \; || true'"

Home Assistant will now be able to control your GPIO pins.


This integration uses interrupts to catch changes on your pins. However, it depends on the Allwinner chipset which pin banks support external interrupts. There is also a great difference between Orange Pi models which pins are routed to the GPIO connector. Therefore it greatly differs between devices which pins you can use for your sensors.

You can find the pinouts of all the supported Orange Pi devices here. The pinouts for the NanoPi Duo and NanoPi NEO Core2 can be found on the FriendlyARM wiki. For example: If a pin is named PA01, the pin bank is PA. If this pin bank is in the following table after your chipset, this particular pin is supported.

For the orange pi4 and pi4B, using the Rockchip RK3399 chip, a manual and technical doc can be found here.

Chipset Pin banks which support external interrupts
H2+ PA, PG, PL
A64 PB, PG, PH, PL

In the table below you can see the number of usable pins for sensors per device.

Device Usable pins
H2+ (R1, Zero) 17/17
H3 (Lite, One, PC, PC Plus, Plus 2E) 21/28
H5 (Zero Plus) 17/17
H5 (Zero Plus 2) 15/17
H5 (PC 2) 22/28
H5 (Prime) 17/28
H6 (Lite 2, One Plus) 3/17
H6 (PI 3) 8/17
A64 (Win Plus) 18/28
RK3399 (PI4, PI4B) 28/28