Sending data throught TCP, UDP or modbus

114 views
Skip to first unread message

DCS

unread,
Jun 30, 2016, 7:55:30 AM6/30/16
to weewx-user
Anyone tried to send recevied data from driver to other IP device via TCP or UDP commands or MODBUS?
Which core component has to be modified to do this?
Greetings.

mwall

unread,
Jun 30, 2016, 8:29:46 AM6/30/16
to weewx-user

you probably want a service, bound to either NEW_LOOP_PACKET (if you want the observations as soon as they come off the hardware) or NEW_ARCHIVE_RECORD (if you want the observations every archive interval).

for tcp/udp simply derive from the restful service base class.  implement one or two methods and you're done.  see any one of the uploaders on the weewx wiki for working examples.

for modbus, you could derive from restful then override all the tcp/ip-specific stuff.  that gets you the threading for free.  or just write your own equivalent of what the restful base class and associated thread do.

m

ISpace ISpace

unread,
Jul 28, 2016, 6:32:43 AM7/28/16
to weewx...@googlegroups.com
I'm not very into python programming....
I found NEW_LOOP_PACKET but seems working with all data within  an array 'packet'.
What I need is to get spare data (temp, wind, etc) before composing the packet...where file I have to look at?
Then I will use other python library to send the data via modbus tcp (pymodbus)...
Thank you.
David.

--
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/tNes7-H_xOE/unsubscribe.
To unsubscribe from this group and all its topics, send an email to weewx-user+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Andrew Milner

unread,
Jul 28, 2016, 6:46:24 AM7/28/16
to weewx-user
NEW_LOOP_PACKET is the data from the hardware - and depending on the hardware may be either for all the sensors or just some - different hardware works in different ways.  NEW_ARCHIVE_RECORD will be the average data values for all sensors received during the archive period (often 5 minutes).  The archive records will then be stored into he database (SQLite or MySQL) for use by the reporting engine.

What do you mean by 'spare data'?  perhaps NEW_ARCHIVE_RECORD contains the data you are looking for rather than NEW_LOOP_RECORD.
Reply all
Reply to author
Forward
0 new messages