PCAL9535A I2C I/O expander used with Sequent 104076 on HassOS on Raspberry Pi4

Very much a Newbie on Home Assistant, but I think I have done everything right. I am trying to get a 16 digital input card that uses a PCA9535 to connect over I2C
This is a fresh install of Home Assistant 2021.9.4 on a Raspberry Pi4, I then enabled I2C following the SD card instruction here:

Using lsmod | grep i2c as described above I think shows that I2C is working and finding two devices, I guess the card and Pi4:

  i2c_dev                20480  2
  i2c_mux_pinctrl   16384  0
  i2c_mux               16384  1 i2c_mux_pinctrl
  i2c_bcm2835       16384  1

I found the i2c address by booting in Raspberry Pi OS and running i2cdetect -y 1 which gave me the i2c address at 0x26.
Then I used this to add lines to configuration.yaml

binary_sensor:
  - platform: rpi_gpio
    ports:
      11: PIR Office
      12: PIR Bedroom
  - platform: pcal9535a
    i2c_bus: 1
    i2c_address: 0x26
    pins:
      0: Test1
      1: Test2

The rpi_gpio seem to be working and have ticks against them in the Entities section, but the i2c input don’t show up. Gong to Configuration/Logs I get this error message:

Logger: homeassistant.components.binary_sensor
Source: components/pcal9535a/binary_sensor.py:46
Integration: Binary sensor ([documentation](https://www.home-assistant.io/integrations/binary_sensor), [issues](https://github.com/home-assistant/home-assistant/issues?q=is%3Aissue+is%3Aopen+label%3A%22integration%3A+binary_sensor%22))
First occurred: 1:59:13 PM (1 occurrences)
Last logged: 1:59:13 PM

Error while setting up pcal9535a platform for binary_sensor

Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 249, in _async_setup_platform await asyncio.shield(task)
File "/usr/local/lib/python3.9/concurrent/futures/thread.py", line 52, in run result = self.fn(*self.args, **self.kwargs)
File "/usr/src/homeassistant/homeassistant/components/pcal9535a/binary_sensor.py", line 46, in setup_platform pcal = PCAL9535A(bus, i2c_address)
File "/usr/local/lib/python3.9/site-packages/pcal9535a/pcal9535a.py", line 59, in __init__ 0: self._bus.read_byte_data(self._i2c_address, 0x46),
File "/usr/local/lib/python3.9/site-packages/smbus/util.py", line 59, in validator return fn(*args, **kwdefaults)
File "/usr/local/lib/python3.9/site-packages/smbus/smbus.py", line 132, in read_byte_data raise IOError(ffi.errno)
OSError: 121

So I am way out of my depth to trace and fix the problems, HELP!! :slight_smile:

Thanks

B

1 Like

So I played for a bit longer and thought I was winning when I found this:

but then I realised that is wasn’t for HassOS.
Some more digging and I found that the Input board also has Node-RED drivers. I installed Node-RED inside Home Assistant and was excited to find the driver in the list of devices I could import, but the import fails.
I have realised that I chose to install the wrong version Hass. HassOS is great and it does what it does but by design it doesn’t include the tools to add to the OS. So I have to choose whether to go with the version that I could install on top of a standard Raspberry Pi OS, or whether to rethink.
After some messing about I did manage to install Node-RED on to a standard Pi OS and was able to check that the input board was working correctly.

Thanks for reading, I hope my experience helps others. If I can figure out how to mark the topic as ‘solved’ I will do that.

B