WF PiConsole beta testing: UDP connection

Thanks for all the feedback everyone! I’m away on family holidays at the moment so won’t be able to fix anything, but do keep the bugs and suggestions in coming!

Ok, I’ll take a look at this. Are you referring to the “big” numbers showing the time and distance to the last strike? The “small” numbers showing the historical counts and frequency are updating?

I pondered about this a lot while setting up UDP mode. My reasoning for the current iteration with Websocket as default and an internet connection required to setup is that a WF station cannot be setup without the internet, the PiConsole cannot be installed without the internet, and the websocket provides “better” data, hence the defaults I choose seemed justified. Added to this, soooo many users get thoroughly confused between station IDs, device IDs and serial numbers that I thought removing the requirement for users to enter the serial number was probably a good thing.

That being said, I can see why in your case these choices are not optimal at all.

This I think is the solution, and getting your PR merged is my intention before the UDP functionality becomes stable. The user can then choose to install a blank .ini file as either a “demo” mode or as an “advanced” installation option that allows them to configure the .ini file manually in a way that suits their setup by may violate the usual requirements. I could also allow an advance mode that does no verification when the user is asked to enter information and allows fields to be skipped. I’ll give this some thought!

If REST is set to off, then this is expected behaviour. The PiConsole does no caching of data, so without the API it cannot calculate any trends or differences. This is something I could look at though.

That log file is busy!! It looks like some of your sensors were returning no data, and the API requests were failing for some reason (not sure why is REST services was set to off). Can you start again with a clean terminal and let me know what you see? It’ll be easier to pick out the errors.

This is probably the Sager forecast trying to hit the API. I realise I never added the API/no API checks to this module

Thanks - enjoy the holiday(s) !!!

One thing you might consider is permitting comments that persist in the .ini file - if you do that you could annotate the proposed example/demo .ini file and folks could understand that the differences between a TempestID for websockets vs. the TempestSN in the UDP messages (for one example).

One question though re: UDP only mode. How are you going to populate the panels for things that aren’t present in the UDP messages ? Examples would include things that accumulate (strike count/frequency, rain totals etc.). Would it be more appropriate to have them display N/A rather than - or 0 values ?

Re: the other questions from @davidk re: lightning, I tweaked my udp simulator to throw evt_strike messages occasionally and I ‘do’ see the display autoswitch to that panel when one comes in, so that’s working as expected here FWIW. I’m in UDP only mode with rest turned off if that matters, so my setup is a little more LAN-only than his.

The historical (small) numbers were updating, but not the “big” ones.

@peter

I’ve updated both of my Rpi PiConsole(s) to the Beta version. Both are operating without any issues. Thanks, for what appears to be never ending improvements.

I was courious if it would be possible to also update to the Beta version on my Windows 11, PC setups?

I had in the past just cloned the ‘wfpiconsole’ folder from one of my Pi installs, and that worked most of the time. It didn’t depending on whatever changes you made, perhaps to some of the Python or Kivy code or some such modifications.
I tried that cloning process without success … An suggestions? It would be nice to have a clean update routine on the Windows platform, but I understand that’s probably much easier said than done.

Thanks for all your efforts … I always look forward to your tweaks.

The cloning process should work, assuming you have changed the Hardware key to Other on the Windows machine. I can’t think of any other changes I have made that would stop it working. What error are you seeing?

As always - suggest providing the logfile and/or console output that indicates it did not succeed. We can’t read minds.

1 Like

The cloning process should work, assuming you have changed the Hardware key to Other on the Windows machine. I can’t think of any other changes I have made that would stop it working. What error are you seeing?

Thanks Peter …

as always you were spot on… It’s been quite awhile since I did a clone … I knew about the hardware key parameter, ‘Other’ that needed to be switched in the ini file. However, I forgot that I created specific wfpiconsole.ini files for each of my WF stations (one Tempest & one original Weatherflow). So on my desktop I have a icon to a batchfile that copies over the wfpiconsole.ini to correspond to the respective device’s unique IDs, etc…

image

So modified the root wfpiconsole.ini but it was written over immediately the first time I tried to launch!

All fixed now working like a charm…

Thanks again.

