GPIO

The general-purpose input/outputopen in new window (GPIO) integration allows you to integrate devices that are directly connected to GPIO pins, for example PIR motion sensorsopen in new window. It makes uses of the GPIO Sysfs Interfaceopen in new window 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

NameTypeDefaultDescription
binarySensorsGPIO Binary SensorsArray of binary sensor configurations.
switchesGPIO SwitchesArray of switch configurations.

Binary Sensors

NameTypeDefaultDescription
nameStringFriendly name for this sensor.
pinNumberNumber of the GPIO pin that should be tracked.
deviceClassStringHome Assistant Core device classopen in new window that the sensor should be shown as.

Switches

NameTypeDefaultDescription
nameStringFriendly name for this sensor.
pinNumberNumber of the GPIO pin that should be used as output.
iconStringIcon 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