2024-09-2500

Wohnzimmer Anzeige geändert
This commit is contained in:
hans-jurgen 2024-09-25 13:09:30 +02:00
parent 76b976dcd4
commit 0612154ebc
2 changed files with 35 additions and 7 deletions

View File

@ -13,14 +13,14 @@ platform = espressif32
board = nodemcu-32s board = nodemcu-32s
framework = arduino framework = arduino
monitor_speed = 115200 monitor_speed = 115200
monitor_port = COM3 monitor_port = /dev/ttyACM0
monitor_filters = time monitor_filters = time
upload_port = COM3 upload_port = /dev/ttyACM0
lib_deps = lib_deps =
knolleary/PubSubClient @ 2.8 knolleary/PubSubClient @ 2.8
adafruit/Adafruit GFX Library @ 1.11.3 adafruit/Adafruit GFX Library @ 1.11.3
2dom/PxMatrix LED MATRIX library @ 1.8.2 2dom/PxMatrix LED MATRIX library @ 1.8.2
adafruit/Adafruit BusIO @ 1.7.2 adafruit/Adafruit BusIO @ 1.16.1
build_flags = build_flags =
-DSCAN=32 -DSCAN=32
@ -40,6 +40,7 @@ build_flags = ${env.build_flags}
-Dmqtt_server=\"hjkmqtt.dedyn.io\" -Dmqtt_server=\"hjkmqtt.dedyn.io\"
-Dmqtt_port=61883 -Dmqtt_port=61883
-DINNEN=\"hjk/devices/TEMPWOHNZIM/telemetry/temperature\" -DINNEN=\"hjk/devices/TEMPWOHNZIM/telemetry/temperature\"
-DHUNIDITY=\"hjk/devices/TEMPWOHNZIM/telemetry/humidity\"
-DFLUR=\"hjk/devices/TEMPFLUR/telemetry/temperature\" -DFLUR=\"hjk/devices/TEMPFLUR/telemetry/temperature\"
-DCO2=\"hjk/devices/257923/telemetry/co2\" -DCO2=\"hjk/devices/257923/telemetry/co2\"
-DAKKU=\"hjk/devices/WETTERSTATION/telemetry/battery\" -DAKKU=\"hjk/devices/WETTERSTATION/telemetry/battery\"

View File

@ -126,6 +126,7 @@ int Pressure = 0;
float TempWohn = -99.90; float TempWohn = -99.90;
float TempFlur = -99.99; float TempFlur = -99.99;
float Luftfeuchtigkeit = 0.00; float Luftfeuchtigkeit = 0.00;
float LuftfeuchtigkeitWohnug = 0.00;
float Akku = -99.00; float Akku = -99.00;
int Helligkeit = 255; int Helligkeit = 255;
@ -149,6 +150,7 @@ const char* topic_Wetter = WETTER;
const char* topic_Pressure = LUFTDRUCK; const char* topic_Pressure = LUFTDRUCK;
const char* topic_Luftfeuchtigkeit = FEUCHTIGKEIT; const char* topic_Luftfeuchtigkeit = FEUCHTIGKEIT;
const char* topic_Helligkeit = HELLIGKEIT; const char* topic_Helligkeit = HELLIGKEIT;
const char* topic_Humidity = HUNIDITY;
#ifdef FLUR #ifdef FLUR
const char* topic_Flur = FLUR; const char* topic_Flur = FLUR;
#endif #endif
@ -291,6 +293,12 @@ void callback(char* topic1, byte* payload, unsigned int length) {
Serial.println(" %"); Serial.println(" %");
Luftfeuchtigkeit = atof(msg); Luftfeuchtigkeit = atof(msg);
} }
if(strcmp(topic1, topic_Humidity)== 0){
Serial.print("Luftfeuchtigkeit Wohnung: ");
Serial.print(msg);
Serial.println(" %");
LuftfeuchtigkeitWohnug = atof(msg);
}
if(strcmp(topic1, topic_Akku)== 0){ if(strcmp(topic1, topic_Akku)== 0){
Serial.print("Wetterstation Akku: "); Serial.print("Wetterstation Akku: ");
Serial.print(msg); Serial.print(msg);
@ -326,10 +334,9 @@ void reconnect() {
client.subscribe(topic_Flur); client.subscribe(topic_Flur);
#endif #endif
client.subscribe(topic_Luftfeuchtigkeit); client.subscribe(topic_Luftfeuchtigkeit);
client.subscribe(topic_Humidity);
client.subscribe(topic_Akku); client.subscribe(topic_Akku);
client.subscribe(topic_Helligkeit); client.subscribe(topic_Helligkeit);
//client.subscribe("hjk/devices/WETTERSTATIONBORIS/telemetry/#");
//client.subscribe("hjk/devices/MESSUNITTEMPBORIS/telemetry/#");
} else { } else {
Serial.print("failed, rc="); Serial.print("failed, rc=");
Serial.print(client.state()); Serial.print(client.state());
@ -460,6 +467,22 @@ void ZeigeWetter(double Wetter1, int yPos = 2, int xPos = 1)
display.print("C"); display.print("C");
} }
} }
void ZeigeFeuchtigkeit(double Wetter1, int yPos = 2, int xPos = 1)
{
if (xPos < 2) xPos = 2;
if (yPos < 0) yPos = 0;
if (Wetter1 > -99.9){
char szWetter[10];
//Serial.print("Aussentemperatur: "); Serial.println(Wetter1,3);
dtostrf(Wetter1, 4, 1, szWetter);
display.setCursor(xPos, yPos);
display.fillRect(xPos, yPos-2, 64-xPos, 8+2, (myBLACK));
display.setTextColor(myBLUE);
display.print(szWetter);
display.print(" %");
}
}
void Test() void Test()
{ {
display.setCursor(1, 40); display.setCursor(1, 40);
@ -740,7 +763,7 @@ void loop() {
ZeigeDatum(timeinfo, 1, 1); ZeigeDatum(timeinfo, 1, 1);
ZeigeZeit(timeinfo, TimeX, TimeY); ZeigeZeit(timeinfo, TimeX, TimeY);
//ZeigeZeit(timeinfo, 1,40); //ZeigeZeit(timeinfo, 1,40);
ZeigeCO(1,CoY); //ZeigeCO(1,CoY);
/* if ((timeinfo.tm_min % 10) == 0){ /* if ((timeinfo.tm_min % 10) == 0){
/* if (Covid19 != 0){ /* if (Covid19 != 0){
scroll_text(matrix_height-8,20,"Landkreis Heilbronn", 30,30,30, true); scroll_text(matrix_height-8,20,"Landkreis Heilbronn", 30,30,30, true);
@ -772,7 +795,11 @@ void loop() {
scroll_text2(matrix_height-24,20,"ich w\201nsche Euch allen ein", 128,128,0, true); scroll_text2(matrix_height-24,20,"ich w\201nsche Euch allen ein", 128,128,0, true);
scroll_text2(matrix_height-24,20,"Frohes neues Jahr 2022.", 128,255,0, true); */ scroll_text2(matrix_height-24,20,"Frohes neues Jahr 2022.", 128,255,0, true); */
ZeigeWetter(double(TempWohn), WetterY,WetterX); if (timeinfo.tm_min %2 != 0){
ZeigeWetter(double(TempWohn), WetterY,WetterX);
}else {
ZeigeFeuchtigkeit(double(LuftfeuchtigkeitWohnug), WetterY,WetterX);
}
//Serial.println("START"); //Serial.println("START");
if (Aussentemp > -99.9){ if (Aussentemp > -99.9){
char szWetter[10]; char szWetter[10];