I cant connect to blynk app

Please I have the some problem and I don’t know how to solve it … could you help me to solve it, I would appreciate it from the heart

  • Wemos D1R1

  • Smartphone OS Android 10

  • blynk library v 1.0.0

  • local server

this is my code

#define BLYNK_PRINT Serial
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
#include <PubSubClient.h>
#include <Wire.h>
#include <Adafruit_INA219.h>
Adafruit_INA219 ina219_A(0x40);
BlynkTimer timer;
char ssid[] = "HUAWEI nova 5T";
char pass[] = "12345688";
char auth[] = "1j3YkPnBsVGfbsu8jG5-KiLSSDUGmvM3";
const char* mqtt_server = "192.168.43.73";
WiFiClient espClient;
PubSubClient client(espClient);
long lastMsg = 0;
char msg[50];
void sendSensor() {
  float Ashuntvoltage = 0;
  float Abusvoltage = 0;
  float Acurrent_mA = 0;
  float Aloadvoltage = 0 ;
  Ashuntvoltage = ina219_A.getShuntVoltage_mV();
  Abusvoltage = ina219_A.getBusVoltage_V();
  Acurrent_mA = ina219_A.getCurrent_mA();
  Aloadvoltage = Abusvoltage + (Ashuntvoltage / 1000);
  Blynk.virtualWrite(V0, Ashuntvoltage);
  Blynk.virtualWrite(V1, Abusvoltage);
  Blynk.virtualWrite(V2, Acurrent_mA);
  Blynk.virtualWrite(V3, Aloadvoltage);
}
void setup() {
  ina219_A.begin();
  Serial.begin(9600);
  Blynk.begin(auth, ssid, pass);
  WiFi.begin(ssid, pass);
  client.setServer(mqtt_server,1883);

}

void reconnect(){
  while(!client.connected()){
    if(client.connect("ESP8266client")){
      Serial.print("connected");
    }
    else {
      Serial.print("failed");
      Serial.print(client.state());
      Serial.println(" try again in 5 seconds");
      delay(5000);
    }
  }
}

void loop() 
{
  // put your main code here, to run repeatedly:
  Blynk.run();
  timer.run();
  if (!client.connected()){
    reconnect();
  }
  client.loop();
  long now = millis();
  if (now - lastMsg > 1000){
    lastMsg = now;
    
  float arus = 0;
  float volt = 0;
  arus = ina219_A.getCurrent_mA();
  volt = ina219_A.getBusVoltage_V();

  char arusString[8];
  dtostrf(arus, 1, 2, arusString);
  Serial.print("Arus (mA) : ");
  Serial.println(arusString);
  client.publish("arus", arusString);

  char voltString[8];
  dtostrf(arus, 1, 2, voltString);
  Serial.print("Tegangan (mA) : ");
  Serial.println(voltString);
  client.publish("volt", voltString);
  }
}```

@xyrish 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’ve changed it

Now let’s start with some basics should we…

Add details :
• Hardware model + communication type. For example: Arduino UNO with Ethernet Shield
• Smartphone OS (iOS or Android) + version
• Blynk server or local server
• Blynk Library version

You’ve added the Blynk20 tag to your post. Does this mean that you are using the new version of Blynk (Blynk.360 and Blynk.Edgent)?

The same problem as what?

Pete.

sorry i mean some

Xyrish.

This Blynk.begin statement will always try to connect to the cloud servers. You need to specify the IP address and port for it to work with local server.

Your code is mostly MQTT based, and your void loop is far to cluttered to work effectively with Blynk.

My advice would be not to use Blynk on your device, but instead use Node-Red and install the Blynk ws contrib so that Node-Red and MQTT can act as the bridge between Blynk and your device.

Pete.