Good morning I'm using with blynk to monitor the powertheft and i get "blinkwifi has no member auth" error!

// Meter A (disturbution side meter )
#define BLYNK_PRINT Serial
//Dependiences
#include "EmonLib.h"
#include <WiFi.h>
#include <WiFiClient.h>
#include <BlynkSimpleEsp32.h>
EnergyMonitor emon;
// calibrate() method calibrates zero point of sensor,
#define vCalibration 160
#define currCalibration 1
//Global variable
char auth[] = "hoTrirFa5RWtBFYvxS6I-JMkosOOlvfO";//Token for Meter-A      
char ssid[] = "Research Cell";//
char pass[] = "Welcome@RE";//
//Bridge Widget Blynk Server
WidgetMap bridge1(V10);
BLYNK_CONNECTED()
{
  Blynk.auth("nRF0cEsICPXlgrb0icLP26U6_AipaATc");  //(Meter B token )allow permission to write the values to Meter B++++++
}
void setup()
{
  // Debug console
  Serial.begin(9600);
  WiFi.begin();
  Blynk.begin(auth, ssid, pass, IPAddress(192,168,0,144));// Put you Local machine IPAddress if using Local Machine as server++++++++
  // ZMPT101B sensor connected to GPIO 35
  emon.voltage(35, vCalibration, 1.7); // Voltage: input pin, calibration, phase_shift
  // Acs712 sensor connected to GPIO 34
  emon.current(34, currCalibration); // Current: input pin, calibration.
}
void loop()
{
  //-------------------------------------------------Data Setup---------------------------------------
  emon.calcVI(20, 2000);
 // Serial.println(String(" A ") + emon.Irms  + (" Voltage ") + emon.Vrms + (" Watts ") + emon.apparentPower );
  delay(100);
  Blynk.virtualWrite(V0, emon.Irms );// display amps temporary
  Blynk.virtualWrite(V1, emon.apparentPower);  // send Watt to Device B (Consumer meter for match )web interface
  delay(100);
  Blynk.run();
}

in this code i get an error like
C:\Users\sakth\OneDrive\Documents\Arduino\sketch_sep17a\sketch_sep17a.ino: In function ‘void BlynkOnConnected()’:
C:\Users\sakth\OneDrive\Documents\Arduino\sketch_sep17a\sketch_sep17a.ino:20:9: error: ‘class BlynkWifi’ has no member named ‘auth’
Blynk.auth(“nRF0cEsICPXlgrb0icLP26U6_AipaATc”); //(Meter B token )allow permission to write the values to Meter B++++++
^~~~

exit status 1

Compilation error: ‘class BlynkWifi’ has no member named ‘auth’
in which i have to give the token for meter b to allow that meter to write the values from meter a

Are you running a Blynk Legacy local server, or attempting to run this code using Blynk IoT?
What version of the Blynk C++ library are you using?

Your code makes no sense either way, but the solution will depend on your answer.

Pete.

Blynk iot …
The thing is I want to identify the power theft using blynk …

Okay, so the code you are using - which you’ve presumably found on the internet somewhere and modified - was originally written for Blynk Legacy.

Legacy used a system known as Bridge to send data from one Blynk device to another, but Bridge is no longer supported in Blynk IoT.

How many Blynk devices are you planning on using, and how good are your C++ coding skills?

Pete.

We are using 2 templates in blynk and two separate circuits…
I’ll rate myself 5/10 in C++ coding skills…
And if bridge is no longer
Supported in blynk iot want am I supposed to do now ?

Does that mean two devices, where you wnat to send the data from device “A” to device “B” ?

Pete.

Yes sir … there are two meters and we connect each to separate template in blynk and the difference is displayed in a template

I’ll attach here the codes for meter B also

