BLYNK
BLYNK.IO       📲 GETTING STARTED       📗 DOCS       ❓HELP CENTER       👉 SKETCH BUILDER

Local server issue connecting more than 1 device

Hello everyone :slight_smile:
I setup a local blynk server on my raspberry pi 4 everything works fine i can connect from the mobile app via cellular or wifi, but only 1 device works!
When i put the same code (that works) on another device booth of them esp8266 the new device won‘t connect to the server ip…

I hope you can help me , have a nice evening

Each device needs a unique Auth code, and if you are specifying IP address or MAC address in your sketch then they need to be unique too.

Pete.

Ohh sorry i forget, also when i make a completly new blynk project with the same code but other auth key it won‘t connect.

I think you need to explain more, maybe starting with the basics about server version, library version, hardware, sketches (correctly formatted with triple backticks), server logs etc, along with a complete description of what you’ve done so far and what results you are seeing.

Pete.

so server version is 0.41.16
blynk version is 1.0.0.beta 3

#define BLYNK_PRINT Serial  // This prints to Serial Monitor
#define BLYNK_DEBUG  // Optional, this enables more detailed prints
#include <ESP8266WiFi.h>  // for ESP8266
#include <BlynkSimpleEsp8266.h>  // for ESP8266

char auth[] = "fZtQYt-Q7igpWgWiPCJF_WMRu_P6eOjK";
char ssid[] = "IOT";
char pass[] = "23122012";
char server[] = "192.168.1.101";  // IP for your Local Server
int port = 8080;



void setup() {
  
  Serial.begin(9600);  // BLYNK_PRINT data
  WiFi.begin(ssid, pass); 
  Blynk.config(auth, server, port);
  Blynk.connect();
}



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

its a very easy code just to test if it works.
ive searched the hole web for information, checked double and dripple times that the ports are correctly forwarding.

thank you for helping me

and her is the server log :

17:25:58.678 INFO - Using data dir ‘/home/pi/Blynk’
17:26:00.617 INFO - Region : local. Host : 127.0.1.1.
17:26:01.524 INFO - Initializing gmail smtp mail transport. Username : example@gmail.com. SMTP host : smtp.gmail.com:587
17:26:01.592 INFO - Reports : 0
17:26:01.593 INFO - Didn’t find custom user certificates.
17:26:01.596 INFO - Didn’t find Let’s Encrypt certificates.
17:26:01.596 WARN - You didn’t specified ‘server.host’ or ‘contact.email’ properties in server.properties file. Automatic certificate generation is turned off. Please specify above properties for automatic certificates retrieval.
17:26:01.596 WARN - ATTENTION. Server certificate paths (cert : ‘/home/pi’, key : ‘/home/pi’) not valid. Using embedded server certs and one way ssl. This is not secure. Please replace it with your own certs.
17:26:05.468 INFO - HTTP API and WebSockets server listening at 8080 port.
17:26:05.472 INFO - HTTPS API, WebSockets and Admin page server listening at 9443 port.
17:26:05.474 INFO - Mqtt hardware server listening at 8440 port.
17:27:07.755 INFO - hardware joined.
17:27:10.509 INFO - hardware joined.
17:27:12.820 INFO - Blynk-app (iOS-22606) joined.
17:27:15.553 INFO - hardware joined.

Downgrade to 0.6.1

Pete.

1 Like

1:10:13.106 → / _ )/ /_ _____ / /__
21:10:13.152 → / _ / / // / _ / '/
21:10:13.198 → /
//_, /////_
21:10:13.198 → /
__/ v0.6.1 on ESP8266
21:10:13.245 →
21:10:13.245 → [91] Connecting to 192.168.1.101:8080
21:10:18.121 → [5091] Connecting to 192.168.1.101:8080
21:10:23.108 → [10092] Connecting to 192.168.1.101:8080
21:10:28.134 → [15093] Connecting to 192.168.1.101:8080
21:10:33.127 → [20094] Connecting to 192.168.1.101:8080
21:10:38.113 → [25095] Connecting to 192.168.1.101:8080
21:10:43.120 → [30096] Connecting to 192.168.1.101:8080
21:10:48.115 → [35097] Connecting to 192.168.1.101:8080
21:10:53.121 → [40098] Connecting to 192.168.1.101:8080
21:10:58.101 → [45099] Connecting to 192.168.1.101:8080
21:11:03.138 → [50100] Connecting to 192.168.1.101:8080
21:11:08.113 → [55101] Connecting to 192.168.1.101:8080
21:11:13.117 → [60102] Connecting to 192.168.1.101:8080

