WeeWX UDP driver for WeatherFlow station

WeeWX builds a new Belchertown HTML file every 5 minutes.

That Belchertown file has Javascript code to connect to your MQTT server, to grab the 3-second updates and put them into the web page as they arrive (until the next 5-minute page build/reload).

The error you are receiving is from the Belchertown page, saying that it cannot contact MQTT for some reason.

Make sure that websockets is enabled on your MQTT server. Beyond that, check the Belchertown docs or post a question to the weewx-users group, as this is not a station driver issue…

so i did get it fixed…its really touchy…

my mqtt config … i didn’t use a password file…and I copy and pasted your example for the config for the mqtt.

by removing the line about location for the password file, then Blechertown was able to connect to the broker.

Thank you again for all your help!!! Now i’m going to try to fit it on a pi touch screen

1 Like

Belchertown has a “hidden” basic Pi screen-sized page if you add /pi/ to the end of the URL.

Personally, I would pick up an Amazon Fire 10" tablet when they are on sale for $99 and run the Fully Kiosk Browser on it (download file for Fire tablets on Fully’s web site). Yup, the wall-mounted color touchscreen console that everyone wants. The only thing that would make it better is access to the WF forecast API to replace the soon-to-be-deprecated DarkSky API…

This has literally nothing to do with the WF UDP driver and should be being asked on the weewx-users google group which is where the Belchertown author+users reside. Really.

If you look into the ‘hundreds’ of posts about the Belchertown skin and how to make it show the updated data in realtime in the weewx-users group, you’ll learn what you need to do.

2 Likes

Thanks! That did it. Now I can see the voltage.

thanks for the reply @vinceskahan. So the conversation did start with making sure that the WF UDP driver was just producing mqtt. (if you look back at the whole thread) @vreihen was helping me . I wasn’t intending on an off topic.

I didn’t realize I was offending anyone going a little deeper off topic. And the reason I kept the conversation going was an example was posted. I was commenting on the example help. I would think if other users come by (weatherflow users) they might cross this and have the same questions. The good news is we can share some knowledge here.

Feel free to PM anyone in the future if anyone have similar issues and a WeatherFlow user. I encourage the community to work together. I do appreciate everyone’s help.

Not offended at all. That said, more general weewx questions really should go to the weewx-users group which is where the weewx and skins authors for the dozens of similar skins and extensions are there to help support things. If you’d looked in the right place for your particular question, you’d have found the answers immediately, as what you asked has been asked and answered ‘many many many’ times there.

I am trying to get mine to do the same read out the battery data. but so far no luck. Also trying to get it to show the UV data. I see all of the png’s for it, and I see the pointers to them but the only thing I am getting is radiation. I am running latest code for the RPi4, it seems to work quite well otherwise, except that I cannot for the life of me get WeeWx to show time in 24 hour time. I had it doing just fine prior to upgrading to 4.x. But right now I just want to get the battery thing fixed and the UV data displayed.

You can email me at kp4djt@gmail.com

Getting the battery stuff to work requires editing the .tmpl template file for the skin(s) you are using. The defaults are hard-coded to the Davis 0/1 values where 0=ok. See the edits @ecommerce posted a couple days ago for which file to edit and what to put in there to get what you’re looking for.

(you’ll want to tweak his edits to set the format to N.NN accuracy rather than a zillion decimal points)

Here’s my sensor map from weewx.conf in case it helps. I get UV and Radiation just fine in the default Season’s skin. Substitute in your correct Tempest ID on all the lines of course.

[WeatherFlowUDP]
    driver = user.weatherflowudp
    log_raw_packets = False
    udp_address = <broadcast>
    udp_port = 50222
    udp_timeout = 90
    share_socket = True

    [[sensor_map]]
        outTemp = air_temperature.ST-00012767.obs_st
        outHumidity = relative_humidity.ST-00012767.obs_st
        pressure = station_pressure.ST-00012767.obs_st
        outTempBatteryStatus = battery.ST-00012767.obs_st
        windSpeed = wind_speed.ST-00012767.rapid_wind
        windDir = wind_direction.ST-00012767.rapid_wind
        UV = uv.ST-00012767.obs_st
        rain = rain_accumulated.ST-00012767.obs_st
        radiation = solar_radiation.ST-00012767.obs_st
1 Like

Here is my stanzas out of the .conf file. I left them all in there but just blocked the unused out with
octothorpes.

[WeatherFlowUDP]
driver = user.weatherflowudp
# log_raw_packets = True
udp_address =
# udp_address = 0.0.0.0
# udp_address = 255.255.255.255
udp_port = 50222
udp_timeout = 90
share_socket = False