#include <WiFi.h>
#include <WiFiClient.h>
#include <BlynkSimpleEsp32.h>
EnergyMonitor emon;
// calibrate() method calibrates zero point of sensor,
#define vCalibration 160
#define currCalibration 1
//Global variable
char auth[] = "nRF0cEsICPXlgrb0icLP26U6_AipaATc"; //Token for Meter-B
char ssid[] = "Research Cell";
char pass[] = "Welcome@RE";
unsigned int Meter_A = 0; // create variable for Watts values received from Meter-A
int Relay = 13; //GPIO 13
int theft =  0; // Varible for Theft Aleart on Virtual Pin
int PD ; //Power difference
WidgetBridge bridge1(V10);
// Assign virtual pin 10 of this device for Bridge Widget
//to communicate with other Devices (Meter B) and the channel is named "bridge1"
void setup()
{
  // Debug console
  Serial.begin(9600);
   Blynk.begin(auth, ssid, pass, IPAddress(192,168,0,144));// Put you Local machine IPAddress if using Local Machine as server
  pinMode(Relay, OUTPUT);
  // ZMPT101B sensor connected to GPIO 35
  emon.voltage(35, vCalibration, 1.7); // Voltage: input pin, calibration, phase_shift
  // Acs712 sensor connected to GPIO 34
  emon.current(34, currCalibration); // Current: input pin, calibration.
}
void loop()
{
  //-------------------------------------------------Data Setup---------------------------------------
  emon.calcVI(20, 2000);
 // Serial.println(String("Current: ") + Amps + (" Volts: ") + emon.Vrms + (" Meter-B-Watts: ") + emon.apparentPower + ( "  Meter-A-Watts: ") + Meter_A + (" PD:") + PD) ;
 float Amps = emon.Irms;
  Blynk.virtualWrite(V0, emon.Vrms);
  Blynk.virtualWrite(V1, Amps);
  Blynk.virtualWrite(V2, emon.apparentPower);
  delay(100);
  Blynk.run();
  //---------------------------------------------------------Power Cutoff--------------------------------------------------
  PD = Meter_A - emon.apparentPower ;// Power difference in Meter A and Meter B
  if ((PD >= 10) && (PD >= -10)) {
    theft = 1 ;
    Blynk.virtualWrite(V3, theft);
    digitalWrite(Relay, LOW); // Reverse triger Relay (Low - on) &( High-off)
    delay(300);
  } else {
    digitalWrite(Relay, HIGH); //
    theft = 0 ;
    Blynk.virtualWrite(V3, theft);
    delay(300);
  }
}
// Power Feedback (Theft detection)
BLYNK_WRITE(V1) // V1 is th eVirtual Power Pin of Meter-A
{
  Meter_A = param.asInt();// Fetching Watts Data form Meter-A in integers
  delay(100);
}```

Your code has been removed because you didn’t use triple backticks when posting it.

I keep asking you a question about devices and you keep answering and referring to templates.

Until you answer this question…

I am unable to give you a sensible response.

Pete.

Yes sir it’s kind of sending data from device A to device B

Would you like to clarify what you mean by “kind of”?

If you want my help you need to start communication better!

Pete.

Okey sir
We measure power produced in one device and consumed in another device and from both the devices the details are send and the difference is noted and displayed in blynk
The produced power from device 1 also displaced in blynk template
Thank you

You still aren’t making much sense.

Do you want the data from device “A” to be displayed on the dashboard for device “B”, alongside data tgat comes directly from device “B”?

References to templates aren’t useful at this stage, unless you provide significantly more information.

Pete.

Data from device a is displayed on a dashboard
Data from device A compares with device B data and displayed on another dashboard
Am i clear

Okay, the simplest method of sending data from one device to another is to use Automations. There are some restrictions to this method, but if it fits your use-case then you should use that method.

Otherwise you can use the HTTP(S) API to simulate the use of Legacy Bridge, or you could use Node-Red, but this seems like an overkill for your project.

You also need to make some changes to your code, inserting the Blynk Template ID and Template Name from Device > Device Into at the very top of each sketch.

Pete.

Thank you Mr Pete
I inserted template ID and name
And may I know … how to use HTTP(S)API

I’ve provided you with a link. How about you click on it and start reading?

Pete.

1 Like

Thank you