Also can that expander be used for INPUT rather than output?
PCF8574 is input OR output (for each pin). You may also look at MCP23017, which is 16 channel I/O. Both chips are input or output, both have pull-up resistors for inputs. ESPHome supports both of them, i wouldn’t know for Pi, though, but since these chips are widely used i would be surprised it you won’t find any article on this topic.
I use them on Sonoff boards and in ESPHome i can manually decide for each pin if it’s input or output.
If i’m not mistaken you can connect up to 8 of these chips in parallel, and address them accordingly. So theoretically you can have 8x16=128 I/O’s with one board. That is if the board itself is powerfull enough to be able to drive all these chips (regarding memory and CPU power).
Very very very late reply …
But I use most of my rpi with a readonly filesystem in my gate and alarm controller and BLueIris monitor. I can cut the power without any problem, the FS never becomes corrupted.
Late late reply to your comment…
That’s a great idea mounting the card in RO mode. I’ve found booting off a USB drive to be the fastest method to get the Pi back up after power loss (I have a Samsung Fit Plus).
Whether you boot off USB or MicroSD, make sure you have a cloned backup card. Then when (not ‘if’) your media fails, you are back up and running as soon as you possible.