leider bekomme ich immer 0 Tage bei allen Tonnen angezeigt - ich habe die loxone datei verwendet und dann die Daten manuell in dem Programmbaustein editiert.....irgendeine Idee warum es nicht funktioniert?
// Müllabfuhr für loxforum.com by Sebastian
//AI1: Minuten Aktualisierung
//AQ1: Stunden bis Restmüllabholung
//AQ2: Stunden bis Biomüllabholung
//AQ3: Stunden bis Altpapierabholung
//AQ4: Stunden bis Leichtstoffabholung
float sleeptime, now, rest[15], bio[30], papier[15], leicht[15], restleft, bioleft, papierleft, leichtleft;
int i, year, hour, minute;
year = 2016; //Jahr, für den der Müllkalender gilt
hour = 6; //Stunde, an der die Müllabfuhr üblicherweise kommt
minute = 0; //Minute, an der die Müllabfuhr üblicherweise kommt ;-)
while(TRUE)
{
sleeptime = 60*getinput(0); //Aktualisierungszeit in Sekunden
now = getcurrenttime(); //aktuelle Zeit in Sekunden (seit 01.01.2009 0:00)
//Daten der Restmüllabholung
rest[0] = gettimeval(year-1, 12, 17, hour, minute, 0, 1); //Letzter Abfuhrtermin des alten Jahres
rest[1] = gettimeval(year, 1, 14, hour, minute, 0, 1); //ab hier für das neue Jahr (Variable "year")
rest[2] = gettimeval(year, 2, 11, hour, minute, 0, 1);
rest[3] = gettimeval(year, 3, 10, hour, minute, 0, 1);
rest[4] = gettimeval(year, 4, 7, hour, minute, 0, 1);
rest[5] = gettimeval(year, 5, 6, hour, minute, 0, 1);
rest[6] = gettimeval(year, 6, 2, hour, minute, 0, 1);
rest[7] = gettimeval(year, 6, 30, hour, minute, 0, 1);
rest[8] = gettimeval(year, 7, 28, hour, minute, 0, 1);
rest[9] = gettimeval(year, 8, 25, hour, minute, 0, 1);
rest[10] = gettimeval(year, 9, 22, hour, minute, 0, 1);
rest[11] = gettimeval(year, 10, 20, hour, minute, 0, 1);
rest[12] = gettimeval(year, 11, 17, hour, minute, 0, 1);
rest[13] = gettimeval(year, 12, 15, hour, minute, 0, 1);
//Daten der Biomüllabholung
bio[0] = gettimeval(year-1, 12, 23, hour, minute, 0, 1); //Letzter Abfuhrtermin des alten Jahres
bio[1] = gettimeval(year, 1, 7, hour, minute, 0, 1); //ab hier für das neue Jahr (Variable "year")
bio[2] = gettimeval(year, 1, 21, hour, minute, 0, 1);
bio[3] = gettimeval(year, 2, 4, hour, minute, 0, 1);
bio[4] = gettimeval(year, 2, 18, hour, minute, 0, 1);
bio[5] = gettimeval(year, 3, 3, hour, minute, 0, 1);
bio[6] = gettimeval(year, 3, 17, hour, minute, 0, 1);
bio[7] = gettimeval(year, 4, 1, hour, minute, 0, 1);
bio[8] = gettimeval(year, 4, 14, hour, minute, 0, 1);
bio[9] = gettimeval(year, 4, 28, hour, minute, 0, 1);
bio[10] = gettimeval(year, 5, 12, hour, minute, 0, 1);
bio[11] = gettimeval(year, 5, 27, hour, minute, 0, 1);
bio[12] = gettimeval(year, 6, 9, hour, minute, 0, 1);
bio[13] = gettimeval(year, 6, 23, hour, minute, 0, 1);
bio[14] = gettimeval(year, 7, 7, hour, minute, 0, 1);
bio[15] = gettimeval(year, 7, 21, hour, minute, 0, 1);
bio[16] = gettimeval(year, 8, 4, hour, minute, 0, 1);
bio[17] = gettimeval(year, 8, 18, hour, minute, 0, 1);
bio[18] = gettimeval(year, 9, 1, hour, minute, 0, 1);
bio[19] = gettimeval(year, 9, 15, hour, minute, 0, 1);
bio[20] = gettimeval(year, 9, 29, hour, minute, 0, 1);
bio[21] = gettimeval(year, 10, 13, hour, minute, 0, 1);
bio[22] = gettimeval(year, 10, 27, hour, minute, 0, 1);
bio[23] = gettimeval(year, 11, 10, hour, minute, 0, 1);
bio[24] = gettimeval(year, 11, 24, hour, minute, 0, 1);
bio[25] = gettimeval(year, 12, 8, hour, minute, 0, 1);
bio[26] = gettimeval(year, 12, 22, hour, minute, 0, 1);
//Daten der Papiermüllabholung
papier[0] = gettimeval(year-1, 12, 31, hour, minute, 0, 1); //Letzter Abfuhrtermin des alten Jahres
papier[1] = gettimeval(year, 1, 28, hour, minute, 0, 1); //ab hier für das neue Jahr (Variable "year")
papier[2] = gettimeval(year, 2, 25, hour, minute, 0, 1);
papier[3] = gettimeval(year, 3, 23, hour, minute, 0, 1);
papier[4] = gettimeval(year, 4, 21, hour, minute, 0, 1);
papier[5] = gettimeval(year, 5, 20, hour, minute, 0, 1);
papier[6] = gettimeval(year, 6, 16, hour, minute, 0, 1);
papier[7] = gettimeval(year, 7, 14, hour, minute, 0, 1);
papier[8] = gettimeval(year, 8, 11, hour, minute, 0, 1);
papier[9] = gettimeval(year, 9, 8, hour, minute, 0, 1);
papier[10] = gettimeval(year, 10, 7, hour, minute, 0, 1);
papier[11] = gettimeval(year, 11, 4, hour, minute, 0, 1);
papier[12] = gettimeval(year, 12, 1, hour, minute, 0, 1);
papier[13] = gettimeval(year, 12, 30, hour, minute, 0, 1);
//Daten der Leichtstoffabholung
leicht[0] = gettimeval(year-1, 12, 30, hour, minute, 0, 1); //Letzter Abfuhrtermin des alten Jahres
leicht[1] = gettimeval(year, 1, 27, hour, minute, 0, 1); //ab hier für das neue Jahr (Variable "year")
leicht[2] = gettimeval(year, 2, 24, hour, minute, 0, 1);
leicht[3] = gettimeval(year, 3, 22, hour, minute, 0, 1);
leicht[4] = gettimeval(year, 4, 20, hour, minute, 0, 1);
leicht[5] = gettimeval(year, 5, 19, hour, minute, 0, 1);
leicht[6] = gettimeval(year, 6, 15, hour, minute, 0, 1);
leicht[7] = gettimeval(year, 7, 13, hour, minute, 0, 1);
leicht[8] = gettimeval(year, 8, 10, hour, minute, 0, 1);
leicht[9] = gettimeval(year, 9, 7, hour, minute, 0, 1);
leicht[10] = gettimeval(year, 10, 6, hour, minute, 0, 1);
leicht[11] = gettimeval(year, 11, 3, hour, minute, 0, 1);
leicht[12] = gettimeval(year, 11, 30, hour, minute, 0, 1);
leicht[13] = gettimeval(year, 12, 29, hour, minute, 0, 1);
//Schleife Restmüll
for(i=0; i<=13; i++) {
restleft = (rest[i]-now)/3600;
if(restleft >= 0) {
i = 13;
setoutput(0,restleft);
}
}
//Schleife Biomüll
for(i=0; i<=26; i++) {
bioleft = (bio[i]-now)/3600;
if(bioleft >= 0) {
setoutput(1,bioleft);
i = 26;
}
}
//Schleife Papiermüll
for(i=0; i<=13; i++) {
papierleft = (papier[i]-now)/3600;
if(papierleft >= 0) {
setoutput(2,papierleft);
i = 13;
}
}
//Schleife Leichtstoff
for(i=0; i<=13; i++) {
leichtleft = (leicht[i]-now)/3600;
if(leichtleft >= 0) {
setoutput(3,leichtleft);
i = 13;
}
}
sleeps(sleeptime) //Sleep-Wert in Sekunden, um die CPU zu schonen..
}
Kommentar