Code:
# Made by KinCony IoT: https://www.kincony.com
# T16M with XL9555 I/O expanders, using the compatible xl9535 driver.
# Channel 1-8: pins 0-7 (P00-P07).
# Channel 9-16: pins 10-17 (P10-P17), NOT pins 8-15.
esphome:
name: t16m
friendly_name: t16m
esp32:
board: esp32-s3-devkitc-1
framework:
type: arduino
logger:
api:
ethernet:
type: W5500
clk_pin: GPIO42
mosi_pin: GPIO43
miso_pin: GPIO44
cs_pin: GPIO41
interrupt_pin: GPIO2
reset_pin: GPIO1
i2c:
- id: bus_a
sda: 11
scl: 12
scan: true
frequency: 400kHz
xl9535:
- id: xl9555_hub_out_1
i2c_id: bus_a
address: 0x25
- id: xl9555_hub_in_1
i2c_id: bus_a
address: 0x24
uart:
- id: uart_1
baud_rate: 9600
debug:
direction: BOTH
dummy_receiver: true
after:
timeout: 10ms
tx_pin: 13
rx_pin: 14
switch:
- platform: uart
uart_id: uart_1
name: "RS485 Button"
data: [0x11, 0x22, 0x33, 0x44, 0x55]
- platform: gpio
name: "t16m-output01"
id: "t16m_output01"
pin:
xl9535: xl9555_hub_out_1
number: 0
mode: OUTPUT
inverted: true
- platform: gpio
name: "t16m-output02"
id: "t16m_output02"
pin:
xl9535: xl9555_hub_out_1
number: 1
mode: OUTPUT
inverted: true
- platform: gpio
name: "t16m-output03"
id: "t16m_output03"
pin:
xl9535: xl9555_hub_out_1
number: 2
mode: OUTPUT
inverted: true
- platform: gpio
name: "t16m-output04"
id: "t16m_output04"
pin:
xl9535: xl9555_hub_out_1
number: 3
mode: OUTPUT
inverted: true
- platform: gpio
name: "t16m-output05"
id: "t16m_output05"
pin:
xl9535: xl9555_hub_out_1
number: 4
mode: OUTPUT
inverted: true
- platform: gpio
name: "t16m-output06"
id: "t16m_output06"
pin:
xl9535: xl9555_hub_out_1
number: 5
mode: OUTPUT
inverted: true
- platform: gpio
name: "t16m-output07"
id: "t16m_output07"
pin:
xl9535: xl9555_hub_out_1
number: 6
mode: OUTPUT
inverted: true
- platform: gpio
name: "t16m-output08"
id: "t16m_output08"
pin:
xl9535: xl9555_hub_out_1
number: 7
mode: OUTPUT
inverted: true
- platform: gpio
name: "t16m-output09"
id: "t16m_output09"
pin:
xl9535: xl9555_hub_out_1
number: 10
mode: OUTPUT
inverted: true
- platform: gpio
name: "t16m-output10"
id: "t16m_output10"
pin:
xl9535: xl9555_hub_out_1
number: 11
mode: OUTPUT
inverted: true
- platform: gpio
name: "t16m-output11"
id: "t16m_output11"
pin:
xl9535: xl9555_hub_out_1
number: 12
mode: OUTPUT
inverted: true
- platform: gpio
name: "t16m-output12"
id: "t16m_output12"
pin:
xl9535: xl9555_hub_out_1
number: 13
mode: OUTPUT
inverted: true
- platform: gpio
name: "t16m-output13"
id: "t16m_output13"
pin:
xl9535: xl9555_hub_out_1
number: 14
mode: OUTPUT
inverted: true
- platform: gpio
name: "t16m-output14"
id: "t16m_output14"
pin:
xl9535: xl9555_hub_out_1
number: 15
mode: OUTPUT
inverted: true
- platform: gpio
name: "t16m-output15"
id: "t16m_output15"
pin:
xl9535: xl9555_hub_out_1
number: 16
mode: OUTPUT
inverted: true
- platform: gpio
name: "t16m-output16"
id: "t16m_output16"
pin:
xl9535: xl9555_hub_out_1
number: 17
mode: OUTPUT
inverted: true
binary_sensor:
- platform: gpio
name: "t16m-input01"
id: "t16m_input01"
pin:
xl9535: xl9555_hub_in_1
number: 0
mode: INPUT
inverted: true
- platform: gpio
name: "t16m-input02"
id: "t16m_input02"
pin:
xl9535: xl9555_hub_in_1
number: 1
mode: INPUT
inverted: true
- platform: gpio
name: "t16m-input03"
id: "t16m_input03"
pin:
xl9535: xl9555_hub_in_1
number: 2
mode: INPUT
inverted: true
- platform: gpio
name: "t16m-input04"
id: "t16m_input04"
pin:
xl9535: xl9555_hub_in_1
number: 3
mode: INPUT
inverted: true
- platform: gpio
name: "t16m-input05"
id: "t16m_input05"
pin:
xl9535: xl9555_hub_in_1
number: 4
mode: INPUT
inverted: true
- platform: gpio
name: "t16m-input06"
id: "t16m_input06"
pin:
xl9535: xl9555_hub_in_1
number: 5
mode: INPUT
inverted: true
- platform: gpio
name: "t16m-input07"
id: "t16m_input07"
pin:
xl9535: xl9555_hub_in_1
number: 6
mode: INPUT
inverted: true
- platform: gpio
name: "t16m-input08"
id: "t16m_input08"
pin:
xl9535: xl9555_hub_in_1
number: 7
mode: INPUT
inverted: true
- platform: gpio
name: "t16m-input09"
id: "t16m_input09"
pin:
xl9535: xl9555_hub_in_1
number: 10
mode: INPUT
inverted: true
- platform: gpio
name: "t16m-input10"
id: "t16m_input10"
pin:
xl9535: xl9555_hub_in_1
number: 11
mode: INPUT
inverted: true
- platform: gpio
name: "t16m-input11"
id: "t16m_input11"
pin:
xl9535: xl9555_hub_in_1
number: 12
mode: INPUT
inverted: true
- platform: gpio
name: "t16m-input12"
id: "t16m_input12"
pin:
xl9535: xl9555_hub_in_1
number: 13
mode: INPUT
inverted: true
- platform: gpio
name: "t16m-input13"
id: "t16m_input13"
pin:
xl9535: xl9555_hub_in_1
number: 14
mode: INPUT
inverted: true
- platform: gpio
name: "t16m-input14"
id: "t16m_input14"
pin:
xl9535: xl9555_hub_in_1
number: 15
mode: INPUT
inverted: true
- platform: gpio
name: "t16m-input15"
id: "t16m_input15"
pin:
xl9535: xl9555_hub_in_1
number: 16
mode: INPUT
inverted: true
- platform: gpio
name: "t16m-input16"
id: "t16m_input16"
pin:
xl9535: xl9555_hub_in_1
number: 17
mode: INPUT
inverted: true
# External pull-up resistors are installed on the PCB.
- platform: gpio
name: "t16m-W1-io8"
pin:
number: 8
inverted: true
- platform: gpio
name: "t16m-W1-io9"
pin:
number: 9
inverted: true
- platform: gpio
name: "t16m-W1-io10"
pin:
number: 10
inverted: true
- platform: gpio
name: "t16m-W1-io15"
pin:
number: 15
inverted: true
- platform: gpio
name: "t16m-W1-io16"
pin:
number: 16
inverted: false
- platform: gpio
name: "t16m-W1-io17"
pin:
number: 17
inverted: false
- platform: gpio
name: "t16m-W1-io18"
pin:
number: 18
inverted: false
- platform: gpio
name: "t16m-io0"
pin:
number: 0
inverted: false
web_server:
port: 80
download yaml file: