#error "Please specify your BLYNK_TEMPLATE_ID and BLYNK_DEVICE_NAME" Blynk 2.0

Dear Blynk Team
i have this error please take a look the pictures as well #error “Please specify your BLYNK_TEMPLATE_ID and BLYNK_DEVICE_NAME” Blynk 2.0 i allready mention temp id and device name.

// Fill-in information from your Blynk Template here
#define BLYNK_TEMPLATE_ID "TMPLPdQb0fB7"
#define BLYNK_DEVICE_NAME "ESP 32 DEMO"

#define BLYNK_FIRMWARE_VERSION        "0.1.0"

#define BLYNK_PRINT Serial
//#define BLYNK_DEBUG

#define APP_DEBUG

// Uncomment your board, or configure a custom board in Settings.h
#define USE_WROVER_BOARD
//#define USE_TTGO_T7

#include "BlynkEdgent.h"

void setup()
{  

I need an answer from Blynk team .
Thanks

@chuonghuynh what’s your problem exactly ?
Can you explain please ?

@chuonghuynh
Bro can post here your BlynkEdgent code

Maaz


i have this error please take a look the pictures as well #error “Please specify your BLYNK_TEMPLATE_ID and BLYNK_DEVICE_NAME” Blynk 2.0

No this error send the code of BLYNKEDGENT thank you

Maaz

[Unformatted code removed by moderator]

@chuonghuynh I’ve removed the code you posted because it wasn’t correctly formatted with triple backticks at the beginning and end, to make it display correctly.
Triple backticks look like this:
```

Also, this isn’t the code that we need to se. We need to see the contents of your “Edgent_ESP8266.ino” file.
My guess is that you still have the #define BLYNK_TEMPLATE_ID and #define BLYNK_DEVICE_NAME lines of your code commented-out with double forward slashes (//).

Pete.

As you get:

please be sure you have Blynk library 1.0.1 installed.

Hello Everyone,
I have the same problem which jumps out after compiling the script. In the script (.ino) is all my details fill in and the line is un-commented and the problem is the same…

xxx/Documents\Arduino\libraries\Blynk\src/Blynk/BlynkApi.h:39:6: error: #error “Please specify your BLYNK_TEMPLATE_ID and BLYNK_TEMPLATE_NAME”
#error “Please specify your BLYNK_TEMPLATE_ID and BLYNK_TEMPLATE_NAME”
^~~~~

Hello Everyone,
GOOD NEWS problem solved !
I was using two libraries for BLYNK…
1/ Blynk by Volodymyr Shymanskyy (v-1.2.0)
2/ BlynkESP32_BT_WF by Knoi Hoang (v-1.2.2)

Just deleted the second from Arduino IDE and problem magically disappear !
Compiled script without any issues and now in progress to upload to device.
Fingers crossed …

1 Like

For anyone who is wondering why your code is not working even if you included the “BLYNK_TEMPLATE_ID and BLYNK_TEMPLATE_NAME”, In the new update they hardcoded these variables but there seems to be a bug.
To Fix this issue [Instructions about editing the Blynk libraries removed by moderator]

Edit by moderator…

There are a number of scenarios that can cause this compiler error message in version 1.3.0 of the Blynk library…

  1. Your #define BLYNK_TEMPLATE_ID and #define BLYNK_TEMPLATE_NAME lines of code need to be at the very top of your sketch

  2. You need to ensure that your code does actually say #define BLYNK_TEMPLATE_ID and not #define BLYNK_DEVICE_ID
    Earlier versions of the Blynk web console used #define BLYNK_DEVICE_ID and this was confusing, because the ID belongs to the template and not the device. If you created a sketch some time ago and this included #define BLYNK_DEVICE_ID then it won’t compile under release 1.3.0 of the Blynk library unless you amend this line of code.

As always, It’s recommended that you go to the web console and copy the two or three lines of firmware configuration code and paste it directly into the very beginning of your sketch.

Pete.

End of edit by moderator

@Zeath did you read the post I linked here…

I’ve tested this and can’t find a bug - only user error where BLYNK_DEVICE_NAME continues to be used instead of BLYNK_TEMPLATE_NAME.

Can you provide an example sketch where the code won’t compile?

Pete.

Hey @PeteKnight sure here’s it is

#define BLYNK_PRINT Serial

#include <ESP8266WiFi.h>

#include <BlynkSimpleEsp8266.h>

#define BLYNK_TEMPLATE_ID "**********"

#define BLYNK_TEMPLATE_NAME "*************"

#define BLYNK_AUTH_TOKEN "****************************"

char auth[] = BLYNK_AUTH_TOKEN;

char ssid[] = "***********";             //Enter your WIFI name

char pass[] = "***********";            //Enter your WIFI password

//Get the button value

BLYNK_WRITE(V0) {

  digitalWrite(D4, param.asInt());

}

void setup() {

  //Set the LED pin as an output pin

  pinMode(D4, OUTPUT);

  digitalWrite(D4, LOW);

  //Initialize the Blynk library

  Blynk.begin(auth, ssid, pass, "blynk.cloud", 80);

}

void loop() {

  //Run the Blynk library

  Blynk.run();

}

That’s because these three lines of code aren’t at the very top of your sketch…

It says this for a reason…

The 1.2.0 version of the library was more forgiving about this, but the rule is once again being enforced rigidly in version 1.3.0

Your code compiles fine for me when I make this change.

I’m going to ammed your earlier post, as it’s not appropriate for users to start hacking around with the libraries to remove the enforcement of these rules.

Pete.

2 Likes

I just checked by reverting the changes i did in the library and putting the defining variables at the top, It seems to have fixed it but a note to the devs (Nobody defines their variables before including their libraries)

The libraries use templates. You need the defines before the includes so the templates can pick them up.

I think the reason why the template ID and name need to be at the top of the sketch are so that they can be parsed correctly by the Blynk.Air process and this is why the library enforces this.

Either way, that’s the rule and Blynk requires it to be followed.

Pete.

1 Like

Hello pete, i already put it on the first of my sketch and it still #error “Please specify your BLYNK_TEMPLATE_ID and BLYNK_DEVICE_NAME” can you help me?

Not without seeing your code, and compiler error message and knowing which Blynk library version you are using.

Don’t forget the triple backticks with your code and compiler error message.

Pete.