Inputs include web page buttons, battery backed clock, photoresistor light sensor, ultrasonic distance sensor and digital temperature sensor. Outputs include servo, web page sensor data and relays for the light and fan.
High-res web pages are free, zero I/O HMIs and can display far more than any expensive LCD or OLED display. No app install needed. Just put the local IP address into any browser.
NodeMCU is a 3.3VDC device. The relays require a 5VDC power supply. LoLin NodeMCU has a VU output which is V USB or 5VDC. That goes to power the relays. The 3.3VDC signal from the NodeMCU activates the relays.
digitalWrite(D#, LOW) turns on a relay, not HIGH.
If AUTO mode is OFF the light and fan can be turned on or off from the web page buttons.
If AUTO mode is ON the light turns on if the photoresistor senses low light level (covered by hand).
If AUTO mode is ON the fan turns on if the temp is > 24C. Turns off again if < 23C.
Code for all of the above including the web page definition is in the NodeMCU code, programmed with Arduino IDE. Most of my new programs include libraries and code for all the above sensors whether I need them all or not. It's far easier to turn off working code I don't need than it is to create it. The actual control part of the code is usually tiny, only a few lines.
NodeMCU has far more memory available for code than Arduino Uno so including code I don't need is not a problem at all. Also WiFi capability including remote wireless uploading of programs and web page hosting. Only two of the many reasons I only use NodeMCU now instead of Arduino Uno. I haven't had a reason to use ESP32 yet. I do use ESP32-CAMs.