[[sensor_map]]
    outTemp = air_temperature.ST-00001370.obs_st
    outHumidity = relative_humidity.ST-00001370.obs_st
    pressure = station_pressure.ST-00001370.obs_st
 #   lightning_strikes = lightning_strike_count.ST-00001370.obs_st
 #   avg_distance = lightning_strike_avg_distance.ST-00001370.obs_st
    outTempBatteryStatus = battery.ST-00001370.obs_st
    windSpeed = wind_speed.ST-00001370.rapid_wind
    windDir = wind_direction.ST-00001370.rapid_wind
  #  luxXXX = illuminance.ST-00001370.obs_st
    UV = uv.ST-00001370.obs_st
    rain = rain_accumulated.ST-00001370.obs_st
  #  windBatteryStatus = battery.ST-00001370.obs_st
    radiation = solar_radiation.ST-00001370.obs_st
    #lightningXXX = distance.ST-00001370.evt_strike
    #lightningYYY = energy.ST-00001370.evt_strike

    # The driver to use:
    driver = user.weatherflowudp

Sooner or later I would like to get the lightning on there. Have a couple of people who have asked me for it on my site.
I went to look for the .tmpl file and there is a boat load of them @ecommerce posted a snippet of the sensors.inc file, I have done that but I am not sure it is right. Here is the snippet of it.

# battery status, and various voltages. if there are no data available,

# then this degenerates to nothing displayed.

#def get_battery_status($x)
#if $x < 2.3
OK
#else
LOW
#end if
#end def

# first see what sensor data are available

When I remove the octothorpes from the section above it dumps stuff on the screen that should not be there. I am assuming that all between the #if $x < 2.3 to #end def should be uncommented, but when I do so it just messes up the page.
I have quite a few users who go to my site,
kp4djt.hopto.org:81
So I want to get it right before I do the switch over. The neat thing about the Tempest is the use of UDP, as someone said in another post, that was genius because it means I can drop a RPi anywhere on the same subnet and capture that data. I have a method in my madness. I see the Tempest as a way to get access to high places for amateur radio repeaters, co-locate the weather station with the repeater and I think the amateur radio community will see more access to those high places, and we get more WX data points. Thank you for the help and hope I can get this thing doing the way I want it. All I need is that batter condition and after that get the UV in there.

Works for me…

Here’s what I edited in sensors.inc on my system.


#def get_battery_status($x)
#if $x > 2.3
<span class="status_ok">OK - $current.outTempBatteryStatus.raw</span>
#else
<span class="status_low">LOW - $current.outTempBatteryStatus.raw</span>
#end if
#end def

Here’s what it displays for my Tempest…

Screen Shot 2020-07-25 at 12.25.19 PM

That took care of it, now I have the battery voltage reading correctly, thank you for the push there. Now to see why I am not seeing the UV, have to start digging and see what is going on. I see pointers, I see it is generating the png for UV, but it is not getting added to the screen.

Folks it is all working now. Next step is some clean up, But I have the UV now and one battery readout.
Again thank you all for the help.

1 Like

i’ve been getting some crashes recently that shuts down weewx.

Jul 27 07:59:39 weewx weewx[4992] INFO weewx.engine: Main loop exiting. Shutting engine down.

