Hello Johnny, Unfortunately, the data is summed up every few minutes and the values no > longer fit. > For example, I have 0.15mm of rain in the last hour, then the value after > each loop adds up until the hour is over.
If I understand you correctly, your software emits the total rain measured so far in an hour, which then gets reset at the end of the hour. If that that is the case, then, no, that would not work well with weewx. In weewx, observation type 'rain' is the total amount of rain measured *for that packet*, and only for that packet. Typically, it is a very small number. This is explained in a little more detail in the section genLoopPackets <http://www.weewx.com/docs/customizing.htm#genLoopPackets> in the Customizing Guide. Or, maybe I am misunderstanding your problem. -tk On Mon, May 4, 2020 at 2:02 PM Johann Schneider <[email protected]> wrote: > Hello everybody! > I have a little problem. Sorry for my very bad english. I come from > Germany and my English is not the best. My experience with weewx is also > very limited. I built a weather station 3 years ago. It consists of an > Arduino Mega and several sensors. > Among other things, a rain sensor that reports 0.16mm of rain per seesaw > The values are pushed to iobroker (similar to openhab) every 15 seconds. > Here is an excerpt from my Arduino codes: > /* > Auswertung Regenmengensensor mit Regenwippe > - Counter kann durch reed-Kontakt oder Hallsensor erfolgen > - i2c eeprom AT24C256 > - i2c Adresse EEPROM (default: 0x50) > */ > #include <Wire.h> > //#include <I2C_EEPROM.h> > #//include <avr/eeprom.h> > /********************************************/ > /* PIN-Section */ > /* Hier Sensor-Pins definieren */ > /********************************************/ > //#define RAIN_COUNT_PIN 7 > #define RAIN_COUNT_PIN 30 > /********************************************/ > /* Variablen-Section */ > /********************************************/ > long lastSecond; // Original - The millis counter to see when a second > rolls by > unsigned int minutesSinceLastReset; //Used to reset variables after 24 > hours. Imp should tell us when it's midnight, this is backup. > byte secondsRain; //When it hits 60, increase the current minute > byte minutesRain; //Keeps track of where we are in various arrays of data > > volatile float rainHour[60]; //60 floating numbers to keep track of 60 > minutes of rain > volatile unsigned long raintime, rainlast, raininterval, rain; > volatile unsigned long last_micros1; > long debouncing_time1 = 3; // in millis -> eleminiert evtl > REED-Kontakt-Prellen > boolean RainTimeReset = false; > > //struct Configuration > //{ > // float regenTag; > // float regenStunde; > //}eepconfig EEMEM; > > //AT24C256<0x50> eep; // Das EEProm auf der china üblichen RTC3231 > > /********************************************/ > /* Interrupt-Section */ > /********************************************/ > void rainIRQ(unsigned long now){ > if((long)(micros() - last_micros1) >= debouncing_time1 * 1000) { > rainToday += 0.1618; // Each dump is 0.1618mm of water > rainHour[minutesRain] += 0.1618; // Increase this minute's amount of > rain > last_micros1 = micros(); > } > } > > /********************************************/ > /* Setup-Section */ > /********************************************/ > void setupRain(unsigned long now){ > Serial.begin(115200); > Wire.begin(); > #ifdef DEBUG_WS > Serial.println("rain gauge online!"); > #endif > // if(eep.ready()){ > // eep.get(eepconfig.regenTag,rainToday); > //#ifdef DEBUG_WS > // Serial.print("EEPROM rainToday : "); > // Serial.println(rainToday); > //#endif > // } > // else > // { > midnightReset(now); //Reset rain totals > secondsRain = 0; > lastSecond = now; > // } > rainLastHour = 0; > pinMode(RAIN_COUNT_PIN, INPUT_PULLUP); > attachInterrupt(RAIN_COUNT_PIN, rainIRQ, RISING); > > reportWeather(); > } > > /********************************************/ > /* Loop-Section */ > /********************************************/ > void loopRain(unsigned long now){ > //Keep track of which minute it is > if(now - lastSecond >= 1000) > { > lastSecond += 1000; > > reportWeather(); //Print the current readings. Takes 172ms. > > //If we roll over 60 seconds then update the arrays for rain > if(++secondsRain > 59) > { > secondsRain = 0; > > if(++minutesRain > 59) minutesRain = 0; > > rainHour[minutesRain] = 0; //Zero out this minute's rainfall amount > > minutesSinceLastReset++; //It's been another minute since last > night's midnight reset > } > } > > if((TimeStunde == 0) && (! RainTimeReset)) > { > midnightReset(now); //Reset a bunch of variables like rain and daily > total rain > RainTimeReset = true; > } > else if((TimeStunde != 0) && (RainTimeReset)) > { > RainTimeReset = false; > } > > //If we go for more than 24 hours without a midnight reset then force a > reset > //24 hours * 60 mins/hr = 1,440 minutes + 10 extra minutes. We hope that > Imp is doing it. > if(minutesSinceLastReset > (1440 + 10)) > { > midnightReset(now); //Reset a bunch of variables like rain and daily > total rain > } > } > > //When the imp tells us it's midnight, reset the total amount of rain and > gusts > void midnightReset(unsigned long now) > { > rainToday = 0; //Reset daily amount of rain > // if(eep.ready()){ > // eep.put(eepconfig.regenTag,rainToday); > // } > minutesRain = 0; //Reset minute tracker > secondsRain = 0; > lastSecond = now; //Reset variable used to track minutes > > minutesSinceLastReset = 0; //Zero out the backup midnight reset variable > } > > void calcWeather() > { > rainLastHour = 0; > for(int i = 0 ; i < 60 ; i++) > rainLastHour += rainHour[i]; > } > > > void reportWeather() > { > calcWeather(); //Go calc all the various sensors > #ifdef INFO_WS > Serial.print("rainLastHour : "); > Serial.print(rainLastHour, 2); > Serial.print(" , rainToday : "); > Serial.println(rainToday, 2); > #endif > // if(eep.ready()){ > // eep.put(eepconfig.regenStunde,rainLastHour); //Nicht nutzen > // eep.put(eepconfig.regenTag,rainToday); > // } > } > > > The rain data are given every 15 seconds. > I get the values for rain of the last hour and the total amount since > midnight. > Now I have tried to collect the data using fileparse. > Iobroker writes the data to a file every minute. > See example: > outTemp=43.8 > outHumidity=74.7 > pressure=29.896 > rain=0.00 > windSpeed=0.8 > > Fileparse evaluates the data and pushes it onto weewx. > Unfortunately, the data is summed up every few minutes and the values no > longer fit. > For example, I have 0.15mm of rain in the last hour, then the value after > each loop adds up until the hour is over. > /* > Auswertung Regenmengensensor mit Regenwippe > - Counter kann durch reed-Kontakt oder Hallsensor erfolgen > - i2c eeprom AT24C256 > - i2c Adresse EEPROM (default: 0x50) > */ > #include <Wire.h> > //#include <I2C_EEPROM.h> > #//include <avr/eeprom.h> > /********************************************/ > /* PIN-Section */ > /* Hier Sensor-Pins definieren */ > /********************************************/ > //#define RAIN_COUNT_PIN 7 > #define RAIN_COUNT_PIN 30 > /********************************************/ > /* Variablen-Section */ > /********************************************/ > long lastSecond; // Original - The millis counter to see when a second > rolls by > unsigned int minutesSinceLastReset; //Used to reset variables after 24 > hours. Imp should tell us when it's midnight, this is backup. > byte secondsRain; //When it hits 60, increase the current minute > byte minutesRain; //Keeps track of where we are in various arrays of data > > volatile float rainHour[60]; //60 floating numbers to keep track of 60 > minutes of rain > volatile unsigned long raintime, rainlast, raininterval, rain; > volatile unsigned long last_micros1; > long debouncing_time1 = 3; // in millis -> eleminiert evtl > REED-Kontakt-Prellen > boolean RainTimeReset = false; > > //struct Configuration > //{ > // float regenTag; > // float regenStunde; > //}eepconfig EEMEM; > > //AT24C256<0x50> eep; // Das EEProm auf der china üblichen RTC3231 > > /********************************************/ > /* Interrupt-Section */ > /********************************************/ > void rainIRQ(unsigned long now){ > if((long)(micros() - last_micros1) >= debouncing_time1 * 1000) { > rainToday += 0.1618; // Each dump is 0.1618mm of water > rainHour[minutesRain] += 0.1618; // Increase this minute's amount of > rain > last_micros1 = micros(); > } > } > > /********************************************/ > /* Setup-Section */ > /********************************************/ > void setupRain(unsigned long now){ > Serial.begin(115200); > Wire.begin(); > #ifdef DEBUG_WS > Serial.println("rain gauge online!"); > #endif > // if(eep.ready()){ > // eep.get(eepconfig.regenTag,rainToday); > //#ifdef DEBUG_WS > // Serial.print("EEPROM rainToday : "); > // Serial.println(rainToday); > //#endif > // } > // else > // { > midnightReset(now); //Reset rain totals > secondsRain = 0; > lastSecond = now; > // } > rainLastHour = 0; > pinMode(RAIN_COUNT_PIN, INPUT_PULLUP); > attachInterrupt(RAIN_COUNT_PIN, rainIRQ, RISING); > > reportWeather(); > } > > /********************************************/ > /* Loop-Section */ > /********************************************/ > void loopRain(unsigned long now){ > //Keep track of which minute it is > if(now - lastSecond >= 1000) > { > lastSecond += 1000; > > reportWeather(); //Print the current readings. Takes 172ms. > > //If we roll over 60 seconds then update the arrays for rain > if(++secondsRain > 59) > { > secondsRain = 0; > > if(++minutesRain > 59) minutesRain = 0; > > rainHour[minutesRain] = 0; //Zero out this minute's rainfall amount > > minutesSinceLastReset++; //It's been another minute since last > night's midnight reset > } > } > > if((TimeStunde == 0) && (! RainTimeReset)) > { > midnightReset(now); //Reset a bunch of variables like rain and daily > total rain > RainTimeReset = true; > } > else if((TimeStunde != 0) && (RainTimeReset)) > { > RainTimeReset = false; > } > > //If we go for more than 24 hours without a midnight reset then force a > reset > //24 hours * 60 mins/hr = 1,440 minutes + 10 extra minutes. We hope that > Imp is doing it. > if(minutesSinceLastReset > (1440 + 10)) > { > midnightReset(now); //Reset a bunch of variables like rain and daily > total rain > } > } > > //When the imp tells us it's midnight, reset the total amount of rain and > gusts > void midnightReset(unsigned long now) > { > rainToday = 0; //Reset daily amount of rain > // if(eep.ready()){ > // eep.put(eepconfig.regenTag,rainToday); > // } > minutesRain = 0; //Reset minute tracker > secondsRain = 0; > lastSecond = now; //Reset variable used to track minutes > > minutesSinceLastReset = 0; //Zero out the backup midnight reset variable > } > > void calcWeather() > { > rainLastHour = 0; > for(int i = 0 ; i < 60 ; i++) > rainLastHour += rainHour[i]; > } > > > void reportWeather() > { > calcWeather(); //Go calc all the various sensors > #ifdef INFO_WS > Serial.print("rainLastHour : "); > Serial.print(rainLastHour, 2); > Serial.print(" , rainToday : "); > Serial.println(rainToday, 2); > #endif > // if(eep.ready()){ > // eep.put(eepconfig.regenStunde,rainLastHour); //Nicht nutzen > // eep.put(eepconfig.regenTag,rainToday); > // } > } > > > Is there a solution? > > greeting > Johnnny > > -- > You received this message because you are subscribed to the Google Groups > "weewx-user" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/weewx-user/a9156731-4c86-4498-9546-0481365ff600%40googlegroups.com > <https://groups.google.com/d/msgid/weewx-user/a9156731-4c86-4498-9546-0481365ff600%40googlegroups.com?utm_medium=email&utm_source=footer> > . > -- You received this message because you are subscribed to the Google Groups "weewx-user" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/weewx-user/CAPq0zEASnBsOhS3pMcsP-h0u1G-T8eo9cTrOrvvE%2BU1Ngq5WCA%40mail.gmail.com.
