2024-09-27 Wlan geändert

This commit is contained in:
hans-jurgen 2024-09-27 13:17:27 +02:00
parent 226a697fea
commit 5124141762

View File

@ -59,9 +59,9 @@ char topicWert[20];
char msg[20]; char msg[20];
#ifdef TEST #ifdef TEST
const char* ssid = "St.-Peters-Gasse"; const char* ssid = "MagentaWLAN-RGDO";
const char* password = "1952994784599317"; const char* password = "93329248424922704583";
IPAddress ip( 192, 168, 127, 213 ); IPAddress ip( 192, 168, 127, 242 );
IPAddress gateway( 192, 168, 127, 1 ); IPAddress gateway( 192, 168, 127, 1 );
IPAddress subnet( 255, 255, 255, 0 ); IPAddress subnet( 255, 255, 255, 0 );
IPAddress dns(192, 168, 127, 1); // DNS-Server IPAddress dns(192, 168, 127, 1); // DNS-Server
@ -89,7 +89,7 @@ void reconnect() {
Serial.println("connected"); Serial.println("connected");
// blink.detach(); // blink.detach();
digitalWrite(LED_BUILTIN, HIGH); digitalWrite(LED_BUILTIN, HIGH);
sprintf(topic, "%s%d%s", "hjk/devices/", deviceId, "/telemetry/ID" ); sprintf(topic, "%s%ld%s", "hjk/devices/", deviceId, "/telemetry/ID" );
client.publish(topic, sID); client.publish(topic, sID);
} else { } else {
ErrLoop ++; ErrLoop ++;
@ -198,7 +198,7 @@ void setup() {
#endif #endif
digitalWrite(BUILTIN_LED, HIGH); digitalWrite(BUILTIN_LED, HIGH);
deviceId = ESP.getChipId(); deviceId = ESP.getChipId();
sprintf(sID, "%010d", deviceId); sprintf(sID, "%010ld", deviceId);
Serial.print("ID: \t\t"); Serial.println(deviceId); Serial.print("ID: \t\t"); Serial.println(deviceId);
client.setServer(mqtt_server, 1883); client.setServer(mqtt_server, 1883);
} }
@ -264,7 +264,7 @@ void loop(){
} }
pixels.show(); pixels.show();
itoa(CO2Wert, msg, 10); itoa(CO2Wert, msg, 10);
sprintf(topic, "%s%d%s", "hjk/devices/", deviceId, "/telemetry/co2" ); sprintf(topic, "%s%ld%s", "hjk/devices/", deviceId, "/telemetry/co2" );
client.publish(topic, msg, true); client.publish(topic, msg, true);
delay(500); delay(500);
endTime = millis(); endTime = millis();