2025-11-0701
This commit is contained in:
51
src/main.cpp
51
src/main.cpp
@@ -278,16 +278,6 @@ void callback(char* topic1, byte* payload, unsigned int length) {
|
|||||||
}
|
}
|
||||||
msg[length] = '\0';
|
msg[length] = '\0';
|
||||||
|
|
||||||
// CO2 Wert vom Sensor
|
|
||||||
/* if(strcmp(topic1, topic_Co2)== 0){
|
|
||||||
#ifdef DEBUG
|
|
||||||
Serial.print("Co2 Sensor: ");
|
|
||||||
Serial.print(msg);
|
|
||||||
Serial.println();
|
|
||||||
#endif
|
|
||||||
Co2 = atoi(msg);
|
|
||||||
} */
|
|
||||||
// Wetter Wert
|
|
||||||
if(strcmp(topic1, topic_Wetter)== 0){
|
if(strcmp(topic1, topic_Wetter)== 0){
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
Serial.print("Aussentemperatur: ");
|
Serial.print("Aussentemperatur: ");
|
||||||
@@ -296,6 +286,7 @@ void callback(char* topic1, byte* payload, unsigned int length) {
|
|||||||
#endif
|
#endif
|
||||||
Aussentemp = atof(msg);
|
Aussentemp = atof(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(strcmp(topic1, topic_Pressure)== 0){
|
if(strcmp(topic1, topic_Pressure)== 0){
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
Serial.print("Luftdruck: ");
|
Serial.print("Luftdruck: ");
|
||||||
@@ -304,6 +295,7 @@ void callback(char* topic1, byte* payload, unsigned int length) {
|
|||||||
#endif
|
#endif
|
||||||
Pressure = atoi(msg);
|
Pressure = atoi(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(strcmp(topic1, topic_Luftfeuchtigkeit)== 0){
|
if(strcmp(topic1, topic_Luftfeuchtigkeit)== 0){
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
Serial.print("Luftfeuchtigkeit: ");
|
Serial.print("Luftfeuchtigkeit: ");
|
||||||
@@ -312,39 +304,7 @@ void callback(char* topic1, byte* payload, unsigned int length) {
|
|||||||
#endif
|
#endif
|
||||||
Luftfeuchtigkeit = atof(msg);
|
Luftfeuchtigkeit = atof(msg);
|
||||||
}
|
}
|
||||||
/* if(strcmp(topic1, topic_Hell)== 0){
|
|
||||||
#ifdef DEBUG
|
|
||||||
Serial.print("Helligkeit: ");
|
|
||||||
Serial.print(msg);
|
|
||||||
Serial.println();
|
|
||||||
#endif
|
|
||||||
hell = atoi(msg);
|
|
||||||
|
|
||||||
}
|
|
||||||
if(strcmp(topic1, topic_Dunkel)== 0){
|
|
||||||
#ifdef DEBUG
|
|
||||||
Serial.print("Dunkel: ");
|
|
||||||
Serial.print(msg);
|
|
||||||
Serial.println();
|
|
||||||
#endif
|
|
||||||
dunkel = atoi(msg);
|
|
||||||
}
|
|
||||||
if(strcmp(topic1, topic_ZeitStart)== 0){
|
|
||||||
#ifdef DEBUG
|
|
||||||
Serial.print("ZeitStart: ");
|
|
||||||
Serial.print(msg);
|
|
||||||
Serial.println();
|
|
||||||
#endif
|
|
||||||
StartderAbdunklung = atoi(msg);
|
|
||||||
}
|
|
||||||
if(strcmp(topic1, topic_ZeitEnde)== 0){
|
|
||||||
#ifdef DEBUG
|
|
||||||
Serial.print("ZeitEnde: ");
|
|
||||||
Serial.print(msg);
|
|
||||||
Serial.println();
|
|
||||||
#endif
|
|
||||||
EndederAbdunklung = atoi(msg);
|
|
||||||
} */
|
|
||||||
if(strcmp(topic1, topic_Helligkeit)== 0){
|
if(strcmp(topic1, topic_Helligkeit)== 0){
|
||||||
Serial.print("Helligkeit: ");
|
Serial.print("Helligkeit: ");
|
||||||
Serial.print(msg);
|
Serial.print(msg);
|
||||||
@@ -354,7 +314,8 @@ void callback(char* topic1, byte* payload, unsigned int length) {
|
|||||||
if (Helligkeit < 0) Helligkeit = 0;
|
if (Helligkeit < 0) Helligkeit = 0;
|
||||||
display.setBrightness(Helligkeit);
|
display.setBrightness(Helligkeit);
|
||||||
}
|
}
|
||||||
if(strcmp(topic1, topic_Akku)== 0){
|
|
||||||
|
if(strcmp(topic1, topic_Akku)== 0){
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
Serial.print("AKKU: ");
|
Serial.print("AKKU: ");
|
||||||
Serial.print(msg);
|
Serial.print(msg);
|
||||||
@@ -367,10 +328,10 @@ void reconnect() {
|
|||||||
sprintf(clientName, "%s%s", "Uhr", "_Zentrale" );
|
sprintf(clientName, "%s%s", "Uhr", "_Zentrale" );
|
||||||
// Loop until we're reconnected
|
// Loop until we're reconnected
|
||||||
while (!client.connected()) {
|
while (!client.connected()) {
|
||||||
//Serial.print("Attempting MQTT connection...");
|
Serial.print("Attempting MQTT connection...");
|
||||||
if (client.connect(clientName)) {
|
if (client.connect(clientName)) {
|
||||||
/* MQTTStatus.setPic(3); */
|
/* MQTTStatus.setPic(3); */
|
||||||
//Serial.println("connected");
|
Serial.println("connected");
|
||||||
/* client.subscribe(topic_Co2); */
|
/* client.subscribe(topic_Co2); */
|
||||||
client.subscribe(topic_Covid);
|
client.subscribe(topic_Covid);
|
||||||
client.subscribe(topic_Wetter);
|
client.subscribe(topic_Wetter);
|
||||||
|
|||||||
Reference in New Issue
Block a user