Raspihats


The raspihats integration is the base for all related Raspihats platforms in Home Assistant. There is no setup needed for the integration itself.

Binary Sensor

The raspihats binary sensor platform allows you to read sensor values ​​using the digital inputs of the raspihats boards.

Configuration

To use your raspihats boards in your installation, add the following to your configuration.yaml file:

# Example configuration.yaml entry
binary_sensor:
  - platform: raspihats
    i2c_hats:
      - board: DI6acDQ6rly
        address: 0x60
        channels:
          - index: 0
            name: PIR Office
            invert_logic: true
            device_class: motion
          - index: 1
            name: PIR Bedroom

Configuration Variables

i2c_hatslist(Optional)

An array of used I2C-HATs.

boardstringRequired

The board name either Di16, Di6Rly6, DI16ac or DI6acDQ6rly.

addressstringRequired

The board I2C address as HEX value.

channelslistRequired

Array of used digital input channels.

indexintegerRequired

Digital input channel index.

namestringRequired

Friendly name to use for the frontend.

invert_logicboolean(Optional, default: false)

Inverts the input logic.

device_classstring(Optional, default: None)

Sets the class of the device, changing the device state and icon that is displayed on the frontend.

Directions for installing smbus support on Raspberry Pi

Enable I2c interface with the Raspberry Pi configuration utility:

# pi user environment: Enable i2c interface
$ sudo raspi-config

Select Interfacing options->I2C choose <Yes> and hit Enter, then go to Finish.

Install dependencies for use the smbus-cffi module and enable your homeassistant user to join the i2c group:

# pi user environment: Install i2c dependencies and utilities
$ sudo apt-get install build-essential libi2c-dev i2c-tools python-dev libffi-dev

# pi user environment: Add homeassistant user to the i2c group
$ sudo usermod -a -G i2c homeassistant

Check the i2c address of the sensor

After installing i2c-tools, a new utility is available to scan the addresses of the connected sensors, so you can see the sensor address:

/usr/sbin/i2cdetect -y 1

It will output a table like this:

     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- 23 -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: 40 -- -- -- -- -- UU -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- 77

For more details about the raspihats add-on boards for Raspberry Pi, visit raspihats.com.

Switch

The raspihats switch platform allows you to control the digital outputs of your Raspihats boards.

Configuration

To use your Raspihats boards in your installation, add the following to your configuration.yaml file:

# Example configuration.yaml entry
switch:
  - platform: raspihats
    i2c_hats:
      - board: DI6acDQ6rly
        address: 0x60
        channels:
          - index: 0
            name: Fan Office
            invert_logic: true
            initial_state: true
          - index: 1
            name: Light Office

Configuration Variables

i2c_hatslist(Optional)

An array of used I2C-HATs.

boardstringRequired

The board name.

addressstringRequired

The board I2C address as HEX value.

channelslistRequired

An array of used digital input channels.

indexintegerRequired

The digital input channel index.

namestringRequired

The friendly name to use for the frontend.

invert_logicboolean(Optional, default: false)

Inverts the input logic.

initial_stateboolean(Optional, default: None)

The initial state, can be either true or false. none means no state is forced on the corresponding digital output when this switch is instantiated.

Directions for installing smbus support on Raspberry Pi

Enable I2c interface with the Raspberry Pi configuration utility:

# pi user environment: Enable i2c interface
sudo raspi-config

Select Interfacing options->I2C choose <Yes> and hit Enter, then go to Finish.

Install dependencies for use the smbus-cffi module and enable your homeassistant user to join the i2c group:

# pi user environment: Install i2c dependencies and utilities
sudo apt-get install build-essential libi2c-dev i2c-tools python-dev libffi-dev

# pi user environment: Add homeassistant user to the i2c group
sudo usermod -a -G i2c homeassistant

Check the i2c address of the sensor

After installing i2c-tools, a new utility is available to scan the addresses of the connected sensors, so you can see the sensor address:

/usr/sbin/i2cdetect -y 1

It will output a table like this:

     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- 23 -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: 40 -- -- -- -- -- UU -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- 77

For more details about the Raspihats add-on boards for Raspberry Pi, visit raspihats.com.