Start by opening the Blynk Edgent ESP8266 example from the Arduino IDE.
Add your Template ID and Device name, and un-comment the NodeMCU board type in the sketch.
You’ve created a device based on that sketch - delete that device in the web console.
Read this, especially the section about defining your switch and physical LED. You’ll then understand why this line of your code will be an issue…
Copy the relevant lines of code from your sketch into the Edgent example. DO NOT copy these lines over…
Replace this line:
With:
BlynkTimer timer;
You do not need…
in your void loop, the BlynkEdgent.run line that’s already there does the same thing.
I’d also suggest that you switch from referencing your I/O pins using a mixture of GPIO and “D” numbers, and stick with GPIO numbers throughout and add a comment which tells you which D number this is to simplify wiring.
I’d also stop trying to read your DHT sensor every 1 second and move to 5 second intervals. If you need 1 second temperature/humidity endings then switch to a faster sensor. The DCT sensors extremely slow and inaccurate and aren’t worth using for most applications, but if you do use them it’s best to read them no more than once every 5 seconds.
When you’ve uploaded the sketch you provision the board with WiFi credentials and a dynamically assigned Auth token with the “+ New Device” option in the app.
Pete.