Linenotify sending problem when use BlynkEdgent

Hello, I’ve tried to make project with LineNotify
When I use old blynk library, It can send notification to my Line app.
this is a simple code

#define BLYNK_TEMPLATE_ID "TMPLzOIIxxje"
#define BLYNK_DEVICE_NAME "PZEM"
#define BLYNK_AUTH_TOKEN "6HcyFrx0J7PoesTuO0hLPCopAA5PW-2E"
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
#include <TridentTD_LineNotify.h>
#define LINE_TOKEN  "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
#define BLYNK_PRINT Serial
BlynkTimer timer;

BLYNK_WRITE(V7)       

{
if(param.asInt()){

    // button pressed

    LINE.notify("Test");
  }
}
void setup() {
  Serial.begin(115200);
  Wire.begin();
  Blynk.begin(auth, ssid, pass);
  LINE.setToken(LINE_TOKEN);
}
void loop() {
  Blynk.run();
  timer.run();
}

It work fine
But when I’m using BlynkEdgent it cannot send notification
Here is my code

#define BLYNK_TEMPLATE_ID "TMPLzOIIxxje"
#define BLYNK_DEVICE_NAME "PZEM"
//#define BLYNK_AUTH_TOKEN "6HcyFrx0J7PoesTuO0hLPCopAA5PW-2E"
#define BLYNK_FIRMWARE_VERSION  "0.1.0" 
#define BLYNK_PRINT Serial
#define APP_DEBUG
#define USE_WEMOS_D1_MINI
#include "BlynkEdgent.h"
#include <TridentTD_LineNotify.h>
#define LINE_TOKEN  "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"

BlynkTimer timer;
BLYNK_WRITE(V7)       

{
if(param.asInt()){

    // button pressed

    LINE.notify("Test");
  }
}
void setup() {
  Serial.begin(115200);
  Wire.begin();
  //Blynk.begin(auth, ssid, pass);
  BlynkEdgent.begin();
  LINE.setToken(LINE_TOKEN);
}
void loop() {
  BlynkEdgent.run();
  timer.run();
}

What am I doing wrong?

details here https://community.blynk.cc/t/events-notifications-and-the-use-of-flag-variables/59822?u=jon2015

When you use BlynkEdgent

Should be replaced with

BlynkEdgent.begin();

And

Should be replaced with

BlynkEdgent.run();
1 Like

It’s my mistake.
I have already replaced that in my second sketch but it not work.

May I ask you why are you using the TridentTD_Linenotify instead of Blynk events?

LINE application is the most popular chat app in my country.
I used LINE Notify for my many project.
And I need to use it in this project too.

Is your Edgent sketch successfully connecting to Blynk, and showing as “Online” in the app/web console?

Have you tried adding a serial print command alongside your LINE.notify("Test"); command to confirm that the BLYNK_WRITE(V7) callback function is being triggered by your button?

Pete.

Both sketches are online but when I have triggered V7, only the old library does work.
I will try to add serial print command to see if that function work.

I’ve try to add serial print in my sketch to see the result.
It’s work in serial but nothing send to my LINE application.


#define BLYNK_TEMPLATE_ID "TMPLwVxBNI5C"
#define BLYNK_DEVICE_NAME "Meter"

#define BLYNK_FIRMWARE_VERSION  "0.1.0" 
#define BLYNK_PRINT Serial
#define APP_DEBUG
#define USE_WEMOS_D1_MINI
#include "BlynkEdgent.h"
#include <TridentTD_LineNotify.h>
#include <Wire.h>
#define LINE_TOKEN  "REDACTED BY MODERATOR"

BlynkTimer timer;
BLYNK_WRITE(V7)       

{
if(param.asInt()){

    // button pressed

    LINE.notify("Test");
    Serial.print("Testing ");
  }
}
void setup() {
  Serial.begin(115200);
  Wire.begin();
  //Blynk.begin(auth, ssid, pass);
  BlynkEdgent.begin();
  LINE.setToken(LINE_TOKEN);
}
void loop() {
  BlynkEdgent.run();
  timer.run();
}


image

Would you try a test for me. Go back to your original sketch and change this line:

to this:

#include <BlynkSimpleEsp8266_SSL.h>

That will force the sketch to use port 443 (which is what the Edgent sketch is using) instead of port 80.

Let me know the results.

Pete.

I’ve tried what you advice.
It’s work fine.

#define BLYNK_TEMPLATE_ID "TMPLzOIIxxje"
#define BLYNK_DEVICE_NAME "PZEM"
#define BLYNK_AUTH_TOKEN "6HcyFrx0J7PoesTuO0hLPCopAA5PW-2E"
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266_SSL.h>
//#include <BlynkSimpleEsp8266.h>
#include <TridentTD_LineNotify.h>
//#define LINE_TOKEN  "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
#define BLYNK_PRINT Serial
BlynkTimer timer;
#include <Wire.h>

char ssid[] = "*****";
char pass[] = "*****";
char auth[] = BLYNK_AUTH_TOKEN;
BLYNK_WRITE(V7)       

{
if(param.asInt()){

    // button pressed

    LINE.notify("Test");
    Serial.print("Testing ");
  }
}
void setup() {
  Serial.begin(115200);
  Wire.begin();
  Blynk.begin(auth, ssid, pass);
  //BlynkEdgent.begin();
  LINE.setToken(LINE_TOKEN);
}
void loop() {
  Blynk.run();
  //BlynkEdgent.run();
  timer.run();
}

