PCA9685 - I/O connection fault


Can someone help with below issue?
I have 2 raspberry PI with Hassio. (In my and my parents house) One of them working perfectly however second one doesnt work with PCA9685. Both of them have following yaml configuration:


  • platform: rpi_gpio_pwm
    • name: Test
      driver: pca9685
      pins: [2]
      type: simple

Unfortunetley second one have an following fault. I admit both of them are wired exactly the same…

Error while setting up platform rpi_gpio_pwm
Traceback (most recent call last):
File “/usr/lib/python3.6/site-packages/homeassistant/helpers/entity_component.py”, line 171, in _async_setup_platform
SLOW_SETUP_MAX_WAIT, loop=self.hass.loop)
File “/usr/lib/python3.6/asyncio/tasks.py”, line 358, in wait_for
return fut.result()
File “/usr/lib/python3.6/asyncio/futures.py”, line 245, in result
raise self._exception
File “/usr/lib/python3.6/concurrent/futures/thread.py”, line 56, in run
result = self.fn(*self.args, **self.kwargs)
File “/usr/lib/python3.6/site-packages/homeassistant/components/light/rpi_gpio_pwm.py”, line 76, in setup_platform
driver = Pca9685Driver(pins, **opt_args)
File “/usr/lib/python3.6/site-packages/pwmled/driver/pca9685.py”, line 22, in init
self._device = PCA9685(address)
File “/usr/lib/python3.6/site-packages/Adafruit_PCA9685/PCA9685.py”, line 75, in init
self.set_all_pwm(0, 0)
File “/usr/lib/python3.6/site-packages/Adafruit_PCA9685/PCA9685.py”, line 111, in set_all_pwm
self._device.write8(ALL_LED_ON_L, on & 0xFF)
File “/usr/lib/python3.6/site-packages/Adafruit_GPIO/I2C.py”, line 114, in write8
self._bus.write_byte_data(self._address, register, value)
File “/usr/lib/python3.6/site-packages/Adafruit_PureIO/smbus.py”, line 236, in write_byte_data
OSError: [Errno 5] I/O error

After some digging I found the solution, because I’m new to HASS and had the same issue. I registered here only to share the solution with everyone.

It is actually quite simple: You are trying to access a i2c address that doesn’t exist (probably). If you omit the “address” key, it will take 0x40 as default.

You probably tried adding two configs omitting “address” in both, and then HASS tried acessing 0x40 twice, which lead to an I/O Error, because it’s already being used.

Short: Don’t forget the “address” :slight_smile:

  - platform: rpi_gpio_pwm
      - name: Dining Room
        driver: pca9685
        pins: [0]
        type: simple
        address: 0x41