Python code to report (or MQTT publish) WeatherFlow UDP data

mqtt
udp

#21

yeah - I see it…gimme a minute to fix it…

(update)
@plains203 - change line 223 on the right where it says “time_epoch” to say “timestamp” and that’ll fix it…


#22

@vinceskahan looks to have fixed it thanks!

It also looks like the mqtt feature was working as expected as well.
Now to integrate this into my openhab setup.


#23

update - fixed --limit for events and status messages so they actually report when you want them. If you ever see bugs, please compare your copy with the lastest on github, just in case…


#24

update:

  • added --exclude option to easily skip certain observations/events (typically I ignore rapid_wind)
  • added --syslog option to syslog startup message and any unexpected JSON received by the listener
  • updated readme file to match

I’m currently running my host with the following options:

  • --exclude "rapid_wind" --mqtt --syslog

I’ll let it run for a few days and try to remember to bump the release git tag early next week.


#25

added docker-compose.yml and Dockerfile for building and running in a container for those who like containers…

also made the MQTT topic more easily configurable rather than hard-coding it


#26

This is just what I was looking for, thanks so much!!


#27

update - anybody using this should probably grab the latest version or patch your code with a one-line addition I made to have it not take the whole cpu.

  try:
    time.sleep(0.01)             # <=== add this line
    msg=s.recvfrom(1024)
    data=json.loads(msg[0])      # this is the JSON payload

If you patch your code, be sure to use ‘spaces’ and not ‘tabs’. Then just stop/restart your listener and you’ll see the cpu usage drop to basically zero, and the pi cpu temperature will drop a ‘lot’. My pi3plus dropped 9 degC afterward !


#28

Updated to version 2.0b1 if folks want to try a threaded version to not let the listener miss messages (rarely) while processing the data and outputting to the screen/syslog/mqtt/etc. Also updated the README to hopefully make it a little easier to wade through.

Same link as at the top of this thread, just be sure to pick the ‘threaded’ branch. I’m going to let it run here for a week or two before merging to master and calling it version 2.0, but it looks very stable and reliable in my testing on both a pi 3+ and a i3 Intel NUC.