# GPIO

The general-purpose input/output (GPIO) integration allows you to integrate devices that are directly connected to GPIO pins, for example PIR motion sensors. It makes uses of the GPIO Sysfs Interface and therefore only works on Linux.

# Requirements

# Running with NodeJS

The user under which room-assistant is running needs to have access to the GPIO pins. Under Raspbian this can be granted by adding the user to the gpio group:

sudo adduser $USER gpio

# Running with Docker

The /sys folder of the host needs to be mapped into the container like shown below.

Example docker-compose.yml
version: '3'
services:
  room-assistant:
    image: mkerix/room-assistant
    network_mode: host
    volumes:
      - /var/run/dbus:/var/run/dbus
      - /sys:/sys
    environment:
      NODE_CONFIG: >
        {
          "global": {
            "instanceName": "changeme",
            "integrations": ["gpio"]
          },
          "gpio": {
            "binarySensors": [
              { "name": "PIR Sensor", "pin": 17 }
            ]
          }
        }

# Settings

Name Type Default Description
binarySensors GPIO Binary Sensors Array of binary sensor configurations.
switches GPIO Switches Array of switch configurations.

# Binary Sensors

Name Type Default Description
name String Friendly name for this sensor.
pin Number Number of the GPIO pin that should be tracked.
deviceClass String Home Assistant Core device class that the sensor should be shown as.

# Switches

Name Type Default Description
name String Friendly name for this sensor.
pin Number Number of the GPIO pin that should be used as output.
icon String Icon to display for the switch in the Home Assistant Core frontend.
Example Config
global:
  integrations:
    - gpio
gpio:
  binarySensors:
    - name: Bedroom Motion Sensor
      pin: 17
      deviceClass: motion
  switches:
    - name: LED
      pin: 18