EDIT: I also noticed other parameters I didn’t expect that I also had to be sure were addressed with my 2 device setup that I have enabled.

Connection = UDP
rest_api = 1

[System]
Connection = UDP
rest_api = 1
SagerInterval = 6
Timeout = 20
Hardware = Other
Version = v23.5.beta
1 Like

Hi all, thanks for all the testing so far. I have just released some more functionality to the beta branch. This includes the ability to configure the PiConsole to run in UDP mode without requiring a network connection (of course the internet is still required to install the console), and you can also now install a blank/example config file for demonstration purposes or advanced configuration if you don’t want to use the wizard. It would be great to get this functionality tested before it is released to the main branch.

To get the latest changes, run wfpiconsole beta in a terminal and then delete (or rename) your existing wfpiconsole.ini file. That will prompted the console to start the configuration wizard the next time you run the console.

1 Like

Looks like it’s not quite there out of the box.

Installed via the curl | bash script, ran “wfpiconsole beta” to set it to beta. Then tried the first start. Transcripts below…

[INFO   ] [Logger      ] Record log in /home/pi/.kivy/logs/kivy_23-07-23_2.txt
[INFO   ] [Kivy        ] v2.1.0
[INFO   ] [Kivy        ] Installed at "/home/pi/.local/lib/python3.9/site-packages/kivy/__init__.py"
[INFO   ] [Python      ] v3.9.2 (default, Mar 12 2021, 04:06:34)
[GCC 10.2.1 20210110]
[INFO   ] [Python      ] Interpreter at "/usr/bin/python3"
[INFO   ] [Logger      ] Purge log fired. Processing...
[INFO   ] [Logger      ] Purge finished!

  ===================================================
  Starting wfpiconsole configuration wizard
  ===================================================

  Welcome to the WeatherFlow PiConsole. You will now
  be guided through the initial configuration

  Required fields are marked with an asterix (*)

  Would you like to install a minimal configuration file
  for demonstration purposes or advanced setup?* [y/n] (n) [INFO   ] [Factory     ] 189 symbols loaded
[INFO   ] [Image       ] Providers: img_tex, img_dds, img_sdl2, img_pil (img_ffpyplayer ignored)
[INFO   ] [Window      ] Provider: sdl2
[INFO   ] [GL          ] Using the "OpenGL ES 2" graphics system
[INFO   ] [GL          ] Backend used <sdl2>
[INFO   ] [GL          ] OpenGL version <b'2.1 Mesa 20.3.5'>
[INFO   ] [GL          ] OpenGL vendor <b'Broadcom'>
[INFO   ] [GL          ] OpenGL renderer <b'V3D 4.2'>
[INFO   ] [GL          ] OpenGL parsed version: 2, 1
[INFO   ] [GL          ] Shading version <b'1.20'>
[INFO   ] [GL          ] Texture max size <4096>
[INFO   ] [GL          ] Texture max units <16>
[INFO   ] [Window      ] auto add sdl2 input provider
[INFO   ] [Window      ] virtual keyboard not allowed, single mode, not docked
[INFO   ] [Text        ] Provider: sdl2(['text_pango'] ignored)
[INFO   ] [GL          ] NPOT texture support is available

  Sucesfully installed a minimal configuration file. Please edit
  this file manually to configure an advanced installation

 Traceback (most recent call last):
   File "/home/pi/wfpiconsole/main.py", line 552, in <module>
     wfpiconsole_app.run()
   File "/home/pi/.local/lib/python3.9/site-packages/kivy/app.py", line 954, in run
     self._run_prepare()
   File "/home/pi/.local/lib/python3.9/site-packages/kivy/app.py", line 924, in _run_prepare
     root = self.build()
   File "/home/pi/wfpiconsole/main.py", line 198, in build
     self.start_connection_service()
   File "/home/pi/wfpiconsole/main.py", line 407, in start_connection_service
     self.connection_thread.start()
 AttributeError: 'wfpiconsole' object has no attribute 'connection_thread'

Then on the next attempt to start…

