PCAL9535A I2C GPIO expander


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

One of the use cases is Seeed studio Raspberry Pi Relay Board.

For more details about the PCAL9535A I2C I/O port expander, you can find its datasheet here: PCAL9535A.

Binary Sensor

The pcal9535a binary sensor platform allows you to read sensor values from the I/O pins of your PCAL9535A I2C I/O expander.

The pin numbers are from 0 to 15, where: 0-7 correspond to port P0 (P0_0 - P0_7) and 8-15 to port P1 (P1_0 - P1_7).

Configuration

To use the I/O pins of an PCAL9535A connected to an I2C bus of your Raspberry Pi as binary sensors, add the following to your configuration.yaml file:

# Example configuration.yaml entry
binary_sensor:
  - platform: pcal9535a
    pins:
      0: PIR Office
      1: PIR Bedroom

Configuration Variables

i2c_bus

(integer)(Optional)

i2c bus number of PCAL9535A chip.

Default value:

1

i2c_address

(integer)(Optional)

i2c address of PCAL9535A chip.

Default value:

0x20

pins

(map)(Required)

List of used pins.

pin: name

(integer | string)(Required)

The pin numbers (from 0 to 15) and corresponding names.

invert_logic

(boolean)(Optional)

If true, inverts the input logic to ACTIVE LOW.

Default value:

false (ACTIVE HIGH)

pull_mode

(string)(Optional)

Type of internal pull resistor to use. Options are UP - pull-up resistor, DOWN - pull-down resistor, DISABLED - resistors disconnected.

Default value:

DISABLED

Switch

The pcal9535a switch platform allows you to write to the I/O pins of your PCAL9535A I2C I/O expander.

The pin numbers are from 0 to 15, where: 0-7 correspond to port P0 (P0_0 - P0_7) and 8-15 to port P1 (P1_0 - P1_7).

Configuration

To use the I/O pins of a PCAL9535A connected to an I2C bus of your Raspberry Pi as switches, add the following to your configuration.yaml file:

# Example configuration.yaml entry
switch:
  - platform: pcal9535a
    pins:
      11: Fan Office
      12: Light Desk

Configuration Variables

i2c_bus

(integer)(Optional)

i2c bus number of PCAL9535A chip.

Default value:

1

i2c_address

(integer)(Optional)

i2c address of PCAL9535A chip.

Default value:

0x20

pins

(list)(Required)

Array of used pins.

pin

(integer | string)(Required)

The pin numbers (from 0 to 15) and corresponding names.

invert_logic

(boolean)(Optional)

If true, inverts the output logic to ACTIVE LOW.

Default value:

false

strength

(string)(Optional)

Control the output drive level of the GPIO. Each GPIO can be configured independently to one of the four possible output current levels. By programming these bits, the user is changing the number of transistor pairs or ‘fingers’ that drive the I/O pad. Options are 0.25, 0.5, 0.75, 1.0.

Default value:

1.0