Reading rain rate more frequently than the archive period

132 views
Skip to first unread message

Sylvain Gagnon

unread,
Apr 9, 2022, 1:23:39 AM4/9/22
to weewx-user
Hi, I've been using WeeWx for many years now but first time posting here.

I'm writing a program in Python that queries my Acurite 5 in 1 probe through WeeWX for the rain rate and if it's above 0mm, then it will close the car windows if they are opened and the car is parked. It works well but relies on daily.json to fetch the rain rate and that value I believe updates at the archive frequency (ie, 5 minutes) but the stations sends that data every 36 seconds. Is there a way to fetch this value? The only other option that I can think of is to set the "archive_interval" to 60 instead of 300 in [StdArchive]. If I do that, will that mess up all the historical data already in the database? Any other side effects?

Thanks for your help at keeping the inside of my car dry :-)

Graham Eddy

unread,
Apr 9, 2022, 2:31:03 AM4/9/22
to WeeWX User
your Acurite driver creates a ‘loop packet’ each time it receives a reading from the station. you can have a ’service’ immediately export selected data from each loop packet, not wait until the end of the archive interval (which is when database is updated). depending how you want the data exported, there could be an existing service extension available off-the-shelf

--
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 weewx-user+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/weewx-user/c90fb5b9-f691-4024-a00f-ab55a340fb04n%40googlegroups.com.

Doug Jenkins

unread,
Apr 9, 2022, 7:20:13 AM4/9/22
to weewx-user
have you considered MQTT? You could setup the MQTT WeeWX Extension in which it will push both LOOP and ARCHIVE records to a MQTT broker. I have an Acurite 5-n-1 weather station and use MQTT to update my website as the LOOP data changes. I get updates around every 18 seconds or so.

In your Python program, you use Paho Python library to "subscribe" to your MQTT host and invoke an event when you get a LOOP Record. From there evaluate the rain values and take action with your car windows at that moment based on the data.

MQTT is a small, lightweight protocol that will update in near real time. It is used a lot in IOT devices.


Graham Eddy

unread,
Apr 9, 2022, 7:53:44 AM4/9/22
to WeeWX User
mqtt is excellent if you have an existing mqtt interface (e.g. some home automation systems) or happy to program against mqtt API (which is callback-driven). if the need is more scripting-oriented then maybe something like https://github.com/chaunceygardiner/weewx-loopdata

(i’m a fan of mqtt and moved all my external sensors to mqtt for weewx integration.)

Sylvain Gagnon

unread,
Apr 9, 2022, 3:10:46 PM4/9/22
to weewx...@googlegroups.com
That's an excellent idea. I do have a MQTT tied to my HomeAssistant installation. I'll look into that. Thanks again for the idea. No more polling either :-)

You received this message because you are subscribed to a topic in the Google Groups "weewx-user" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/weewx-user/fMcZLc35yKs/unsubscribe.
To unsubscribe from this group and all its topics, send an email to weewx-user+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/weewx-user/1edcdb0a-4786-40f7-8506-a653275177a3n%40googlegroups.com.

Sylvain Gagnon

unread,
Apr 9, 2022, 3:50:46 PM4/9/22
to weewx-user
Must I do something special to push the LOOP records more frequently through MQTT? I've imported the Paho MQTT Python library and the loop record is being pushed at the ARCHIVE interval, which is also confirmed with MQTT Explorer. I've seen timestamp of 15:45:27, 15:40:10, 15:35:29 and 15:30:20 for the 'acurite/loop' topic. This is what I have in the weewx.conf file for MQTT

    [[MQTT]]
        server_url = mqtt://username:password@hostname:1883/
        topic = acurite
        unit_system = METRIC
        retain = true

Is there something missing?

Thanks for your help

storm...@gmail.com

unread,
Apr 9, 2022, 5:19:50 PM4/9/22
to weewx-user
Try adding the following:

[[MQTT]]
        server_url = mqtt://username:password@host:1883/
        topic = weather    #
        unit_system = US
        binding = archive, loop
        aggregation = aggregate
        log_success = false
        log_failure = true

Sylvain Gagnon

unread,
Apr 9, 2022, 5:42:02 PM4/9/22
to weewx-user
Yes! That did it! Where did you did the doc on this. I search for what parameters were available to the MQTT module and couldn't find anything!

storm...@gmail.com

unread,
Apr 9, 2022, 5:51:09 PM4/9/22
to weewx-user
Look in the beginning of the MQTT.py file for some configuration options.  
Reply all
Reply to author
Forward
0 new messages