[INFO   ] [Logger      ] Record log in /home/pi/.kivy/logs/kivy_23-07-23_3.txt
[INFO   ] [Kivy        ] v2.1.0
[INFO   ] [Kivy        ] Installed at "/home/pi/.local/lib/python3.9/site-packages/kivy/__init__.py"
[INFO   ] [Python      ] v3.9.2 (default, Mar 12 2021, 04:06:34)
[GCC 10.2.1 20210110]
[INFO   ] [Python      ] Interpreter at "/usr/bin/python3"
[INFO   ] [Logger      ] Purge log fired. Processing...
[INFO   ] [Logger      ] Purge finished!
 Traceback (most recent call last):
   File "/home/pi/wfpiconsole/main.py", line 35, in <module>
     configFile.update()
   File "/home/pi/wfpiconsole/lib/config.py", line 277, in update
     if int(current_config['System']['rest_api']):
 ValueError: invalid literal for int() with base 10: ''

I noticed rest_api = in the .ini and set it to 0, but the next attempt of starting again throws the connection thread error I got initially…

I manually edited the connection type to UDP and it ‘does’ start ok afterward, but I think the demo mode .ini file looks like it needs a little more work.

It would be really helpful if you’d do a quick readme file for how to start with a clean system to run the beta, as well as what the settings top+bottom of the file should be. What should they be to run clean in demo mode ? What should they be to run in UDP mode ? Assume we’re hand-editing the file rather than using the gui to do so (if the gui doesn’t start, that path is kinda not gonna work of course).

OK, everything should be fixed now. Fetch the fixes using wfpiconsole beta or a simple git pull. In demo mode, both Connection and rest_api in the .ini file should be blank. I will add some details to the README for how to configure the .ini file manually. But in a nutshell:

UDP only
Both the Weatherflow and CheckWX keys should be blank.
Connection = UDP
rest_api = 0

UDP + REST API
The Weatherflow and CheckWX keys should be specified.
Connection = UDP
rest_api = 1

Websocket
The Weatherflow and CheckWX keys should be specified.
Connection = Websocket
rest_api = 1

1 Like

Looks great. Thanks !!!

Likely nit bug…

In about line 176 of lib/derived_variables.py you need a try/except block or a little rethinking of your if/elif block.

In UDP-only mode with just a device SN specified, it blows up because you set height based on the (non-existent) ID for the device, so the subsequent elevation+height goes boom.

I hacked mine to add two more elif(s) ala:

    # Extract required configuration variables
    elevation = config['Station']['Elevation']
    if str(device) == config['Station']['OutAirID']:
        height = config['Station']['OutAirHeight']
    elif str(device) == config['Station']['TempestID']:
        height = config['Station']['TempestHeight']
    elif str(device) == config['Station']['OutAirSN']:
        height = config['Station']['OutAirHeight']
    elif str(device) == config['Station']['TempestSN']:
        height = config['Station']['TempestHeight']

But maybe you might set height=0 initially above there as a failsafe perhaps (?)

Yep, good spot, that’s a bug. I will get that fixed up and then if nothing else pops up I will push this all into a new release

Does this fix actually work for you? I am finding that device is completely empty at this point in the code because when only a device SN is specified in the config file, the code still tries to set the value of device to the device ID from the config file (which is empty).

Let me do a clean installation and get you diffs on the .ini file from what it installs vs. what I got to work.

Actually I found another way if it helps any…

Simply set the TempestID to any bogus value and the TempestHeight to 0 and it works with no code edits. This works vs. my wfudpsimulator which emits ST-00000001 as the tempest SN.

--- wfpiconsole.ini.1	2023-07-27 10:27:28.811863205 -0700
+++ wfpiconsole.ini	2023-07-27 10:25:11.861119381 -0700
@@ -4,15 +4,15 @@

 [Station]
 StationID =
-TempestID =
-TempestSN =
+TempestID = 12345
+TempestSN = ST-00000001
 SkyID =
 SkySN =
 OutAirID =
 OutAirSN =
 InAirID =
 InAirSN =
-TempestHeight =
+TempestHeight = 0
 SkyHeight =
 OutAirHeight =
 Latitude = 51.5072
@@ -68,8 +68,8 @@
 PanelSix = Lightning

 [System]
-Connection =
-rest_api =
+Connection = UDP
+rest_api = 0
 SagerInterval = 6
 Timeout = 20
 Hardware = Pi4