This is happening because the particular pin you chose to run the relay (D0) goes high when the NodeMCU boots up. If you had chosen D1, that would not happen. See below for the behavior of pins on NodeMCU boot:
4 Likes