Jul 27 07:59:39 weewx weewx[4992] INFO weewx.engine: Shutting down StdReport thread
Jul 27 07:59:39 weewx weewx[4992] DEBUG weewx.engine: StdReport thread has been terminated
Jul 27 07:59:39 weewx weewx[4992] DEBUG weewx.restx: Shut down CWOP thread.
Jul 27 07:59:39 weewx weewx[4992] DEBUG weewx.restx: Shut down PWSWeather thread.
Jul 27 07:59:39 weewx weewx[4992] DEBUG weewx.restx: Shut down Wunderground-PWS thread.
Jul 27 07:59:39 weewx weewx[4992] DEBUG weewx.restx: Shut down StationRegistry thread.
Jul 27 07:59:39 weewx weewx[4992] CRITICAL main: Caught unrecoverable exception:
Jul 27 07:59:39 weewx weewx[4992] CRITICAL main: **** a bytes-like object is required, not ‘str’
Jul 27 07:59:39 weewx weewx[4992] CRITICAL main: **** Traceback (most recent call last):
Jul 27 07:59:39 weewx weewx[4992] CRITICAL main: **** File “/usr/share/weewx/user/weatherflowudp.py”, line 310, in genLoopPackets
Jul 27 07:59:39 weewx weewx[4992] CRITICAL main: **** m0 = str(m[0],‘utf-8’).replace(",null",",None") # Python 3
Jul 27 07:59:39 weewx weewx[4992] CRITICAL main: **** UnicodeDecodeError: ‘utf-8’ codec can’t decode byte 0xaa in position 2: invalid start byte
Jul 27 07:59:39 weewx weewx[4992] CRITICAL main: ****
Jul 27 07:59:39 weewx weewx[4992] CRITICAL main: **** During handling of the above exception, another exception occurred:
Jul 27 07:59:39 weewx weewx[4992] CRITICAL main: ****
Jul 27 07:59:39 weewx weewx[4992] CRITICAL main: **** Traceback (most recent call last):
Jul 27 07:59:39 weewx weewx[4992] CRITICAL main: **** File “/usr/share/weewx/weewxd”, line 154, in main
Jul 27 07:59:39 weewx weewx[4992] CRITICAL main: **** engine.run()
Jul 27 07:59:39 weewx weewx[4992] CRITICAL main: **** File “/usr/share/weewx/weewx/engine.py”, line 188, in run
Jul 27 07:59:39 weewx weewx[4992] CRITICAL main: **** for packet in self.console.genLoopPackets():
Jul 27 07:59:39 weewx weewx[4992] CRITICAL main: **** File “/usr/share/weewx/user/weatherflowudp.py”, line 312, in genLoopPackets
Jul 27 07:59:39 weewx weewx[4992] CRITICAL main: **** m0 = m[0].replace(",null",",None") # Python 2
Jul 27 07:59:39 weewx weewx[4992] CRITICAL main: **** TypeError: a bytes-like object is required, not ‘str’
Jul 27 07:59:39 weewx weewx[4992] CRITICAL main: **** Exiting.
Jul 27 08:09:44 weewx systemd[1]: Starting Message of the Day…
Jul 27 08:09:46 weewx 50-motd-news[6237]: * “If you’ve been waiting for the perfect Kubernetes dev solution for
Jul 27 08:09:46 weewx 50-motd-news[6237]: macOS, the wait is over. Learn how to install Microk8s on macOS.”
Jul 27 08:09:46 weewx 50-motd-news[6237]: https://www.techrepublic.com/article/how-to-install-microk8s-on-macos/
Jul 27 08:09:46 weewx systemd[1]: motd-news.service: Succeeded.
Jul 27 08:09:46 weewx systemd[1]: Finished Message of the Day.
Jamie Stephens’s profile photo
Jamie Stephens
Jul 27, 2020, 9:49:32 AM (yesterday)
to weewx...@googlegroups.com
[WeatherFlowUDP]
driver = user.weatherflowudp
log_raw_packets = False
udp_address =
# udp_address = 0.0.0.0
# udp_address = 255.255.255.255
udp_port = 50222
udp_timeout = 90
share_socket = False

[[sensor_map]]
    outTemp = air_temperature.ST-00015203.obs_st
    outHumidity = relative_humidity.ST-00015203.obs_st
    pressure = station_pressure.ST-00015203.obs_st
    #lightning_strikes =  lightning_strike_count.ST-00015203.obs_st
    #avg_distance =  lightning_strike_avg_distance.ST-00015203.obs_st
    outTempBatteryStatus = battery.ST-00015203.obs_st
    windSpeed = wind_speed.ST-00015203.rapid_wind
    windDir = wind_direction.ST-00015203.rapid_wind
    #luxXXX = illuminance.ST-00015203.obs_st
    UV = uv.ST-00015203.obs_st
    rain = rain_accumulated.ST-00015203.obs_st
    windBatteryStatus = battery.ST-00015203.obs_st
    radiation = solar_radiation.ST-00015203.obs_st
    #lightningXXX = distance.ST-00015203.evt_strike
    #lightningYYY = energy.ST-00015203.evt_strike

##############################################################################

Jul 28 08:20:26 weewx weewx[6505] DEBUG weewx.restx: CWOP: Connected to server cwop.aprs.net:14580
GNU nano 4.8 syslog Modified
Jul 28 17:58:23 weewx weewx[6505] CRITICAL main: **** File “/usr/share/weewx/user/weatherflowudp.py”, line 312, in genLoopPackets
Jul 28 17:58:23 weewx weewx[6505] CRITICAL main: **** m0 = m[0].replace(",null",",None") # Python 2
Jul 28 17:58:23 weewx weewx[6505] CRITICAL main: **** TypeError: a bytes-like object is required, not ‘str’
Jul 28 17:58:23 weewx weewx[6505] CRITICAL main: **** Exiting.

is it because i’m running python3 ?

pick which forum you’re posting in - use here or the weewx-users group please

I answered over there :slight_smile:

Sorry :slight_smile:

well in this case either place would be appropriate, just pick one. @vreihen is typically in multiple places simultaneously.

You can say that again…but weewx-users isn’t one of them. I skim it every month or so, but don’t actively follow it or participate.

Should I assume that this problem has been resolved???

I’m just going to start commenting out stuff until it stops Problem is it seems to happen about every 20-24 hours