Xl9535 integration

hello everyone, i buyed this device from Aliexpress, comes with xl9535 expander I/o

https://es.aliexpress.com/item/1005006142513530.html

I try to integrate with home assistants but sadly cant turn on or of the last 2 relays because comes with pin 16 and 17 i think, and in the code dont allow me to put GPIO number 16 and 17

esphome:
  name: esp32
  friendly_name: ESP32

esp32:
  board: esp32dev
  framework:
    type: arduino

# Enable logging
logger:

# Enable Home Assistant API
api:
  encryption:
    key: "xxx"

ota:
  password: "xxx"

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Esp32 Fallback Hotspot"
    password: "xxx"

captive_portal:
    

i2c:
  sda: 21
  scl: 22
  scan: True

xl9535:
  - id: xl9535_hub
    address: 0x20

    
# Individual outputs
switch:

  - platform: gpio
    name: A0
    pin:
      xl9535: xl9535_hub
      number: 0
      mode:
        output: true
      inverted: true

  - platform: gpio
    name: A1
    pin:
      xl9535: xl9535_hub
      number: 1
      mode:
        output: true
      inverted: true

  - platform: gpio
    name: A2
    pin:
      xl9535: xl9535_hub
      number: 2
      mode:
        output: true
      inverted: true

  - platform: gpio
    name: A3
    pin:
      xl9535: xl9535_hub
      number: 3
      mode:
        output: true
      inverted: true

  - platform: gpio
    name: A4
    pin:
      xl9535: xl9535_hub
      number: 4
      mode:
        output: true
      inverted: true

  - platform: gpio
    name: A5
    pin:
      xl9535: xl9535_hub
      number: 5
      mode:
        output: true
      inverted: true

  - platform: gpio
    name: A6
    pin:
      xl9535: xl9535_hub
      number: 6
      mode:
        output: true
      inverted: true

  - platform: gpio
    name: A7
    pin:
      xl9535: xl9535_hub
      number: 7
      mode:
        output: true
      inverted: true

  - platform: gpio
    name: B0
    pin:
      xl9535: xl9535_hub
      number: 10
      mode:
        output: true
      inverted: true

  - platform: gpio
    name: B1
    pin:
      xl9535: xl9535_hub
      number: 11
      mode:
        output: true
      inverted: true

  - platform: gpio
    name: B2
    pin:
      xl9535: xl9535_hub
      number: 12
      mode:
        output: true
      inverted: true

  - platform: gpio
    name: B3
    pin:
      xl9535: xl9535_hub
      number: 13
      mode:
        output: true
      inverted: true

  - platform: gpio
    name: B4
    pin:
      xl9535: xl9535_hub
      number: 14
      mode:
        output: true
      inverted: true

  - platform: gpio
    name: B5
    pin:
      xl9535: xl9535_hub
      number: 15
      mode:
        output: true
      inverted: true

  - platform: gpio
    name: B6
    pin:
      xl9535: xl9535_hub
      number: 8
      mode:
        output: true
      inverted: true

  - platform: gpio
    name: B7
    pin:
      xl9535: xl9535_hub
      number: 9
      mode:
        output: true
      inverted: true

here i cant put the 8 and 9 pins, the corret pins are 16 and 17

Sorry for my bad english

Anyone know how to fix it?

1 Like

i see the xl9535 integration, but the pinouts 16 and 17 cant work in home assistant because GPIO cant support more than 0-15 pin,

sadly the actual integration dont see this issue, i see the pcf8575 and have the correct pinout define, but xl9535 dont have this.

the seller sended me some arduino codes with library, i dont know how to integrate with esphome.

Here is the code

This was a bug in the component. Fixed in fix pin range for xl9535 by ssieb · Pull Request #5722 · esphome/esphome · GitHub

1 Like