Read HTTP....,...,.,.../api/v1/data in blynk app

hello community blynk.
I search for days now, im beginner. i just buy homewizard energy.
In HTTP…/api/v1/data…in firefox i see:

smr_version 50
meter_model “Fluvius 253770234_A”
wifi_ssid “telenet-******”
wifi_strength 98
total_power_import_t1_kwh 268.579
total_power_import_t2_kwh 399.963
total_power_export_t1_kwh 1230.179
total_power_export_t2_kwh 453.123
active_power_w 32
active_power_l1_w null
active_power_l2_w null
active_power_l3_w null
total_gas_m3 616.162
gas_timestamp 210215141007

How can i send the HTTP …,.,…,.,…/api/v1/data. json info to het blynk app
now i wanne see this in the blynk app.
Later i wanne control a relais and potentio meter when active power have reached a value

please help me with the code

thanks

i find already to read from HTTP
Now te problem is him show info all in one line.
Can i change have al in different line as shown in previous message?
Thanks

[Unformatted code removed by moderator]

@magicjimmy please edit your post, using the pencil icon at the bottom, and add triple backticks at the beginning and end of your code so that it displays correctly.
Triple backticks look like this:
```

Pete.

I mean in the serial monitor Arduino.
Sorry for the misunderstanding
Thanks

This is my code::::

[Unformatted code removed by moderator]

Once again, you have posted code without the necessary triple backticks before and after the code.

I’ve provided you with triple backticks to copy/paste, please use them.
The triple backticks yo on a line of their own, followed by the code, followed by another set of triple backticks on a line of their own.

Pete.

Can you give example plz.
I dont understand, i’m Dutch speaking.

I lost my code. i think i find it here but you delete :frowning:

can you give me the code back plz
thanks

I’ve sent your code to you via PM.

When you post it, you put triple backticks on a line of their own, then your code, then triple backticks again, also on a line of their own,

Triple backticks look like this:
```

Please copy/paste the triple backticks if you are unable/unwilling to find the correct character on your Dutch keyboard.

Pete,

Ok?

