Search the forum, I posted an example flow that lets you get and set pins for a PCF8574 breakout board or IC with a Raspberry Pi. The trick really is to maintain a 'register' the pin states, so as you toggle stuff, you can maintain what the state is for each pin per change. So, Have A PCF8574, And Want To Use It Via Node Red?
Although my solution drives the pins for output, using the flow as a base for reading input should be possible. as well, if anyone wants input support.
I use my flow as a foundation for several solutions, driving relays for example, for my garage door, and lights, my sprinkler controller, etc.
But a word of caution, if you are driving DC switching with relays for example, be sure to know the impact of inductive loads/loading. I only drive 5v and 12v solutions that are DC based, so impact of inductive loading is not significant. But higher DC levels can and does have impact on any relays.