Custom driver to LOOP packet connection

85 views
Skip to first unread message

Steven Sarns

unread,
Oct 7, 2022, 6:39:12 PM10/7/22
to weewx-user
Hello, I would not yet call myself a beginner Python programmer, but having fallen from the nest too many times to count – I am ready to fly! I have a question about code structure as it relates to Weewx and Python on the Raspberry Pi (3B+, PiOS). Here’s the setup; one outdoor unit sends frequent data packets (wind, rain), another (separate) outdoor unit sends infrequent packets (temperature, pressure, humidity, particle count), indoor Pi receives outdoor packets and acquires additional data (temperature, pressure). The data link is based on the nRF24L01+ which can hold two or three messages before losing anything.

My thinking is that I need to code a driver in Python that acquires the incoming data packets and assembles a new LOOP packet to send to Weewx upon receipt of data message from an outdoor unit. I have coded this block in as interrupt service routine. I understand the need to modify the weewx.engine.StdPrint service to agree with my data structure. What I do not understand is how to send this data as a LOOP packet to the weewx.engine.MyPrint service. Any helpful words or links would be appreciated. Thanks for your patience and assistance.

Tom Keffer

unread,
Oct 7, 2022, 7:34:35 PM10/7/22
to weewx...@googlegroups.com
I would suggest thinking of it in terms of multiplexing your 3 different data streams into one, which would then present to an instance of weewxd. There are several ways to do this. 

The traditional way is to pick one of the streams to be the main one and write a driver for it. The other two streams would then be interleaved by using custom WeeWX services. This would be "Configuration 4" in the wiki article Strategies for getting data into WeeWX. Usually this is done with only two streams, not three, but there's no reason not to do it

Another approach would be to write a single, more sophisticated, driver that interleaves the three streams internally. How you do this would depend on the interface to your data sources. For example, if they are all hardware, a select statement might be required. If it's through an HTTP interface, an internal HTTP client might do it.

Still another approach would be to think of your three streams as the basis of a new, custom weather station, with its own hardware. This could be implemented using an RPi, or some microcontroller. You would then write a pretty simple WeeWX driver to read from this hardware.

Other approaches are also possible.

Not sure where StdPrint comes in...

On Fri, Oct 7, 2022 at 3:39 PM Steven Sarns <steve...@gmail.com> wrote:
Hello, I would not yet call myself a beginner Python programmer, but having fallen from the nest too many times to count – I am ready to fly! I have a question about code structure as it relates to Weewx and Python on the Raspberry Pi (3B+, PiOS). Here’s the setup; one outdoor unit sends frequent data packets (wind, rain), another (separate) outdoor unit sends infrequent packets (temperature, pressure, humidity, particle count), indoor Pi receives outdoor packets and acquires additional data (temperature, pressure). The data link is based on the nRF24L01+ which can hold two or three messages before losing anything.

My thinking is that I need to code a driver in Python that acquires the incoming data packets and assembles a new LOOP packet to send to Weewx upon receipt of data message from an outdoor unit. I have coded this block in as interrupt service routine. I understand the need to modify the weewx.engine.StdPrint service to agree with my data structure. What I do not understand is how to send this data as a LOOP packet to the weewx.engine.MyPrint service. Any helpful words or links would be appreciated. Thanks for your patience and assistance.

--
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/da42eab7-240a-4c62-b899-578599be77a3n%40googlegroups.com.

Steven Sarns

unread,
Oct 7, 2022, 8:01:57 PM10/7/22
to weewx...@googlegroups.com
Thank you - working on it.... (probably be back)

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/AuDA44vIz1E/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/CAPq0zEDuwn5mXWt1TPURg7aFy3BfdC%3DGupRWD%3D%2B%2BjjaiaLpD8g%40mail.gmail.com.

Per martin Breistein

unread,
Oct 10, 2022, 6:22:00 PM10/10/22
to weewx-user
Hello.   I am searching for a simple way to get  loop packets into weewx.  (f.ex csv file format).  I am very impressed by the weewx system and the  documentation.
But I missing some understanding how  configure  the import of data.  My case is  cheap Cotech  weatherstations  FT-0203. The station with display can have a usb connection to a windows application. There is no documentation at all.  The app is using a windows access database  from 2007 (free license).  I have written a program  (c#) that reads from the base and write aggregated data to file (fileshare  to Raspberry pi). 

So what is the simple solution for this. I  am uncertain of using wee_import because there is a warning of crashing. The station is situated in mountain cottage which is unattended for months.
Can I use  a Simulator driver?     Or do I have to learn Python and modify some driver to do the task.

Thanks for any assistance. 

p q

unread,
Oct 10, 2022, 6:45:08 PM10/10/22
to weewx...@googlegroups.com
Maybe you can send the data over MQTT. There appears to be MQTT subscribe driver Weex. 



--
Peter Quinn
(415)794-2264
Reply all
Reply to author
Forward
0 new messages