Using another microcontroller to expand ports

Hi, I have a capacitive touchscreen that uses an obscure controller, but I was able to read and use it with a STM32 microcontroller to read the screen and parse the data to make a switch panel, I’m failing to get the STM32 to connect to the ESPHOME, the “custom_component” was removed and I don’t know how to make it, basically I want to have a slave I2C STM32 system with 32 digital inputs, so it would send 4 bytes upon request from the ESP. All the STM32 part is done, now is there a way to make a custom component to do that? I was going to copy the PCF8574 component and make it just for digital input and 4 bytes, the PCF8575 already can handle 16 bits so it would be just an extension of the same with a 3 option, PCF8574, PCF8575, and my device, or a copy cleaned just for digital inputs, and for 32 bits with another name.

Is it possible? If so how can I do it? Thanks!

This should get your custom component to work:

2 Likes

Thanks Hellis81 for the feedback! Actually using your idea, I learned about the external component and made one by copying the PCF8574 device, renamed, trimmed and changed the reading to have 32bits with 5 bytes, 4 with data and 1 for checksum! Works perfectly! Cheers!

Don’t thank me, thank Robert