image
image

I don’t understand what you’ve just posted, this serial output wasn’t produced by this sketch.

Also, when you post serial output can you please copy the text and paste it with triple backticks rather than posting screenshots.

Pete.

It’s my example sketch for testing LINE Notify

#define BLYNK_TEMPLATE_ID "TMPLzOIIxxje"
#define BLYNK_DEVICE_NAME "PZEM"
#define BLYNK_AUTH_TOKEN "6HcyFrx0J7PoesTuO0hLPCopAA5PW-2E"
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266_SSL.h>
//#include <BlynkSimpleEsp8266.h>
#include <TridentTD_LineNotify.h>
#include <TimeLib.h>
//#define LINE_TOKEN  "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
#define BLYNK_PRINT Serial
BlynkTimer timer;
#include <Wire.h>
#include <WidgetRTC.h>
#define LINE_TOKEN  "G8sPoSG2yzcH1mSbHHyeOvoMP4MNvb3Oy4ekrnRaMVP"

char ssid[] = "@Home718";
char pass[] = "0844484484";
char auth[] = BLYNK_AUTH_TOKEN;
BLYNK_WRITE(V7)       

{
if(param.asInt()){

    // button pressed

    LINE.notify("Test");
    Serial.print("Testing ");
  }
}
void setup() {
  Serial.begin(115200);
  Wire.begin();
  Blynk.begin(auth, ssid, pass);
  //BlynkEdgent.begin();
  LINE.setToken(LINE_TOKEN);
}
void loop() {
  Blynk.run();
  //BlynkEdgent.run();
  timer.run();
}

I have created a Virtual pin V7 button for test that function.
When I pressed that button serial shown

Testing 

and Line notify work fine.

But it doesn’t work with BlynkEdgent.

I would like to see your entire serial monitor output when you test that sketch.

Pete.

That is all.

rll�r$�n�l�b|��a�rb�b�nnlnnbbp�$blrlp�n�l�bn�n��b��nn'l�l`�nnl`nr���nbl�`p�n0r�bbn�nb��nn'l`�nnl`nr���nb�`r��nb�`���l`��n�`Testing 

We don’t seem to be getting very far here.

Please don’t post screenshots of code or serial output.

I’d suggest that you move

Up, so that it is line 4 of your sketch.

I’d also suggest that you change this line:

to:

Serial.begin(74880);

and set your serial monitor to 74880 as well. This way, you will see the boot messages from your NodeMCU and see the Blynk debug messages in your serial monitor.

When you’ve done this, please post the serial monitor output as text, with triple backticks. You do not need to post the sketch again, provided that it is simply the sketch from post #1 with the Blynk SSL library change and the changes discussed above.
Also please confirm that the LineNotify test works correctly when you do this test.

Pete.

Here is it.

[286] Connecting to @Home718
[4615] Connected to WiFi
[4615] IP: 192.168.0.143
[4615] 
    ___  __          __
   / _ )/ /_ _____  / /__
  / _  / / // / _ \/  '_/
 /____/_/\_, /_//_/_/\_\
        /___/ v1.1.0 on ESP8266

 #StandWithUkraine    https://bit.ly/swua


[4727] Current time: Wed Jan 25 10:24:31 2023
[4727] Connecting to blynk.cloud:443
[5690] Ready (ping: 1ms).
Testing 

And LineNotify work correctly

So it seems that you have been using an old library at some point in your testing, so now re-test the Edgent sketch withy the latest library installed.

Pete.

This is the serial output of Edgent sketch.

[288] 
    ___  __          __
   / _ )/ /_ _____  / /__
  / _  / / // / _ \/  '_/
 /____/_/\_, /_//_/_/\_\
        /___/ v1.1.0 on ESP8266

 #StandWithUkraine    https://bit.ly/swua


[294] --------------------------
[297] Product:  Meter
[299] Firmware: 0.1.0 (build Jan 25 2023 21:54:19)
[304] Token:    Z8XI - •••• - •••��� - ••••
[310] Device:   ESP8266 @ 80MHz
[312] MAC:      BC:FF:4D:F9:80:24
[316] Flash:    4096K
[318] ESP core: 3.1.1
[319] ESP SDK:  2.2.2-dev(38a443e)
[323] Boot Ver: 6
[324] Boot Mode:1
[326] FW info:  503888/1589248, MD5:3d55ca69bc86146f4b8216b1e89e9641
[549] Free mem: 29072
[549] --------------------------

>[549] INIT => CONNECTING_NET
[551] Connecting to WiFi: @Home718
[4447] Using Dynamic IP: 192.168.0.143
[4447] CONNECTING_NET => CONNECTING_CLOUD
[4559] Current time: Wed Jan 25 14:54:48 2023
[4560] Connecting to blynk.cloud:443
[5528] Ready (ping: 12ms).
[5627] CONNECTING_CLOUD => RUNNING
Testing 

The LineNotify doesn’t work.

What happens if you move this line:

#include <TridentTD_LineNotify.h>

up one position in the code, so that it’s above the #include "BlynkEdgent.h" line of code?

Pete.