void loop() {
HTTPClient http; //Declare object of class HTTPClient

String ADCData, station, getData, Link;
int adcvalue=analogRead(A0); //Read Analog value of LDR
ADCData = String(adcvalue); //String to interger conversion
station = “B”;

//GET Data
getData = “?status=” + ADCData + “&station=” + station ; //Note “?” added at front
Link = “http://******  **"**  ”"/api/v1/data" + getData;

http.begin(Link); //Specify request destination

int httpCode = http.GET(); //Send the request
String payload = http.getString(); //Get the response payload

Serial.println(httpCode); //Print HTTP return code
Serial.println(payload); //Print request response payload

http.end(); //Close connection

After time I lose connection too.

Tis one don’t work good :pensive:

I use this code now , works perfect.
How can in send data to virtual pin in terminal?
can somone help?

#include <ESP8266WiFi.h>
#include <ESP8266HTTPClient.h>
 
const char* ssid = "yourNetworkName";
const char* password = "yourNetworkPassword";
 
void setup () {
 
  Serial.begin(115200);
 
  WiFi.begin(ssid, password);
 
  while (WiFi.status() != WL_CONNECTED) {
 
    delay(1000);
    Serial.print("Connecting..");
 
  }
 
}
 
void loop() {
 
  if (WiFi.status() == WL_CONNECTED) { //Check WiFi connection status
 
    HTTPClient http;  //Declare an object of class HTTPClient
 
    http.begin("http://jsonplaceholder.typicode.com/users/1");  //Specify request destination
    int httpCode = http.GET();                                  //Send the request
 
    if (httpCode > 0) { //Check the returning code
 
      String payload = http.getString();   //Get the request response payload
      Serial.println(payload);             //Print the response payload
 
    }
 
    http.end();   //Close connection
 
  }
 
  delay(30000);    //Send a request every 30 seconds
}```

@magicjimmy as you can see when you view your last post, your code is unreadable because of all the extra single backticks that you seem to have placed throughout your code.
I’d suggest that you edit your post and re-post the code correctly.

Pete.

Ok?
I try many things.
Cant send to terminal on blynk :frowning:
thanks

Well, the sketch you posted contains no Blynk code, so that’s not really surprising.

In addition, if you did add-in the necessary Blynk code you’d get constant disconnections from the Blynk server because of your void loop and the delay that you are using.

You should read this…

http://help.blynk.cc/getting-started-library-auth-token-code-examples/blynk-basics/keep-your-void-loop-clean

and probably take a look at the Sketch Builder examples.

Pete.

That’s my problem i dont know how te put toghetter the blynk virtuil read and this code
thanks

#define BLYNK_PRINT Serial

 #include <SPI.h>
 #include <ESP8266WiFi.h>
 #include <BlynkSimpleEsp8266.h>
 #include <ESP8266HTTPClient.h>
 
const char* ssid = "tel******6";
const char* pass = "*********";
char auth[] = "eQ_uu***************9EN";
 
void setup () {
 
  Serial.begin(9600);
 Blynk.begin(auth, ssid, pass);
  WiFi.begin(ssid, pass);
 
  while (WiFi.status() != WL_CONNECTED) {
 
    delay(1000);
    Serial.print("Connecting..");
 
  }
 
}
 
void loop() {
 
  if (WiFi.status() == WL_CONNECTED) { //Check WiFi connection status
 
    HTTPClient http;  //Declare an object of class HTTPClient
 
    http.begin("http://192*********7/api/v1/data");  //Specify request destination
    int httpCode = http.GET();                                  //Send the request
 
    if (httpCode > 0) { //Check the returning code
 
      String payload = http.getString();   //Get the request response payload
      Serial.println(payload);             //Print the response payload
 Blynk.virtualWrite(V6);
    }
 
    http.end();   //Close connection
 
  }
 
  delay(30000);    //Send a request every 30 seconds

  {
  Blynk.run();
}
}

I try in void loop,Blynk.virtualWrite(V6, (payload)); Don’t work. i Have to write somthing about te terminal?


#include <SPI.h>
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
#include <ESP8266HTTPClient.h>

const char* ssid = "tele*********6";
const char* pass = "a********ny";
char auth[] = "eQ_uuEN***************U-9EN";

void setup () {

 Serial.begin(9600);
Blynk.begin(auth, ssid, pass);
 WiFi.begin(ssid, pass);

 while (WiFi.status() != WL_CONNECTED) {

   delay(1000);
   Serial.print("Connecting..");

 }

}

void loop() {

 if (WiFi.status() == WL_CONNECTED) { //Check WiFi connection status

   HTTPClient http;  //Declare an object of class HTTPClient

   http.begin("http://1*************/api/v1/data");  //Specify request destination
   int httpCode = http.GET();                                  //Send the request

   if (httpCode > 0) { //Check the returning code

     String payload = http.getString();   //Get the request response payload
     Serial.println(payload);             //Print the response payload
Blynk.virtualWrite(V6, (payload));
   }

   http.end();   //Close connection

 }

 delay(30000);    //Send a request every 30 seconds

 {
 Blynk.run();
}
}

Well, first of all you either need to allow Blynk to establish your WiFi connection via Blynk.begin or you need to set-up the WiFi connection yourself, then establish your Blynk connection via Blynk.config and Blynk.connect.

You are trying to use both WiFi.begin and Blynk.begin.

Read the documentation here…

Secondly, your code still has a cluttered void loop and 30 second blocking delay, both of which are incompatible with Blynk.

Pete.

Ok, i see now.
Keep void loop clean.
I try more, sorry beginner.
And low school education.
Never do electonics before.
Thanks for help me

i getting somwere. him print only one time to serial monito and terminal:::::
somting more with the timer?

14:51:27.538 -> ⸮⸮xW⸮⸮,⸮⸮lb8⸮[63] Connecting to telenet-A9B56
14:51:28.139 -> [564] Connected to WiFi
14:51:28.139 -> [565] IP: 192.168.0.182
14:51:28.186 -> [565]
14:51:28.186 -> ___ __ __
14:51:28.240 -> / _ )/ /_ _____ / /__
14:51:28.240 -> / _ / / // / _ / '/
14:51:28.286 -> /
//_, /////_
14:51:28.340 -> /
__/ v0.6.1 on ESP8266
14:51:28.340 ->
14:51:28.340 -> [638] Connecting to blynk-cloud.com:80
14:51:28.387 -> [773] Ready (ping: 36ms).
14:51:29.390 -> Connecting…{“smr_version”:50,“meter_model”:“Fluvius 253770234_A”,“wifi_ssid”:“telenet-A9B56”,“wifi_strength”:100,“total_power_import_t1_kwh”:276.058,“total_power_import_t2_kwh”:403.367,“total_power_export_t1_kwh”:1235.857,“total_power_export_t2_kwh”:453.123,“active_power_w”:104,“active_power_l1_w”:null,“active_power_l2_w”:null,“active_power_l3_w”:null,“total_gas_m3”:623.29,“gas_timestamp”:210218145006}
14:52:05.135 -> [37533] Connecting to blynk-cloud.com:80
14:52:05.235 -> [37657] Ready (ping: 73ms).

#define BLYNK_PRINT Serial

#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
#include <ESP8266HTTPClient.h>

// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "MHti-EY********uPejTHye";

// Your WiFi credentials.
// Set password to "" for open networks.
char ssid[] = "telen*******B56";
char pass[] = "aK*******ny";

void setup()
{
  // Debug console
  Serial.begin(9600);

  Blynk.begin(auth, ssid, pass);
while (WiFi.status() != WL_CONNECTED) ;
 
    delay(1000);
    Serial.print("Connecting..");
 
  if (WiFi.status() == WL_CONNECTED) ; //Check WiFi connection status
 
    HTTPClient http;  //Declare an object of class HTTPClient
 
    http.begin("http://192.1******47/api/v1/data");  //Specify request destination
    int httpCode = http.GET();                                  //Send the request
  
    if (httpCode > 0) ; //Check the returning code
 
      String payload = http.getString();   //Get the request response payload
      Serial.println(payload);             //Print the response payload
Blynk.virtualWrite(V6, (payload));
    
 
    http.end();   //Close connection
 
  
  delay(30000);    //Send a request every 30 seconds

}
void loop()
{
  Blynk.run();
}