pimoroni / enviro

MIT License
101 stars 79 forks source link

Set keepalive to 10s #86

Closed jctooley closed 1 year ago

jctooley commented 1 year ago

Fixes issue #84

jctooley commented 1 year ago

Reference to same error on the umqtt library

Maffsie commented 1 year ago

Confirmed, this fixes my Enviro Weather as well. Upgraded from the firmware it shipped with to 0.0.8, MQTT uploads broke. After an hour's digging I stumbled across this PR and, indeed, adding a keepalive parameter to connect() fixed it and all pending uploads completed.

nopuk commented 1 year ago

Confirmed, this fixes my Enviro Weather as well. Upgraded from the firmware it shipped with to 0.0.8, MQTT uploads broke. After an hour's digging I stumbled across this PR and, indeed, adding a keepalive parameter to connect() fixed it and all pending uploads completed.

@Maffsie I have an Eviro weather too, and experienced a similar issue, however my weather is unable to get past about 7-8hrs of uploads to mqtt - it just hangs with the log giving no new info, tap the poke button all back to normal for another 7 or 8 hours. Its maddening. Does yours works for days on end given battery? I am doing uplaods each 15min while testing it.

Maffsie commented 1 year ago

Confirmed, this fixes my Enviro Weather as well. Upgraded from the firmware it shipped with to 0.0.8, MQTT uploads broke. After an hour's digging I stumbled across this PR and, indeed, adding a keepalive parameter to connect() fixed it and all pending uploads completed.

@Maffsie I have an Eviro weather too, and experienced a similar issue, however my weather is unable to get past about 7-8hrs of uploads to mqtt - it just hangs with the log giving no new info, tap the poke button all back to normal for another 7 or 8 hours. Its maddening. Does yours works for days on end given battery? I am doing uplaods each 15min while testing it.

@nopuk Mine has been doing exactly the same, though it goes silent after about 6 hours. I'm doing uploads every 15m with data collection every 5m. I just assumed it's related to the RTC bug (I forget the bug number and I'm on my phone so can't look it up) and have been waiting for a fix on that.

Curiously, the 0.0.2 firmware worked fine, and I would just go back to that, but I switched the battery out for a LiIon battery and a LiPo Amigo, so I need the voltage reporting from 0.0.8 to know when to recharge it!

@helgibbons is this an example of the RTC wake-up issue, or should a new issue be opened for this?

helgibbons commented 1 year ago

@Maffsie - adding the keepalive parameter did seem to improve uptime for me, but my Weather is still crashing every day or so with mqtt. Feel free to open another issue or contribute to an existing one as appropriate - @lowfatcode is back next week so we should hopefully see some fixes soon :)

jctooley commented 1 year ago

Mine runs longer than 6 hours although I have to admit, the connection to WiFi is flaky as it doesn't get a connection every time. I currently log every 5 mins and upload every reading. I know this is power hungry but it is currently sat in my office where I can easily charge the battery.

nopuk commented 1 year ago

Perhaps a silly question to ask, but does anyone run their enviro weather in such a way that they don't have to worry about it giving up a few hours later. I kinda feel I purchased a product that doesn't do its one basic function. The pimoroni product page sells this.

On Wed 28 Sep 2022, 13:36 jctooley, @.***> wrote:

Mine runs longer than 6 hours although I have to admit, the connection to WiFi is flaky as it doesn't get a connection every time. I currently log every 5 mins and upload every reading. I know this is power hungry but it is currently sat in my office where I can easily charge the battery.

— Reply to this email directly, view it on GitHub https://github.com/pimoroni/enviro/pull/86#issuecomment-1260840089, or unsubscribe https://github.com/notifications/unsubscribe-auth/AKAERSTNL7VXICMJN6IM4J3WAQ3UDANCNFSM6AAAAAAQJZDCB4 . You are receiving this because you were mentioned.Message ID: @.***>

MrDrem commented 1 year ago

Perhaps a silly question to ask, but does anyone run their enviro weather in such a way that they don't have to worry about it giving up a few hours later. I kinda feel I purchased a product that doesn't do its one basic function. The pimoroni product page sells this.

The firmware is clearly in a alpha state (hence being 0.0.8) which I think should be a lot clearer on all of the new Enviro product pages.

That having been said, the biggest issue that I now have is the rain bucket recordings stopping the normal wake cycles (and a debate around what it should record). With the rain bucket disconnected, I'm currently happy with how I'm now getting things.

My experiences so far are that logging to io.adafruit.com is unreliable & I know that @helgibbons has had issues with the cloud influxDB too (see #79). Logging locally to the unit is fine, and logging to a self hosted influxDB instance is fine. I think that the common factor in both of those is that there are no limits on uploads. I've been logging readings every minute, and uploading them to my local influxDB instance for around 72 hours now, and had local logging going well for a few days prior to that.

temp Temperature graph from Grafana looking at my local influxDB instance.

ZodiusInfuser commented 1 year ago

Hi All. I've been writing a patch for enviro that fixes a lot of the issues, and one thing I noticed was that v0.0.2 had keepalive=60 set, which was removed in v0.0.8. I have reverted this change in patch but just wanted to check that 60 is a sensible number, since 10 is mentioned here. Thanks

MrDrem commented 1 year ago

Switching to 10 resolved the uploads failing issue, 60 may make it more stable. It was certainly better under 0.0.2, but I don't know if that was the difference.

Its certainly worth testing (maybe with a pair of devices, once set to 10 and one to 60). Easier for you than us :)

ZodiusInfuser commented 1 year ago

As of v0.0.9 the keepalive value is 60 seconds, so I will close this PR. If you feel it should be 10 seconds, please re-open it.