nothing changed…

So, explain more…

Is one device already connected and this is the second that won’t connect?
Where is the code for the other device?

Pete.

Yes exactly 1 device is connected with this code :slight_smile:


  #define BLYNK_PRINT Serial  // This prints to Serial Monitor
  #define BLYNK_DEBUG  // Optional, this enables more detailed prints 
  #include <ESP8266WiFi.h>
  #include <BlynkSimpleEsp8266.h>
  #include <Wire.h>
  #include <DHT.h>
  #define DHTPIN 0        
  #define DHTTYPE DHT11 

const int AirValue = 852;  
const int WaterValue = 406; 
const int SensorPin = A0;
int soilMoistureValue = 0;
int soilmoisturepercent=0;


  char auth[] = "nRQcYwTQbCxXJFArHDNkM9_SOzzDmzyS";
  char ssid[] = "Connecto Patronum";
  char pass[] = "23122012";
  char server[] = "192.168.1.101";  // IP for your Local Server
  int port = 8080;
    

  DHT dht(DHTPIN, DHTTYPE);
  BlynkTimer timer;

  void sendSensor()
{
  float h = dht.readHumidity();
  float t = dht.readTemperature(); 
  float te = soilmoisturepercent = map(soilMoistureValue, AirValue, WaterValue, 0, 100);
  if (isnan(h) || isnan(t))
  {
    Serial.println("Failed to read from DHT sensor!");
    return;
  }

  Blynk.virtualWrite(V5, t);
  Blynk.virtualWrite(V6, h);
  Blynk.virtualWrite(V7, te);
} 
 
void setup() {
   Serial.begin(9600); 
   WiFi.begin(ssid, pass); 
   Blynk.config(auth, server, port);
   Blynk.connect();

  dht.begin();
 
  timer.setInterval(1000L, sendSensor);
}
 
 
void loop() 
{
soilMoistureValue = analogRead(SensorPin);  
Serial.println(soilMoistureValue);
soilmoisturepercent = map(soilMoistureValue, AirValue, WaterValue, 0, 100);
if(soilmoisturepercent > 100)
{
  Serial.println("100 %");
  

}
else if(soilmoisturepercent <0)
{
  Serial.println("0 %");
  
 
  delay(1000);
 
}
else if(soilmoisturepercent >=0 && soilmoisturepercent <= 100)
{
  Serial.print(soilmoisturepercent);
  Serial.println("%");
  

  delay(1000);
  
} 
  Blynk.run();
  timer.run(); 
}

and the second device i tested with the “test” code from above won’t connect

What does your server properties file look like?

If you disconnect the device which is currently connected, does the other device connect?

Pete.

so i don^t find the server properties file, maybe i don^t created one.
github says for more flexibility i can create the file…
should i do this ?

and no the other device won`t connect :frowning:

It’s probably a good idea. You’ll need to restart afterwards.

Faulty device maybe?

Pete.

so i try to create this and hope the best :slight_smile:

checked ith 3 other devices everitme the same issue.

So for anyone who‘s intresstet,
The problem was the router somehow it lets connect the esp‘s to wifi but don‘t let them connect to the ip adress of the local server…
I managed it with an old router that i installed as a access point ! (Firewall are turned off on ap)
So i let the esps connect to the ap and then to the ip of the the server, i dont know why but this works fine !
@PeteKnight thanks for your tips and help !

1 Like