All relay turns on automatically when my nodemcu reboot

when my nodemcu reboots, relay associated with my button widget turn on automatically regardless of button status . if remove the button widget nodemcu works normally. as soon as if add button widget it gives me problem. relays, which are not associated with button widget are not turning on automatically. if i tried with blynk local server, everthing works flawless.
but i want to use with blynk coud.
i started working on blynk one month back, at first it working. last three days, i am facing problem.
please help me

my code

#define BLYNK_PRINT Serial
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
char auth[] = "****************************";
char ssid[] = "**************";
char pass[] = "*************";

void setup()
  // Debug console
  Blynk.begin(auth, ssid, pass); 


void loop()

There is no code for running digital pins, so your code is fine :slight_smile: Blynk.syncAll() will pick up all states from the app and apply it to all digital and virtual pins. So it should be working. What version of Android app are you using?

android app version 2.16.7

Just checked out my NodeMCU running 8 relay box and having Blynk.syncAll function included in the code, everything works fine. What version of ESP8266 core are you using for Arduino IDE?

Node MCU 0.9 ( esp-12) (ai thinker)

it is working for last three weeks, last three days i am facing problem

No, you are not. Open Arduino IDE, then go to Tools ->Board->Boards manager. Go to the end of the list where ESP8266 is, then click on it and read the version. It should be like 2.2.0, 2.3.0, 2.4.0rc2…

What GPIO port are you using for relay?

gpio5, gpio2, gpio4, gpio14

That’s not what I’m asking for. Scroll up, there should be Boards Manager above Arduino boards section. Click on Boards Manager, then scroll down to ESP8266 bu ESP8266 community and read installed version.


That’s the answer to your problems. Upgrade to 2.4.0rc2 and reflash your NodeMCU.

Details at:

Thank u @zodiac I will try


Also replace this:

with this:

when using NodeMCU or any other ESP8266 board in stand alone mode.

No luck, problem continues even after changing esp8266 core version and baud rate to 115200

Same problem occurs even when my WiFi router is restart or internet connection lost, all the relays connected to app widget getting turned on automatically. I think some problem with blynk.syncAll(); when nodemcu connects to WiFi or internet, it is not sync with app widgets that why relays turning on, so please guide to solve this problem

This is really strange. If you selected four digital pins to be connected to buttons in Android app without setting GPIO states and virtual pins (without code, to be more precise), only ONE should go low, not all of them, and that is really connected to Blynk. But I never heard of every single GPIO going low after restart, especially having Blynk.syncAll active, which should restore all pin states; that makes no sense at all. Convert your GPIO ports to virtual pins, set relay states and you will be fine, it is obvious that support for direct control of GPIO is not working well these days.

But everything working fine local server, I don’t have dedicated pc to run local. Gpio (relays) associated with button widget only gives problem. Thank u for ur support @zodiac

I’m running my setup on local server, with directly addressed digital pins from Android app, everything working fine. Never tried cloud in this setup, so I don’t know. But syncAll should be working, it’s Blynk feature.

Can u try once in cloud set up please. For me also no problem in local setup. Even three days before it is working in cloud setup. Last three days only I am facing problems