Question about I2C communication, reading pins

Hello! I am new to this forum, but I had to register after struggling for some time with my problem.

I am using ESPHome and the I have tried to build my setup with ESP8266 (nodemcu) with i2c using MCP23017 or PCF8574. What I can do is write to pins on my MCP23017 or PCF8574 (i can control relays etc). But for my setup I need to read the status of the pins (binary input).
I have no problem reading the “local” pins of ESP8266, but as soon as I change the pins to MCP23017 or PCF8574 I get nothing.

From this I assume following:

  • the code is ok
  • i have missed out something with reading the pins.

So what is the hardware configuration to reading from the pins if using i2c devices such as MCP23017 or PCF8574. I have tried multiple MCP23017 versions and PCF8574, all have the same problem.
Should there be a resistor or so, if so what size (ohm)?

Thank you in advance!

Sorry no one here is a mind reader. Show us your code, show us your log, someone will try to help

Thank you for not reading my post and my question!

I found the answer already. I had used 2k ohm resistor, and after switching to 10k ohm resistor it started working. Works now perfectly!