matthias-bs / BresserWeatherSensorReceiver

Bresser 5-in-1/6-in-1/7-in-1 868 MHz Weather Sensor Radio Receiver for Arduino based on CC1101, SX1276/RFM95W or SX1262
MIT License
121 stars 23 forks source link

Rain values reset unwanted behaviour. #161

Closed Shadowpost closed 6 months ago

Shadowpost commented 7 months ago

My daily rain sensor has reset itself at 14:29 yesterday. My monthly rain sensor has not reset itself from april to may

I thought the Arduino code has a coupling to UTC to achieve just that?

Have I forgotten a step?

matthias-bs commented 7 months ago

Hi,

no, you actually found a bug.

You have probably set USE_WIFI. In this case, the RTC will not be set via SNTP. I forgot to change this after adding the rain statistics.

You can simply fix this in the *.ino file by moving the line #ifdef USE_SECUREWIFI (l. 602) at the begin of mqtt_setup() down after the line log_i("Current time (GMT): %s", asctime(&timeinfo)); (l. 624).

Best regards, Matthias

matthias-bs commented 7 months ago

Fixed in https://github.com/matthias-bs/BresserWeatherSensorReceiver/pull/162 / v0.27.3

Shadowpost commented 6 months ago

I have tested the revised sketches and the rain sensor resets at precisely 01:00. I did set the timezone in the sketch according the link.

I have tried to have the time printed with Serial.print, but I am not able to reverse engineer the sketch.

A workaround would be to add a helper in Home Assistant based on the total rain value, but that would only fix the issue for me.

matthias-bs commented 6 months ago

I don't quite understand where the difference between your expected behaviour and the actual behaviour is. The intended behaviour is described here: https://github.com/matthias-bs/BresserWeatherSensorReceiver/wiki/03.-Implementing-Rain-Gauge-Statistics.

If the reset time is one hour off, this could mean that summer time is not considered as desired.

By enabling debug messages (see https://github.com/matthias-bs/BresserWeatherSensorReceiver?tab=readme-ov-file#debug-output-configuration), you should also see date and time in the serial console after startup / wake-up. This is implemented in printDateTime().

matthias-bs commented 6 months ago

Closed due to inactivity.