// -- Zeit
#include <Wire.h> // Lib zur I2C-Kommunikation
#include <RTClib.h> // Lib für die Real Time Clock
#include <EEPROM.h> // Lib für das interne EEPROM
char daysOfTheWeek[7][12] = { "Sonntag", "Montag", "Dienstag", "Mittwoch", "Donnerstag", "Freitag", "Samstag" };
RTC_DS3231 RTC;
int Stunden, Minuten, Tag, Monat, Jahr; // Zeitvariablen für Taster
int Ein_Stunde, Ein_Minute; // Einschaltzeit
int Aus_Stunde, Aus_Minute; // Ausschaltzeit
int Ein_Tag; // Einschalttag für Legionellen
int Uhr_d, Uhr_h, Uhr_m, Uhr_s; // Variablen für Uhrzeit
int Datum_Tag, Datum_Monat, Datum_Jahr; // Variablen für Datum
int Datum_Tag_set, Datum_Monat_set, Datum_Jahr_set; // Variable Zeiteingabe Nextion
int Uhr_h_set, Uhr_m_set, Uhr_s_set;
int Sommer; // Sommerzeit true/false
// -- Nextion
String dfd = "";
String endChar = String(char(0xff)) + String(char(0xff)) + String(char(0xff));
byte nexend[3] = {255, 255, 255};
#include <SoftwareSerial.h>
SoftwareSerial nextion(3, 2); // RX, TX
// -- Temperatursensoren
#include <OneWire.h> // Lib für OneWire
#include <DallasTemperature.h> // Lib für DS18B20
#define ONE_WIRE_BUS 4 // Sensor an PIN (4)
OneWire oneWire(ONE_WIRE_BUS);
DallasTemperature sensors(&oneWire);
DeviceAddress Thermometer;
int deviceCount = 0;
// -- Ausgänge
#define nextion_power 12 // Power ein für Nexton an PIN 12 Relais K1
#define OUT_A 6 // Pumpe Speicherladung an PIN 6 Relais K7 auf K11
#define OUT_B 9 // Zuheizung elektro an PIN 9 Relais K4 auf K14
#define OUT_C 10 // Zuheizung Gas an PIN 10 Relais K3 auf K15
#define OUT_D 10 // 3 Wegeventil an PIN 10 Relais K3 auf K15
#define OUT_E 8 // Pumpe Speicherumladung an PIN 8 Relais K5 auf K13
const byte Z_P = 7; // Pumpe Zirkulation Brauchwasser an PIN 7 Relais K6 auf K12
#define T_P 5 // Pumpe Brauchwasserladung an PIN 5 Relais K8 auf K10
#define rest 13 // reset Nextion Button an PIN 13
// - int
// -- int button
int pagestate = 0;
int btn_state_T_P = 0;
int btn_state_Z_P = 0;
int btn_state_legio = 0;
int btn_state_hand_PLP = 0;
int btn_state_hand_BWLP = 0;
int btn_state_hand_ZPBW = 0;
int btn_state_hand_ZPSU = 0;
int btn_state_hand_WV = 0;
int last_status_zuheizung = EEPROM.read(17);
int last_status_legionellen = EEPROM.read(30);
int btn_state_zuheizung_gas = last_status_zuheizung;
int btn_state_zuheizung_aus = last_status_zuheizung;
int btn_state_zuheizung_elektro = last_status_zuheizung;
int zeit_stellen;
// -- millis
const unsigned long TIME_INTERVAL = 10000; // Zeit Zeitanzeige
unsigned long previousMillis;
const unsigned long TIME_INTERVAL2 = 8000; // Zeit Sensoren auslesen
unsigned long previousMillis2;
// -- int Temperatursensoren
int aussentemp; // Aussentemperatur
int H0_S; // Kesseltemperatur
int HDW_o; // Brauchwasserspeichertemperatur oben
int HDW_u; // Brauchwasserspeichertemperatur unten
int P1o_S; // Pufferspeicher 1 Temperatur oben
int P1m_S; // Pufferspeicher 1 Temperatur mitte
int P1u_S; // Pufferspeicher 1 Temperatur unten
int P2o_S; // Pufferspeicher 2 Temperatur oben
int P2m_S; // Pufferspeicher 2 Temperatur mitte
int P2u_S; // Pufferspeicher 2 Temperatur unten
int P3o_S; // Pufferspeicher 3 Temperatur oben
int P3m_S; // Pufferspeicher 3 Temperatur mitte
int P3u_S; // Pufferspeicher 3 Temperatur unten
// -- int Systemvariablen
int Puffermindesttemp;
int Pufferumladetemp;
int Ladepumpestarttemp;
int Ladepumpestoptemp;
int hyst_Ladepumpe;
int Kesselabkuehltemperatur;
int Kesseltempkorrektur;
int Puffertempkorrektur;
int WBW_Temp_max;
int WBW_Temp_min;
int Legionellentemp_min;
int hyst_WBW;
void Zirkulationspumpe() // -- Zeit Zirkulationspumpe
{
static uint32_t previousMillis3 = 0;
if (btn_state_Z_P == 0) {
btn_state_Z_P == 0;
previousMillis3 = millis();
}
if (millis() - previousMillis3 > (300 * 1000UL) && btn_state_Z_P == 1){ // (300 * 1000UL)
btn_state_Z_P = 0;
btn_state_hand_ZPBW = 0;
Serial.print("btn_state_Z_P ");
Serial.print(btn_state_Z_P);
Serial.println(" Zirkulationspumpe Brauchwasser aus");
}}
void NextionRefresh() // -- reset Nextion
{
if (!digitalRead(rest)) {
nextion.print("rest");
nextion.write(nexend, 3);
Serial.println("Nextion reset");
delay(1000);
pagestate = 0;
}
}
void setup() {
Serial.begin(19200);
nextion.begin(19200);
Wire.begin();
// -- RTC
RTC.begin(); // Uhr starten
//RTC.adjust(DateTime(F(__DATE__), F(__TIME__))); // Zeit vom PC einlesen, Wenn Uhrzeit neu gesetzt werden soll, sonst auskommentieren !!!
//RTC.adjust(DateTime(2023, 10, 8, 21, 21, 30));
if (! RTC.begin()) {
Serial.println("Couldn't find RTC");
Serial.flush();}
// -- EEPROM
// EEPROM.write(5, 40), EEPROM.write(6, 55), EEPROM.write(7, 65), EEPROM.write(8, 63), EEPROM.write(9, 2), EEPROM.write(10, 90), EEPROM.write(11, 1),EEPROM.write(12, 0), EEPROM.write(13, 60), EEPROM.write(14, 40), EEPROM.write(15, 70), EEPROM.write(16, 5);
Ein_Tag = EEPROM.read(0); // Einschalttag auslesen
Ein_Stunde = EEPROM.read(1); // Einschaltzeit Stunde einlesen
Ein_Minute = EEPROM.read(2); // Einschaltzeit Minute einlesen
Puffermindesttemp = EEPROM.read(5); // Pufferspeichermindesttemperatur 40°C
Pufferumladetemp = EEPROM.read(6); // Pufferspeicherumladungstemperatur 55°C
Ladepumpestarttemp = EEPROM.read(7); // Einschalttemperatur Speicherladepumpe 65 °C
Ladepumpestoptemp = EEPROM.read(8); // Ausschalttemperatur Speicherladepumpe 63°C
hyst_Ladepumpe = EEPROM.read(9); // Hysterese Pufferladepumpe 2 °
Kesselabkuehltemperatur = EEPROM.read(10); // Kesselabkuehltemperatur 90°C
Kesseltempkorrektur = EEPROM.read(11); // Temperaturkorrektur Sensor Kessel 1°C
Puffertempkorrektur = EEPROM.read(12); // Temperaturkorrektur Sensoren Pufferspeicher 0°C
WBW_Temp_max = EEPROM.read(13); // Brauchwassermaximaltemperatur 60°C
WBW_Temp_min = EEPROM.read(14); // Brauchwassermidensttemperatur 40°C
Legionellentemp_min = EEPROM.read(15); // Legionellentemperatur 70°C
hyst_WBW = EEPROM.read(16); // Hysterese Brauchwasser 5°C
last_status_zuheizung = EEPROM.read(17); // status Zuheizung - 1 elektro aktiviert - 2 Gas aktiviert - 3 keine aktiviert
last_status_legionellen = EEPROM.read(30); // status letzte Legionellenbehandlung - 1 wird ausgeführt - 2 abgeschlossen - 3 abgebrochen - 4 nicht bekannt
// -- Temperatursensoren im BUS lokalisieren
sensors.begin(); // Sensoren starten
Serial.println("Suche Sensoren...");
Serial.print("gefunden ");
deviceCount = sensors.getDeviceCount();
Serial.print(deviceCount, DEC);
Serial.println(" Sensoren.");
Serial.println("");
Serial.println("schreibe Adressen...");
for (int i = 0; i < deviceCount; i++)
{
Serial.print("Sensor ");
Serial.print(i+1);
Serial.print(" : ");
sensors.getAddress(Thermometer, i);
printAddress(Thermometer);}
// -- pinMode
pinMode(nextion_power, OUTPUT);
digitalWrite(nextion_power, HIGH);
pinMode(OUT_A, OUTPUT);
digitalWrite(OUT_A, LOW);
pinMode(OUT_B, OUTPUT);
digitalWrite(OUT_B, HIGH);
pinMode(OUT_C, OUTPUT);
digitalWrite(OUT_C, HIGH);
pinMode(OUT_D, OUTPUT);
digitalWrite(OUT_D, HIGH);
pinMode(OUT_E, OUTPUT);
digitalWrite(OUT_E, HIGH);
pinMode(T_P, OUTPUT);
digitalWrite(T_P, HIGH);
pinMode(Z_P, OUTPUT);
digitalWrite(Z_P, HIGH);
pinMode(rest, INPUT_PULLUP);
// -- Start Nextion und LOOP
tempssensoren();
delay(5000);
digitalWrite(OUT_A, HIGH);
delay(2000);
Serial.println("Start");
digitalWrite(nextion_power, LOW); // Nextion einschalten
delay(2000);
}
void loop() {
Zirkulationspumpe();
tempssensoren();
NextionRefresh();
Uhrzeit();
DateTime now = RTC.now();
Serial.print(now.year(), DEC);
Serial.print('/');
Serial.print(now.month(), DEC);
Serial.print('/');
Serial.print(now.day(), DEC);
Serial.print(" (");
Serial.print(daysOfTheWeek[now.dayOfTheWeek()]);
Serial.print(") ");
Serial.print(now.hour(), DEC);
Serial.print(':');
Serial.print(now.minute(), DEC);
Serial.print(':');
Serial.print(now.second(), DEC);
Serial.println();
// -- EEPROM einlesen
Ein_Tag = EEPROM.read(0); // Einschalttag auslesen
Ein_Stunde = EEPROM.read(1); // Einschaltzeit Stunde einlesen
Ein_Minute = EEPROM.read(2); // Einschaltzeit Minute einlesen
Puffermindesttemp = EEPROM.read(5); // Pufferspeichermindesttemperatur 40°C
Pufferumladetemp = EEPROM.read(6); // Pufferspeicherumladungstemperatur 55°C
Ladepumpestarttemp = EEPROM.read(7); // Einschalttemperatur Speicherladepumpe 68 °C
Ladepumpestoptemp = EEPROM.read(8); // Ausschalttemperatur Speicherladepumpe 65°C
hyst_Ladepumpe = EEPROM.read(9); // Hysterese Pufferladepumpe 2 °
Kesselabkuehltemperatur = EEPROM.read(10); // Kesselabkuehltemperatur 90°C
Kesseltempkorrektur = EEPROM.read(11); // Temperaturkorrektur Sensor Kessel 1°C
Puffertempkorrektur = EEPROM.read(12); // Temperaturkorrektur Sensoren Pufferspeicher 0°C
WBW_Temp_max = EEPROM.read(13); // Brauchwassermaximaltemperatur 60°C
WBW_Temp_min = EEPROM.read(14); // Brauchwassermidensttemperatur 40°C
Legionellentemp_min = EEPROM.read(15); // Legionellentemperatur 70°C
hyst_WBW = EEPROM.read(16); // Hysterese Brauchwasser 5°C
last_status_zuheizung = EEPROM.read(17); // status Zuheizung - 1 elektro aktiviert - 2 Gas aktiviert - 3 keine aktiviert
last_status_legionellen = EEPROM.read(30); // status letzte Legionellenbehandlung - 1 wird ausgeführt - 2 abgeschlossen - 3 abgebrochen - 4 konnte nicht gestartet werden
Serial.println("EEPROM eingelesen");
// -- Nextion Input
if (nextion.available() > 0){
dfd += char (nextion.read());}
if (dfd.endsWith(endChar)){
Serial.print(dfd);
Serial.println(" Fehler");
dfd = "";
}
// -- Nextion pagestate
if (dfd == "page 0"){
pagestate = 0;
previousMillis2 = millis();
nextion.print("page 0" + endChar);
Serial.print("pagestate ");
Serial.println(pagestate);
dfd = "";}
if (dfd == "page 1"){
pagestate = 1;
previousMillis2 = millis();
nextion.print("page 1" + endChar);
Serial.print("pagestate ");
Serial.println(pagestate);
dfd = "";}
if (dfd == "page 2"){
pagestate = 2;
previousMillis2 = millis();
nextion.print("page 2" + endChar);
Serial.print("pagestate ");
Serial.println(pagestate);
dfd = "";
DateTime now = RTC.now();
nextion.print("n0.val=");
nextion.print(now.day());
nextion.write(nexend, 3);
nextion.print("n1.val=");
nextion.print(now.month());
nextion.write(nexend, 3);
nextion.print("n2.val=");
nextion.print(now.year());
nextion.write(nexend, 3);
nextion.print("n3.val=");
nextion.print(now.hour());
nextion.write(nexend, 3);
nextion.print("n4.val=");
nextion.print(now.minute());
nextion.write(nexend, 3);
nextion.print("n5.val=");
nextion.print(now.second());
nextion.write(nexend, 3);
}
if (dfd == "page 3"){
pagestate = 3;
previousMillis2 = millis();
nextion.print("page 3" + endChar);
Serial.print("pagestate ");
Serial.println(pagestate);
dfd = "";}
if (dfd == "page 4"){
pagestate = 4;
previousMillis2 = millis();
nextion.print("page 4" + endChar);
Serial.print("pagestate ");
Serial.println(pagestate);
dfd = "";}
if (dfd == "page 5"){
pagestate = 5;
previousMillis2 = millis();
nextion.print("page 5" + endChar);
Serial.print("pagestate ");
Serial.println(pagestate);
dfd = "";}
if (dfd == "page 6"){
pagestate = 6;
previousMillis2 = millis();
nextion.print("page 6" + endChar);
Serial.print("pagestate ");
Serial.println(pagestate);
dfd = "";}
if (dfd == "page 7"){
pagestate = 7;
previousMillis2 = millis();
nextion.print("page 7" + endChar);
dfd = "";
Serial.print("pagestate ");
Serial.println(pagestate);
nextion.print("n0.val=");
nextion.print(EEPROM.read(5));
nextion.write(nexend, 3);
nextion.print("n1.val=");
nextion.print(EEPROM.read(6));
nextion.write(nexend, 3);
nextion.print("n2.val=");
nextion.print(EEPROM.read(7));
nextion.write(nexend, 3);
nextion.print("n3.val=");
nextion.print(EEPROM.read(8));
nextion.write(nexend, 3);
nextion.print("n4.val=");
nextion.print(EEPROM.read(9));
nextion.write(nexend, 3);
nextion.print("n5.val=");
nextion.print(EEPROM.read(10));
nextion.write(nexend, 3);
nextion.print("n6.val=");
nextion.print(EEPROM.read(11));
nextion.write(nexend, 3);
nextion.print("n7.val=");
nextion.print(EEPROM.read(12));
nextion.write(nexend, 3);
nextion.print("n8.val=");
nextion.print(EEPROM.read(13));
nextion.write(nexend, 3);
nextion.print("n9.val=");
nextion.print(EEPROM.read(14));
nextion.write(nexend, 3);
nextion.print("n10.val=");
nextion.print(EEPROM.read(15));
nextion.write(nexend, 3);
nextion.print("n11.val=");
nextion.print(EEPROM.read(16));
nextion.write(nexend, 3);
}
if (dfd == "page 8"){
pagestate = 8;
previousMillis2 = millis();
nextion.print("page 8" + endChar);
Serial.print("pagestate ");
Serial.println(pagestate);
dfd = "";
nextion.print("select0.val=");
nextion.print(EEPROM.read(0));
nextion.write(nexend, 3);
nextion.print("select1.val=");
nextion.print(EEPROM.read(1));
nextion.write(nexend, 3);
nextion.print("select2.val=");
nextion.print(EEPROM.read(2));
nextion.write(nexend, 3);
}
if (dfd == "page 9"){
pagestate = 9;
previousMillis2 = millis();
nextion.print("page 9" + endChar);
Serial.print("pagestate ");
Serial.println(pagestate);
dfd = "";}
// -- Nextion page update
// -- page 0 Hauptseite
if ((dfd == "") && (pagestate == 0)) {
//Serial.println("Seite 0 wird aktualisiert");
if ((P1m_S < Puffermindesttemp) && (millis()%(2000+2000)<2000)){
nextion.print("null.zerot18.txt=\"");
nextion.print("BITTE ANLEGEN");
nextion.write('"');
nextion.write(nexend, 3);
}
else if(P1m_S < Puffermindesttemp){
nextion.print("null.zerot18.txt=\"");
nextion.print(" ");
nextion.write('"');
nextion.write(nexend, 3);
}
if ((digitalRead(OUT_A) == 0) && (millis()%(1000+1000)<1000)){ // wenn Pufferspeicherladepumpe ein
nextion.print("null.zerot4.pco=2016" + endChar);}
else if (digitalRead(OUT_A) == 0){
nextion.print("null.zerot4.pco=0" + endChar);
}
if (digitalRead(OUT_A) == 1){ // wenn Pufferspeicherladepumpe aus
nextion.print("null.zerot4.pco=63488" + endChar);
}
if ((digitalRead(OUT_B) == 0) || (digitalRead(OUT_C) == 0)){
//nextion.print("null.zerot19.pco=1024" + endChar);
nextion.print("null.zerot19.txt=\"");
nextion.print("Zuheizung aktiv");
nextion.write('"');
nextion.write(nexend, 3);
}
if (((digitalRead(OUT_B) == 1) && (digitalRead(OUT_C) == 1)) && ((last_status_zuheizung == 1) || (last_status_zuheizung == 2))){
nextion.print("null.zerot19.pco=64512" + endChar);
nextion.print("null.zerot19.txt=\"");
nextion.print("Zuheizung bereit");
nextion.write('"');
nextion.write(nexend, 3);
}
if ((last_status_zuheizung == 0) && (millis()%(2000+2000)<2000)){
nextion.print("null.zerot19.pco=63488" + endChar);
nextion.print("null.zerot19.txt=\"");
nextion.print("ACHTUNG KEIN FROSTSCHUTZ");
nextion.write('"');
nextion.write(nexend, 3);
}
else if(last_status_zuheizung == 0){
nextion.print("null.zerot19.txt=\"");
nextion.print(" ");
nextion.write('"');
nextion.write(nexend, 3);
}
if (last_status_zuheizung == 1){
nextion.print("null.zerot17.txt=\"");
nextion.print("Zuheizung elektro ausgewaehlt");
nextion.write('"');
nextion.write(nexend, 3);
}
if (last_status_zuheizung == 2){
nextion.print("null.zerot17.txt=\"");
nextion.print("Zuheizung Gas ausgewaehlt");
nextion.write('"');
nextion.write(nexend, 3);
}
if (last_status_zuheizung == 0){
nextion.print("null.zerot17.txt=\"");
nextion.print("keine Zuheizung ausgewaehlt");
nextion.write('"');
nextion.write(nexend, 3);
}
if (digitalRead(OUT_C) == 0){
nextion.print("null.zerot38.pco=2016" + endChar);}
if (digitalRead(OUT_C) == 1){
nextion.print("null.zerot38.pco=63488" + endChar);}
if (digitalRead(OUT_D) == 0){
nextion.print("null.zerot7.pco=2016" + endChar);}
if (digitalRead(OUT_D) == 1){
nextion.print("null.zerot7.pco=63488" + endChar);}
if ((digitalRead(Z_P) == 0) && (millis()%(1000+1000)<1000)){
nextion.print("null.zerot6.pco=2016" + endChar);}
else if (digitalRead(Z_P) == 0){
nextion.print("null.zerot6.pco=0" + endChar);
}
if (digitalRead(Z_P) == 1){
nextion.print("null.zerot6.pco=63488" + endChar);}
if ((digitalRead(T_P) == 0) && (millis()%(1000+1000)<1000)){
nextion.print("null.zerot5.pco=2016" + endChar);}
else if (digitalRead(T_P) == 0){
nextion.print("null.zerot5.pco=0" + endChar);
}
if (digitalRead(T_P) == 1){
nextion.print("null.zerot5.pco=63488" + endChar);}
if ((digitalRead(OUT_E) == 0) && (millis()%(1000+1000)<1000)){
nextion.print("null.zerot14.pco=2016" + endChar);}
else if (digitalRead(OUT_E) == 0){
nextion.print("null.zerot14.pco=0" + endChar);
}
if (digitalRead(OUT_E) == 1){
nextion.print("null.zerot14.pco=63488" + endChar);}
// -- Temperaturanzeige
if ((aussentemp) < (-100)){
nextion.print("null.zerot11.txt=\"");
nextion.print("--");
nextion.write('"');
nextion.write(nexend, 3);}
else {
nextion.print("null.zerot11.txt=\"");
nextion.print(aussentemp);
nextion.write('"');
nextion.write(nexend, 3);}
if ((H0_S) < (-100)){
nextion.print("null.H0.txt=\"");
nextion.print("--");
nextion.write('"');
nextion.write(nexend, 3);}
else {
nextion.print("null.H0.txt=\"");
nextion.print(H0_S + Kesseltempkorrektur);
nextion.write('"');
nextion.write(nexend, 3);}
if ((HDW_o) < (-100)){
nextion.print("null.HDWo.txt=\"");
nextion.print("--");
nextion.write('"');
nextion.write(nexend, 3);}
else {
nextion.print("null.HDWo.txt=\"");
nextion.print(HDW_o);
nextion.write('"');
nextion.write(nexend, 3);}
if ((HDW_u) < (-100)){
nextion.print("null.HDWu.txt=\"");
nextion.print("--");
nextion.write('"');
nextion.write(nexend, 3);}
else {
nextion.print("null.HDWu.txt=\"");
nextion.print(HDW_u);
nextion.write('"');
nextion.write(nexend, 3);}
if ((P1o_S) < (-100)){
nextion.print("null.P1o.txt=\"");
nextion.print("--");
nextion.write('"');
nextion.write(nexend, 3);}
else {
nextion.print("null.P1o.txt=\"");
nextion.print(P1o_S);
nextion.write('"');
nextion.write(nexend, 3);}
if ((P1m_S) < (-100)){
nextion.print("null.P1m.txt=\"");
nextion.print("--");
nextion.write('"');
nextion.write(nexend, 3);}
else {
nextion.print("null.P1m.txt=\"");
nextion.print(P1m_S);
nextion.write('"');
nextion.write(nexend, 3);}
if ((P1u_S) < (-100)){
nextion.print("null.P1u.txt=\"");
nextion.print("--");
nextion.write('"');
nextion.write(nexend, 3);}
else {
nextion.print("null.P1u.txt=\"");
nextion.print(P1u_S);
nextion.write('"');
nextion.write(nexend, 3);}
if ((P2o_S) < (-100)){
nextion.print("null.P2o.txt=\"");
nextion.print("--");
nextion.write('"');
nextion.write(nexend, 3);}
else {
nextion.print("null.P2o.txt=\"");
nextion.print(P2o_S);
nextion.write('"');
nextion.write(nexend, 3);}
if ((P2m_S) < (-100)){
nextion.print("null.P2m.txt=\"");
nextion.print("--");
nextion.write('"');
nextion.write(nexend, 3);}
else {
nextion.print("null.P2m.txt=\"");
nextion.print(P2m_S);
nextion.write('"');
nextion.write(nexend, 3);}
if ((P2u_S) < (-100)){
nextion.print("null.P2u.txt=\"");
nextion.print("--");
nextion.write('"');
nextion.write(nexend, 3);}
else {
nextion.print("null.P2u.txt=\"");
nextion.print(P2u_S);
nextion.write('"');
nextion.write(nexend, 3);}
if ((P3o_S) < (-100)){
nextion.print("null.P3o.txt=\"");
nextion.print("--");
nextion.write('"');
nextion.write(nexend, 3);}
else {
nextion.print("null.P3o.txt=\"");
nextion.print(P3o_S);
nextion.write('"');
nextion.write(nexend, 3);}
if ((P3m_S) < (-100)){
nextion.print("null.P3m.txt=\"");
nextion.print("--");
nextion.write('"');
nextion.write(nexend, 3);}
else {
nextion.print("null.P3m.txt=\"");
nextion.print(P3m_S);
nextion.write('"');
nextion.write(nexend, 3);}
if ((P3u_S) < (-100)){
nextion.print("null.P3u.txt=\"");
nextion.print("--");
nextion.write('"');
nextion.write(nexend, 3);}
else {
nextion.print("null.P3u.txt=\"");
nextion.print(P3u_S);
nextion.write('"');
nextion.write(nexend, 3);}
if (millis() - previousMillis >= TIME_INTERVAL){
DateTime now = RTC.now();
nextion.print("null.zerot9.txt=\"");
nextion.print(daysOfTheWeek[now.dayOfTheWeek()]);
nextion.print(" ");
if (now.day() < 10){
nextion.print("0");}
nextion.print(now.day(), DEC);
nextion.print(".");
if (now.month() < 10) {
nextion.print("0");}
nextion.print(now.month(), DEC);
nextion.print(".");
nextion.print(now.year(), DEC);
nextion.write('"');
nextion.write(nexend, 3);
Uhr_h = int(now.hour()); // Stunden ermitteln
if (Sommer == false) { // bei Winterzeit
Uhr_h = int(now.hour() - 1);} // 1 Stunde addieren
Uhr_m = int(now.minute());
nextion.print("null.zerozeit.txt=\"");
if (Uhr_h < 10) {
nextion.print("0");}
nextion.print(Uhr_h); // Stunden anzeigen
nextion.print(":");
if (Uhr_m < 10) {
nextion.print("0");}
nextion.print(Uhr_m);
nextion.write('"');
nextion.write(nexend, 3);
previousMillis = millis();
Sommer = Sommerzeit();
}
}
// -- page 2 Uhrzeit
if (pagestate == 2){
//Serial.println("Seite 2 wird aktualisiert");
if (dfd.substring((dfd.length() - 1), dfd.length()) == "?"){
String command = dfd.substring(5, 9);
String value = dfd.substring(9, dfd.length() - 1);
Serial.println(command + " : " + value);
dfd = "";
if (command == "DATT") {
Datum_Tag_set = value.toInt();
//Serial.print("Tag: ");
Serial.print(Datum_Tag_set);
Serial.print(".");
dfd ="";
}
if (command == "DATM") {
Datum_Monat_set = value.toInt();
//Serial.print("Monat: ");
Serial.print(Datum_Monat_set);
Serial.print(".");
dfd ="";
}
if (command == "DATJ") {
Datum_Jahr_set = value.toInt();
//Serial.print("Jahr: ");
Serial.print(Datum_Jahr_set);
Serial.print(" - ");
dfd ="";
}
if (command == "ZEIS") {
Uhr_h_set = value.toInt();
//Serial.print("Stunde: ");
Serial.print(Uhr_h_set);
Serial.print(":");
dfd ="";
}
if (command == "ZEIM") {
Uhr_m_set = value.toInt();
//Serial.print("Stunde: ");
Serial.print(Uhr_m_set);
Serial.print(":");
dfd ="";
}
if (command == "ZEIX") {
Uhr_s_set = value.toInt();
//Serial.print("Sekunde: ");
Serial.println(Uhr_s_set);
dfd ="";
}
RTC.adjust(DateTime(Datum_Jahr_set, Datum_Monat_set, Datum_Tag_set, Uhr_h_set, Uhr_m_set, Uhr_s_set));
Serial.println("Uhrzeit eingestellt");
}
}
// -- page 3 Zuheizung
if (pagestate == 3){
//Serial.println("Seite 3 wird aktualisiert");
if (last_status_zuheizung == 1){
nextion.print("zuheizung.t3.txt=\"");
nextion.print("Zuheizung elektro ausgewaehlt");
nextion.write('"');
nextion.write(nexend, 3);
}
else {
nextion.print("zuheizung.t3.txt=\"");
nextion.print("Zuheizung elektro aktivieren");
nextion.write('"');
nextion.write(nexend, 3);
}
if (last_status_zuheizung == 2){
nextion.print("zuheizung.t1.txt=\"");
nextion.print("Zuheizung Gasherme ausgewaehlt");
nextion.write('"');
nextion.write(nexend, 3);
}
else {
nextion.print("zuheizung.t1.txt=\"");
nextion.print("Zuheizung Gastherme aktivieren");
nextion.write('"');
nextion.write(nexend, 3);
}
}
// -- page 4 Handbetrieb
if (pagestate == 4){
//Serial.println("Seite 4 wird aktualisiert");
if (btn_state_hand_PLP == 1){
nextion.print("hand.t0.pco=2016" + endChar);}
else {nextion.print("hand.t0.pco=63488" + endChar);}
if (btn_state_hand_BWLP == 1){
nextion.print("hand.t1.pco=2016" + endChar);}
else {nextion.print("hand.t1.pco=63488" + endChar);}
if ((btn_state_hand_ZPBW == 1) || (btn_state_Z_P == 1)){
nextion.print("hand.t2.pco=2016" + endChar);}
else {nextion.print("hand.t2.pco=63488" + endChar);}
if (btn_state_hand_ZPSU == 1){
nextion.print("hand.t3.pco=2016" + endChar);}
else {nextion.print("hand.t3.pco=63488" + endChar);}
if (btn_state_hand_WV == 1){
nextion.print("hand.t4.pco=2016" + endChar);}
else {nextion.print("hand.t4.pco=63488" + endChar);}
}
// -- page 5 Brauchwasser
if (pagestate == 5){
//Serial.println("Seite 5 wird aktualisiert");
if (btn_state_T_P == 1){ // wenn T_P aktiviert
nextion.print("warmwasser.t0.txt=\"");
nextion.print("Brauchwasserladung aktiviert");
nextion.write('"');
nextion.write(nexend, 3);}
else {
nextion.print("warmwasser.t0.txt=\"");
nextion.print("1 x manuelle Brauchwasserladung");
nextion.write('"');
nextion.write(nexend, 3);
}
if (btn_state_Z_P == 1){
nextion.print("warmwasser.t1.txt=\"");
nextion.print("Zirkulation aktiviert");
nextion.write('"');
nextion.write(nexend, 3);}
else {
nextion.print("warmwasser.t1.txt=\"");
nextion.print("Zirkulationspumpe 5 min. aktivieren");
nextion.write('"');
nextion.write(nexend, 3);
}
if (last_status_legionellen == 1){
nextion.print("warmwasser.t3.txt=\"");
nextion.print("Legionellenbehandlung wurde aktiviert");
nextion.write('"');
nextion.write(nexend, 3);}
if (last_status_legionellen == 2){
nextion.print("warmwasser.t3.txt=\"");
nextion.print("Legionellenbehandlung abgeschlossen");
nextion.write('"');
nextion.write(nexend, 3);}
if (last_status_legionellen == 3){
nextion.print("warmwasser.t3.txt=\"");
nextion.print("konnte nicht gestartet werden Puffertemp zu gering");
nextion.write('"');
nextion.write(nexend, 3);}
if (last_status_legionellen == 4){
nextion.print("warmwasser.t3.txt=\"");
nextion.print("Legionellenbehandlung abgebrochen");
nextion.write('"');
nextion.write(nexend, 3);}
}
// -- page 6 temps
if (pagestate == 6){
//Serial.println("Seite 6 wird aktualisiert");
nextion.print("temps.H1_S.txt=\"");
nextion.print(aussentemp);
nextion.write('"');
nextion.write(nexend, 3);
nextion.print("temps.H0_S.txt=\"");
nextion.print(H0_S);
nextion.write('"');
nextion.write(nexend, 3);
nextion.print("temps.HDW_o.txt=\"");
nextion.print(HDW_o);
nextion.write('"');
nextion.write(nexend, 3);
nextion.print("temps.HDW_u.txt=\"");
nextion.print(HDW_u);
nextion.write('"');
nextion.write(nexend, 3);
nextion.print("temps.P1o_S.txt=\"");
nextion.print(P1o_S);
nextion.write('"');
nextion.write(nexend, 3);
nextion.print("temps.P1m_S.txt=\"");
nextion.print(P1m_S);
nextion.write('"');
nextion.write(nexend, 3);
nextion.print("temps.P1u_S.txt=\"");
nextion.print(P1u_S);
nextion.write('"');
nextion.write(nexend, 3);
nextion.print("temps.P2o_S.txt=\"");
nextion.print(P2o_S);
nextion.write('"');
nextion.write(nexend, 3);
nextion.print("temps.P2m_S.txt=\"");
nextion.print(P2m_S);
nextion.write('"');
nextion.write(nexend, 3);
nextion.print("temps.P2u_S.txt=\"");
nextion.print(P2u_S);
nextion.write('"');
nextion.write(nexend, 3);
nextion.print("temps.P3o_S.txt=\"");
nextion.print(P3o_S);
nextion.write('"');
nextion.write(nexend, 3);
nextion.print("temps.P3m_S.txt=\"");
nextion.print(P3m_S);
nextion.write('"');
nextion.write(nexend, 3);
nextion.print("temps.P3u_S.txt=\"");
nextion.print(P3u_S);
nextion.write('"');
nextion.write(nexend, 3);
}
// -- page 7 systemwerte
if (pagestate == 7){
//Serial.println("Seite 7 wird aktualisiert");
if (dfd.substring((dfd.length() - 1), dfd.length()) == "?") {
String command = dfd.substring(5, 9);
String value = dfd.substring(9, dfd.length() - 1);
Serial.println(command + " : " + value);
dfd = "";
if (command == "TEMA") {
Puffermindesttemp = value.toInt();
Serial.print("Puffermindesttemp: ");
Serial.print(Puffermindesttemp);
EEPROM.update(5, Puffermindesttemp);
Serial.print(" - ");
Serial.println(EEPROM.read(5));
dfd = "";
}
if (command == "TEMB") {
Pufferumladetemp = value.toInt();
Serial.print("Pufferumladetemp: ");
Serial.print(Pufferumladetemp);
EEPROM.update(6, Pufferumladetemp);
Serial.print(" - ");
Serial.println(EEPROM.read(6));
dfd = "";
}
if (command == "TEMC") {
Ladepumpestarttemp = value.toInt();
Serial.print("Ladepumpestarttemp: ");
Serial.print(Ladepumpestarttemp);
EEPROM.update(7, Ladepumpestarttemp);
Serial.print(" - ");
Serial.println(EEPROM.read(7));
dfd = "";
}
if (command == "TEMD") {
Ladepumpestoptemp = value.toInt();
Serial.print("Ladepumpestoptemp: ");
Serial.println(Ladepumpestoptemp);
EEPROM.update(8, Ladepumpestoptemp);
Serial.print(" - ");
Serial.println(EEPROM.read(8));
dfd = "";
}
if (command == "TEME") {
hyst_Ladepumpe = value.toInt();
Serial.print("hyst_Ladepumpe: ");
Serial.println(hyst_Ladepumpe);
EEPROM.update(9, hyst_Ladepumpe);
Serial.print(" - ");
Serial.println(EEPROM.read(9));
dfd = "";
}
if (command == "TEMF") {
Kesselabkuehltemperatur = value.toInt();
Serial.print("Kesselabkuehltemperatur: ");
Serial.println(Kesselabkuehltemperatur);
EEPROM.update(10, Kesselabkuehltemperatur);
Serial.print(" - ");
Serial.println(EEPROM.read(10));
dfd = "";
}
if (command == "TEMG") {
Kesseltempkorrektur = value.toInt();
Serial.print("Kesseltempkorrektur: ");
Serial.println(Kesseltempkorrektur);
EEPROM.update(11, Kesseltempkorrektur);
Serial.print(" - ");
Serial.println(EEPROM.read(11));
dfd = "";
}
if (command == "TEMH") {
Puffertempkorrektur = value.toInt();
Serial.print("Puffertempkorrektur: ");
Serial.println(Puffertempkorrektur);
EEPROM.update(12, Puffertempkorrektur);
Serial.print(" - ");
Serial.println(EEPROM.read(12));
dfd = "";
}
if (command == "TEMI") {
WBW_Temp_max = value.toInt();
Serial.print("WBW_Temp_max: ");
Serial.println(WBW_Temp_max);
EEPROM.update(13, WBW_Temp_max);
Serial.print(" - ");
Serial.println(EEPROM.read(13));
dfd = "";
}
if (command == "TEMJ") {
WBW_Temp_min = value.toInt();
Serial.print("WBW_Temp_min: ");
Serial.println(WBW_Temp_min);
EEPROM.update(14, WBW_Temp_min);
Serial.print(" - ");
Serial.println(EEPROM.read(14));
dfd = "";
}
if (command == "TEMK") {
Legionellentemp_min = value.toInt();
Serial.print("Legionellentemp_min: ");
Serial.println(Legionellentemp_min);
EEPROM.update(15, Legionellentemp_min);
Serial.print(" - ");
Serial.println(EEPROM.read(15));
dfd = "";
}
if (command == "TEML") {
hyst_WBW = value.toInt();
Serial.print("hyst_WBW: ");
Serial.println(hyst_WBW);
EEPROM.update(16, hyst_WBW);
Serial.print(" - ");
Serial.println(EEPROM.read(16));
dfd = "";
}
}
}
// -- page 8 Legionellenbehandlung
if (pagestate == 8){
//Serial.println("Seite 8 wird aktualisiert");
if (dfd.substring((dfd.length() - 1), dfd.length()) == "?") {
String command = dfd.substring(5, 9);
String value = dfd.substring(9, dfd.length() - 1);
Serial.println(command + " : " + value);
dfd = "";
if (command == "LEGD") {
Ein_Tag = value.toInt();
Serial.print("Ein_Tag: ");
Serial.print(Ein_Tag);
EEPROM.update(0, Ein_Tag);
Serial.print(" - ");
Serial.println(EEPROM.read(0));
dfd = "";
}
if (command == "LEGS") {
Ein_Stunde = value.toInt();
Serial.print("Ein_Stunde: ");
Serial.print(Ein_Stunde);
EEPROM.update(1, Ein_Stunde);
Serial.print(" - ");
Serial.println(EEPROM.read(1));
dfd = "";
}
if (command == "LEGM") {
Ein_Minute = value.toInt();
Serial.print("Ein_Minute: ");
Serial.print(Ein_Minute);
EEPROM.update(2, Ein_Minute);
Serial.print(" - ");
Serial.println(EEPROM.read(2));
dfd = "";
}
}
}
// -- buttonstate
// -- Brauchwasserladung
if (dfd == "T_P"){
btn_state_T_P = 1;
Serial.print("btn_state_T_P ");
Serial.println(btn_state_T_P);
dfd="";}
// -- Zirkulationspumpe
if (dfd == "Z_P"){
btn_state_Z_P = 1;
btn_state_hand_ZPBW = 1;
Serial.print("btn_state_Z_P ");
Serial.print(btn_state_Z_P);
//Serial.println(" Zirkulationspumpe Brauchwasser ein");
dfd="";}
// -- hand Legio
if (dfd == "hand_legio"){
btn_state_legio = 1;
Serial.print("btn_state_legio ");
Serial.println(btn_state_legio);
dfd="";}
// -- hand Pufferladepumpe
if (dfd == "hand_PLP" && (!btn_state_hand_PLP)){
btn_state_hand_PLP = 1;
Serial.print("btn_state_hand_PLP ");
Serial.println(btn_state_hand_PLP);
dfd="";}
else if (dfd == "hand_PLP" && (btn_state_hand_PLP)){
btn_state_hand_PLP = 0;
Serial.print("btn_state_hand_PLP ");
Serial.println(btn_state_hand_PLP);
dfd="";}
// -- hand Brauchwasserladepumpe
if (dfd == "hand_BWLP" && (!btn_state_hand_BWLP)){
btn_state_hand_BWLP = 1;
Serial.print("btn_state_hand_BWLP ");
Serial.println(btn_state_hand_BWLP);
dfd="";}
else if (dfd == "hand_BWLP" && (btn_state_hand_BWLP)){
btn_state_hand_BWLP = 0;
Serial.print("btn_state_hand_BWLP ");
Serial.println(btn_state_hand_BWLP);
dfd="";}
// -- hand Zirkulationspumpe Brauchwasser
if (dfd == "hand_ZPBW" && (!btn_state_hand_ZPBW)){
btn_state_hand_ZPBW = 1;
Serial.print("btn_state_hand_ZPBW ");
Serial.println(btn_state_hand_ZPBW);
dfd="";}
else if (dfd == "hand_ZPBW" && (btn_state_hand_ZPBW)){
btn_state_hand_ZPBW = 0;
Serial.print("btn_state_hand_ZPBW ");
Serial.println(btn_state_hand_ZPBW);
dfd="";}
// -- hand Zirkulationspumpe Speicherumladung
if (dfd == "hand_ZPSU" && (!btn_state_hand_ZPSU)){
btn_state_hand_ZPSU = 1;
Serial.print("btn_state_hand_ZPSU ");
Serial.println(btn_state_hand_ZPSU);
dfd="";}
else if (dfd == "hand_ZPSU" && (btn_state_hand_ZPSU)){
btn_state_hand_ZPSU = 0;
Serial.print("btn_state_hand_ZPSU ");
Serial.println(btn_state_hand_ZPSU);
dfd="";}
// -- hand 3 Wegeventil
if (dfd == "hand_WV" && (!btn_state_hand_WV)){
btn_state_hand_WV = 1;
Serial.print("btn_state_hand_WV ");
Serial.println(btn_state_hand_WV);
dfd="";}
else if (dfd == "hand_WV" && (btn_state_hand_WV)){
btn_state_hand_WV = 0;
Serial.print("btn_state_hand_WV ");
Serial.println(btn_state_hand_WV);
dfd="";}
// -- Zuheizung
if (dfd == "zuheizung_gas"){
EEPROM.update(17, 2);
dfd="";}
// -- Zuheizung elektro
if (dfd == "zuheizung_elektro"){
EEPROM.update(17, 1);
dfd="";}
// -- Zuheizung aus
if (dfd == "zuheizung_aus"){
EEPROM.update(17, 0);
dfd="";}
// -- Relais ein/aus
// -- Pumpe Zirkulation Brauchwasser
if ((btn_state_Z_P == 1) || (btn_state_hand_ZPBW == 1)){
digitalWrite(Z_P, LOW);}
else {
digitalWrite(Z_P, HIGH);}
// -- Pumpe Brauchwasserladung
if ((((HDW_u <= WBW_Temp_min) && ((HDW_o + hyst_WBW) < P1o_S) && (HDW_o > HDW_u)) || (H0_S + Kesseltempkorrektur) >= Kesselabkuehltemperatur) || btn_state_T_P == 1 || btn_state_hand_BWLP == 1) {
digitalWrite(T_P, LOW);
//Serial.println("Brauchwasserladung ein");
}
if (((Uhr_d == Ein_Tag) && (Uhr_h == Ein_Stunde) && (Uhr_m == Ein_Minute)) && (P1o_S >= Legionellentemp_min)){
digitalWrite(T_P, LOW);
btn_state_legio = 1;
last_status_legionellen = 1;
EEPROM.update(30, 1);
Serial.println("Legionellenbehandlung ein");
}
if ((Uhr_d == Ein_Tag) && (Uhr_h == Ein_Stunde) && (Uhr_m == Ein_Minute) && (P1o_S < Legionellentemp_min)){
last_status_legionellen = 4;
btn_state_legio = 0;
EEPROM.update(30, 3);
Serial.println("Legionellenbehandlung konnte nicht gestartet werden - Puffertemperatur zu gering");
}
if ((((((HDW_o + hyst_WBW) > P1o_S) || (HDW_u >= WBW_Temp_max)) && (H0_S + Kesseltempkorrektur) < Kesselabkuehltemperatur) && btn_state_hand_BWLP == 0) && btn_state_legio == 0) {
digitalWrite(T_P, HIGH);
btn_state_T_P = 0;
// Serial.println("Brauchwasserladung aus");
}
if ((HDW_u >= Legionellentemp_min) && (btn_state_legio == 1)){
digitalWrite(T_P, HIGH);
EEPROM.update(30, 2);
Serial.println("Legionellenbehandlung abgeschlossen");
btn_state_legio = 0;
last_status_legionellen = 2;
}
if ((btn_state_legio == 1) && (HDW_u >= P1o_S)){
digitalWrite(T_P, HIGH);
btn_state_legio = 0;
last_status_legionellen = 3;
EEPROM.update(30, 4);
Serial.println("Legionellenbehandlung abgebrochen");
}
// -- Pumpe Pufferspeicherladung
if (((((H0_S + Kesseltempkorrektur) >= Ladepumpestarttemp) && ((H0_S + Kesseltempkorrektur) > ((P3u_S + Puffertempkorrektur) + hyst_Ladepumpe))) || ((H0_S + Kesseltempkorrektur) >= Kesselabkuehltemperatur)) || btn_state_hand_PLP == 1)
{
digitalWrite(OUT_A, LOW);
//Serial.println("Pufferladepumpe ein");
}
if (((H0_S + Kesseltempkorrektur) <= Ladepumpestoptemp) || ((H0_S + Kesseltempkorrektur) < ((P3u_S + Puffertempkorrektur) + hyst_Ladepumpe)))
if (btn_state_hand_PLP == 0){
digitalWrite(OUT_A, HIGH);
//Serial.println("Pufferladepumpe aus");
}
// -- Zuheizung Gas ein
if ((P1o_S < Puffermindesttemp) && ((H0_S + Kesseltempkorrektur) < Ladepumpestarttemp) && (last_status_zuheizung == 2)){
digitalWrite(OUT_C, LOW);
digitalWrite(OUT_D, LOW);
}
if (((H0_S + Kesseltempkorrektur) > Ladepumpestoptemp) || (last_status_zuheizung == 0) || (last_status_zuheizung == 1) || (P1o_S > Puffermindesttemp)) {
digitalWrite(OUT_C, HIGH);
digitalWrite(OUT_D, HIGH);
}
// -- Zuheizung elektro ein
if ((P1o_S < Puffermindesttemp) && ((H0_S + Kesseltempkorrektur) < Ladepumpestarttemp) && (last_status_zuheizung == 1)){
digitalWrite(OUT_B, LOW);
//Serial.println ("Zuheizung elektro ein");
}
if (((H0_S + Kesseltempkorrektur) > Ladepumpestoptemp) || (last_status_zuheizung == 0) || (last_status_zuheizung == 2) || (P1o_S > Puffermindesttemp)) {
digitalWrite(OUT_B, HIGH);
//Serial.println ("Zuheizung elektro aus");
}
// -- Pumpe Zirkulation Speicherumladung
if ((((P1o_S < Pufferumladetemp) && (P2o_S > P1o_S)) && (digitalRead(OUT_A) == 1)) || btn_state_hand_ZPSU == 1){
digitalWrite(OUT_E, LOW);
//Serial.println ("Pumpe Speicherumladung ein");
}
if (((P2o_S <= P1o_S) || (digitalRead(OUT_A) == 0)) && btn_state_hand_ZPSU == 0){
digitalWrite(OUT_E, HIGH);
//Serial.println ("Pumpe Speicherumladung aus");
}
// -- 3 Wegeventil
if ((digitalRead(OUT_C) == 0) || (btn_state_hand_WV == 1)){
digitalWrite(OUT_D, LOW);}
else{
digitalWrite(OUT_D, HIGH);
}
}
// -- Subrutine Sensoren abfragen
void printAddress(DeviceAddress deviceAddress){
for (uint8_t i = 0; i < 8; i++) {
Serial.print("0x");
if (deviceAddress[i] < 0x10) Serial.print("0");
Serial.print(deviceAddress[i], HEX);
if (i < 7) Serial.print(", ");}
Serial.println("");}
// -- Uhrzeit
void Uhrzeit() {
DateTime now = RTC.now(); // Datum und Zeit ermitteln
Uhr_d = int(now.dayOfTheWeek()); // Wochentag ermitteln
Uhr_h = int(now.hour()); // Stunden ermitteln
if (Sommer == true) { // bei Sommerzeit
Uhr_h = int(now.hour() + 1);} // 1 Stunde addieren
Uhr_m = int(now.minute()); // Minuten ermitteln
Uhr_s = int(now.second());} // Sekunden ermitteln
// ----------------------------------------- Subroutine Sommerzeit ermitteln -----------------------------------------------
boolean Sommerzeit() {
DateTime now = RTC.now();
if (now.month() < 3 || now.month() > 10) return false; // keine Sommerzeit Jan - Dez
if (now.month() > 3 && now.month() < 10) return true; // Sommerzeit Apr bis Sep
if (now.month() == 3 && now.day() < 25) return false; // keine Sommerzeit bis 25.März
if (now.month() == 10 && now.day() < 25) return true; // Sommerzeit bis 25.Okt.
if (now.month() == 3 && (now.hour() + 24 * now.day()) >= (1 + 24 * (31 - (5 * now.year() / 4 + 4) % 7)) || now.month() == 10 && (now.hour() + 24 * now.day()) < (1 + 24 * (31 - (5 * now.year() / 4 + 1) % 7)))
return true;
else
return false;} // Ende Sommerzeit
// -- Temperatursensoren
void tempssensoren() {
if (millis() - previousMillis2 >= TIME_INTERVAL2){
//Serial.println("Sensoren lesen");
DeviceAddress Sensor0 = { 0x28,0xFE,0xF2,0x81,0xE3,0x3A,0x3C,0xF8 }; // H0_S
DeviceAddress Sensor1 = { 0x28,0xA8,0x54,0x81,0xE3,0x64,0x3C,0x60 }; // HDW_o
DeviceAddress Sensor2 = { 0x28,0x12,0x0D,0x49,0xF6,0x72,0x3C,0xD2 }; // HDW_u
DeviceAddress Sensor3 = { 0x28,0x05,0x8E,0x81,0xE3,0x58,0x3C,0xF5 }; // P1o_S
DeviceAddress Sensor4 = { 0x28,0x20,0x58,0x49,0xF6,0xA1,0x3C,0x1B }; // P1m_S
DeviceAddress Sensor5 = { 0x28,0x83,0xCE,0x49,0xF6,0x08,0x3C,0x69 }; // P1u_S
DeviceAddress Sensor6 = { 0x28,0x9F,0xE6,0x48,0xF6,0x2C,0x3C,0xFC }; // P2o_S
DeviceAddress Sensor7 = { 0x28,0x9B,0xF8,0x49,0xF6,0x9B,0x3C,0x1D }; // P2m_S
DeviceAddress Sensor8 = { 0x28,0x90,0x1B,0x49,0xF6,0x35,0x3C,0x43 }; // P2u_S
DeviceAddress Sensor9 = { 0x28,0xCD,0x6E,0x81,0xE3,0x34,0x3C,0x06 }; // P3o_S
DeviceAddress Sensor10 = { 0x28,0xB2,0xC0,0x81,0xE3,0x89,0x3C,0xA0 }; // P3m_S
DeviceAddress Sensor11 = { 0x28,0x3A,0xBA,0x81,0xE3,0x71,0x3C,0xD4 }; // P3u_S
DeviceAddress Sensor12 = { 0x28,0x2B,0xB2,0x80,0xE3,0xE1,0x3C,0xCA }; // Aussentemp
sensors.requestTemperatures();
H0_S = sensors.getTempC(Sensor0);
//Serial.print(" H0_S: ");
//Serial.println(H0_S);
HDW_o = sensors.getTempC(Sensor1);
//Serial.print("HDW_o: ");
//Serial.println(HDW_o);
HDW_u = sensors.getTempC(Sensor2);
//Serial.print("HDW_u: ");
//Serial.println(HDW_u);
P1o_S = sensors.getTempC(Sensor3);
//Serial.print("P1o_S: ");
//Serial.println(P1o_S);
P1m_S = sensors.getTempC(Sensor4);
//Serial.print("P1m_S: ");
//Serial.println(P1m_S);
P1u_S = sensors.getTempC(Sensor5);
//Serial.print("P1u_S: ");
//Serial.println(P1u_S);
P2o_S = sensors.getTempC(Sensor6);
//Serial.print("P2o_S: ");
//Serial.println(P2o_S);
P2m_S = sensors.getTempC(Sensor7);
//Serial.print("P2m_S: ");
//Serial.println(P2m_S);
P2u_S = sensors.getTempC(Sensor8);
//Serial.print("P2u_S: ");
//Serial.println(P2u_S);
P3o_S = sensors.getTempC(Sensor9);
//Serial.print("P3o_S: ");
//Serial.println(P3o_S);
P3m_S = sensors.getTempC(Sensor10);
//Serial.print("P3m_S: ");
//Serial.println(P3m_S);
P3u_S = sensors.getTempC(Sensor11);
//Serial.print("P3u_S: ");
//Serial.println(P3u_S);
aussentemp = sensors.getTempC(Sensor12);
//Serial.print("aussentemp: ");
//Serial.println(aussentemp);
previousMillis2 = millis();}
}