Provided this doesn't happen too often you can save the relay state in the MCU EEPROM and then at power on read the saved state and activate the relays accordingly.
NodeMCU doesn't have any EEPROM as far as I know, unfortunately.
Provided this doesn't happen too often you can save the relay state in the MCU EEPROM and then at power on read the saved state and activate the relays accordingly.
NodeMCU doesn't have any EEPROM as far as I know, unfortunately.