From ad373e4269e13b7c46d93002845c537a4da63597 Mon Sep 17 00:00:00 2001 From: hans-jurgen Date: Mon, 7 Oct 2024 17:00:47 +0200 Subject: [PATCH] 2024-10-0701 Kein Kontakt zum MQTT Server --- include/mess_htu21.h | 2 +- platformio.ini | 4 ++-- src/main.cpp | 13 +++++++------ 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/include/mess_htu21.h b/include/mess_htu21.h index b992914..c17c633 100644 --- a/include/mess_htu21.h +++ b/include/mess_htu21.h @@ -28,7 +28,7 @@ void init_HTU21(){ void read_HTU21D() { float t = htu.readTemperature(); - t = t + K_HTU; + t = t + KorrekturTemperatur; dtostrf(t,7,1,htuData.temperature); float h = htu.readHumidity(); dtostrf(h,7,1,htuData.humity); diff --git a/platformio.ini b/platformio.ini index c30e606..4602fec 100644 --- a/platformio.ini +++ b/platformio.ini @@ -88,7 +88,7 @@ build_flags = ${env.build_flags} -DDNS=\"192.168.2.1\" -DKMYIP=\"192.168.2.41\" -Dmqtt_server=\"hjkmqtt.dedyn.io\" - -Dmqtt_port=8883 + -Dmqtt_port=61883 -DTERROR=20 -DTLOWBATT=60 -DTINTERVAL=5 @@ -96,7 +96,7 @@ build_flags = ${env.build_flags} -DUBKorectur=0.854417949 -DMinimalSpannung=3.00 -DKorrekturLuftdruck=23.58 - -DKorrekturTemperatur=0.0 + -DKorrekturTemperatur=-3,5 [env:hjk] build_flags = ${env.build_flags} diff --git a/src/main.cpp b/src/main.cpp index ac7cc9e..ed55e9b 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -14,7 +14,7 @@ void reconnect(); void setup_wifi(); -void verifyFingerprint(); +//void verifyFingerprint(); void callback(char* topic1, byte* payload, unsigned int length); void pulse_pin(uint8_t pin); @@ -49,9 +49,9 @@ IPAddress dns; IPAddress secondaryDNS(8, 8, 8, 8); -//const char* mqtt_fprint = "a3:44:1d:aa:6e:e5:c7:55:02:20:98:ea:9b:df:1a:42:a2:f3:e3:0d"; -const char* mqtt_user = "mqtt"; -const char* mqtt_pass = "fische"; +const char* mqtt_fprint = "a3:44:1d:aa:6e:e5:c7:55:02:20:98:ea:9b:df:1a:42:a2:f3:e3:0d"; +const char* mqtt_user = "hjk"; +const char* mqtt_pass = "51fische#"; const unsigned long interval = TINTERVAL * 60000000LU; // Minuten * Mikrosekunden für Sleep Mode const unsigned long intervalLowBatt = TLOWBATT * 60000000LU; // Minuten * Mikrosekunden für Sleep Mode, Akku entladen @@ -80,7 +80,8 @@ void setup() { digitalWrite(BUILTIN_LED, HIGH); */ Serial.begin(74880); while ( !Serial ) delay(100); // wait for native usb - WiFi.mode( WIFI_OFF ); + //WiFi.mode( WIFI_OFF ); + WiFi.mode(WIFI_STA); WiFi.forceSleepBegin(); Serial.println(); @@ -292,7 +293,7 @@ void callback(char* topic1, byte* payload, unsigned int length) void reconnect() { // Loop until we're reconnected - sprintf(clientName, "%s%s", "ESP8266Wetter", sID); + sprintf(clientName, "%s%s", "WetterSensor", sID); while (!client.connected()) { Serial.print("Attempting MQTT connection..."); //verifyFingerprint();