Giter VIP home page Giter VIP logo

ha-gpio's Introduction

Home Assistant GPIO custom integration

**This is a spin-off from the ha-rpi_gpio integration, adapted in ha-gpio to work with libgpiod2 instead and partially redone by me to get the button event driven and some cleanups **

The gpio integration supports the following platforms: Binary Sensor and Switch

Installation

Manual installation

Copy the gpio folder and all of its contents into your Home Assistant's custom_components folder. This folder is usually inside your /config folder. If you are running Hass.io, use SAMBA to copy the folder over. You may need to create the custom_components folder and then copy the gpio folder and all of its contents into it.

Usage

Platform

The gpio platform should be initialized using the path to the gpio chip. Default is /dev/gpiochip0. Add the following to your configuration.yaml file:

# GPIO platform configuration
gpio:
  path: /dev/gpiochip0

Binary Sensor

The gpio binary sensor platform allows you to read sensor values of the GPIOs of your device.

Configuration

To use your device's GPIO in your installation, add the following to your configuration.yaml file:

# Basic configuration.yaml entry
binary_sensor:
  - platform: gpio
    sensors:
      - port: 11
        name: "PIR Office"
      - port: 12
        name: "PIR Bedroom"
# Full configuration.yaml entry
binary_sensor:
  - platform: gpio
    sensors:
      - port: 11
        name: "PIR Office"
        unique_id: "pir_office_sensor_port_11"
        bouncetime: 80
        invert_logic: true
        pull_mode: "DOWN"
      - port: 12
        name: "PIR Bedroom"
        unique_id: "pir_bedroom_sensor_port_12"

Options

Key Required Default Type Description
sensors yes list List of sensor IO ports (Raspberry Pi BCM mode pin numbers)
name yes string The name for the binary sensor entity
unique_id no string An ID that uniquely identifies the sensor. Set this to a unique value to allow customization through the UI
bouncetime no 50 integer The time in milliseconds for port debouncing
invert_logic no false (ACTIVE HIGH) boolean If true, inverts the output logic to ACTIVE LOW
pull_mode no UP string Type of internal pull resistor to use: UP - pull-up resistor, DOWN - pull-down resistor

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

Switch

The gpio switch platform allows you to control the GPIOs of your device.

Configuration

To use your device's GPIO in your installation, add the following to your configuration.yaml file:

# Basic configuration.yaml entry
switch:
  - platform: gpio
    switches:
      - port: 11
        name: "Fan Office"
      - port: 12
        name: "Light Desk"
# Full configuration.yaml entry
switch:
  - platform: gpio
    switches:
      - port: 11
        name: "Fan Office"
        unique_id: "fan_office_switch_port_11"
      - port: 12
        name: "Light Desk"
        unique_id: "light_desk_switch_port_12"
        invert_logic: true

Options

Key Required Default Type Description
switches yes list List of switch IO ports (Raspberry Pi BCM mode pin numbers)
name yes string The name for the switch entity
unique_id no string An ID that uniquely identifies the switch. Set this to a unique value to allow customization through the UI
invert_logic no false boolean If true, inverts the output logic to ACTIVE LOW

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

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.

# Basic configuration.yaml entry
switch:
  - platform: gpio
    switches:
      - port: 17
        name: "Speaker Relay"

ha-gpio's People

Contributors

dependabot[bot] avatar thecode avatar raboof avatar jdeneef avatar icc-guerrero avatar ludeeus avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.