Switchfunction on dashbord not working right

Hello all,

im playing around with ESPHome and a PCF8574 as an port expander for my Nodemcu. So i got it working that i can switch the output from the dashboard.

Then i went on to controll an 8 channel relay board wih the expander and there starts the problems.
When i’m in the log window of ESPHome on the NodeMCU i can switch the button on the Dashboard without any problem.
The relay switches over just like expectet but as soon as i leave the log window the dashboard button can be pressed and the state of the Dashboardbutton changes but the relay sometimes didnt.

Its realy strange and i cant figuer out why because whenever i go back to the logs it functions completly normal.

So my question is if somebody ever expericend the same or if there is some kind of workaround to monitor the state of the output and correct it if its not the same with what it should be.