First issue is very small, just asking why. For some reason, the first pin on PCF8574 is reversed. When the door is closed, the status of this first pin is 1, when the door is opened, the status is 0. All other pins are correct. If the doors or windows are closed, the display 0 and 1 when opened. Home Assistant has a way around it and I used it.
The second issue is something I need to fix. When I reboot the Home Assistant, it displays incorrect status of the pins. The Home Assistant's explanation is this:
I guess, it means that retain flag is not set. How do I set it? I do not see anything about this in ESPEasy control panel.If the messages are published with the retain flag set, the binary sensor will receive an instant update after subscription and Home Assistant will display the correct availability state of the binary sensor when Home Assistant starts up.