WeatherFlow PiConsole - Archive

@pmendiuk and @peter

Is it me or you have 2 install on your pi ? and different kivy … look at lines 2 and 3 … different versions and different paths

[INFO   ] [Logger      ] Record log in /home/pi/.kivy/logs/kivy_22-05-23_68.txt
[INFO   ] [Kivy        ] v1.11.1
[INFO   ] [Kivy        ] Installed at "/home/pi/.local/lib/python3.7/site-packages/kivy/__init__.py"
[INFO   ] [Python      ] v3.7.3 (default, Jan 22 2021, 20:04:44

versus

[e[1;32mINFOe[0m   ] [Logger      ] Record log in /root/.kivy/logs/kivy_22-05-23_14.txt
[e[1;32mINFOe[0m   ] [Kivy        ] v2.0.0
[e[1;32mINFOe[0m   ] [Kivy        ] Installed at "/root/.local/lib/python3.7/site-packages/kivy/__init__.py"
[e[1;32mINFOe[0m   ] [Python      ] v3.7.3 (default, Jan 22 2021, 20:04:4

Good spot! What seems to be happening is wfpiconsole start is running as the root user, while wfpiconsole autostart-enable is running as the local Pi user. Now both should be running as the local Pi user, and the fact they are not suggests that a sudo may have been used at some point during the install process, which has installed everything onto the root path.

@pmendiuk, can you try to re-run the install script and make absolutely certain you do not add a sudo in front of the command (sudo will be asked for, but this will be handled correctly by the installer):

curl -sSL https://peted-davis.github.io/wfpiconsole | bash

Ok it finished running:

pi@wfpc1-ups-rpi-desk:~ $ curl -sSL https://peted-davis.github.io/wfpiconsole | bash

[✓] Root user check passed
[✓] Hardware check passed (armv7l)
[✓] OS check passed (Raspbian GNU/Linux 10 (buster))

================================
Installing WeatherFlow PiConsole

[✓] Checking for updated packages
[i] No updated packages found

[i] WeatherFlow PiConsole dependency checks…
[✓] Checking for git
[✓] Checking for curl
[✓] Checking for rng-tools
[✓] Checking for build-essential
[✓] Checking for python3-dev
[✓] Checking for python3-pip
[✓] Checking for python3-setuptools
[✓] Checking for libssl-dev
[✓] Checking for libffi-dev
[✓] Checking for libatlas-base-dev
[✓] Checking for jq

[i] Installing WeatherFlow PiConsole Python modules…
[✓] Updating Python package manager
[✓] Installing Python module cython
[✓] Installing Python module websockets
[✓] Installing Python module numpy
[✓] Installing Python module pytz
[✓] Installing Python module ephem
[✓] Installing Python module packaging
[✓] Installing Python module pyOpenSSL
[✓] Installing Python module certifi

[i] Kivy Python library dependency checks…
[✓] Checking for pkg-config
[✓] Checking for libgl1-mesa-dev
[✓] Checking for libgles2-mesa-dev
[✓] Checking for libgstreamer1.0-dev
[✓] Checking for gstreamer1.0-plugins-bad
[✓] Checking for gstreamer1.0-plugins-base
[✓] Checking for gstreamer1.0-plugins-good
[✓] Checking for gstreamer1.0-plugins-ugly
[✓] Checking for gstreamer1.0-omx
[✓] Checking for gstreamer1.0-alsa
[✓] Checking for libmtdev-dev
[✓] Checking for xclip
[✓] Checking for xsel
[✓] Checking for libjpeg-dev
[✓] Checking for libsdl2-dev
[✓] Checking for libsdl2-image-dev
[✓] Checking for libsdl2-mixer-dev
[✓] Checking for libsdl2-ttf-dev

[i] Kivy Python library installation check (will be updated)
[✓] Updating Kivy Python library
[✓] Updating Kivy configuration for touch screen

[i] Latest version of WeatherFlow PiConsole: v22.5.1
[i] Installed version of WeatherFlow PiConsole: v22.5.1
[✓] Versions match: No update required

Then I tried:
$ wfpiconsole autostart-enable
-bash: /usr/local/bin/wfpiconsole: Permission denied

OK, it looks like we might be making some progress - all the Python modules required by the console have now been installed for the local Pi user

Can you run these commands from the terminal:

sudo rm /usr/local/bin/wfpiconsole
chmod 744 ~/wfpiconsole/wfpiconsole.sh
sudo ln -sf ~/wfpiconsole/wfpiconsole.sh /usr/local/bin/wfpiconsole

and then try wfpiconsole autostart-enable again, please?

Here you go:

pi@wfpc1-ups-rpi-desk:~ $ sudo rm /usr/local/bin/wfpiconsole
pi@wfpc1-ups-rpi-desk:~ $ chmod 744 ~/wfpiconsole/wfpiconsole.sh
chmod: changing permissions of ‘/home/pi/wfpiconsole/wfpiconsole.sh’: Operation not permitted
pi@wfpc1-ups-rpi-desk:~ $ sudo chmod 744 ~/wfpiconsole/wfpiconsole.sh
pi@wfpc1-ups-rpi-desk:~ $ sudo ln -sf ~/wfpiconsole/wfpiconsole.sh /usr/local/bin/wfpiconsole
pi@wfpc1-ups-rpi-desk:~ $ wfpiconsole autostart-enable
-bash: /usr/local/bin/wfpiconsole: Permission denied
pi@wfpc1-ups-rpi-desk:~ $

OK, permissions on Linux are always a bit of a nightmare!

Can you try running

sudo chown -fR pi ~/wfpiconsole
sudo chgrp -fR pi ~/wfpiconsole

and then run these commands again

sudo rm /usr/local/bin/wfpiconsole
chmod 744 ~/wfpiconsole/wfpiconsole.sh
sudo ln -sf ~/wfpiconsole/wfpiconsole.sh /usr/local/bin/wfpiconsole

Thanks Peter!!! That did it.

Hi Peter,

First thanks for all of your work on this.

Hopefully a quick question. I had modified main.py in the previous release to call a new library that I use to display some parameters on an LED display. I waited for the new version V22 to stabilize and decided to update. I let it run constantly with the simple LED display but also occasionally turn on a connected monitor for a more detailed view. When I went in to make the same modifications I found that the new version is significantly changed. The line I put in main.py that no longer works was:

Clock.schedule_interval(partial(wfmatrixlib.dispMatrix,self.Obs),4.0)

I tried putting the following line in and I made some minor adjustments in my new library, but it causes a host of other errors for some reason that I cannot figure out.

Clock.schedule_invterval(wfmatrixlib.dispMatrix(self.Obs),4)

These are the errors that are thrown up and I’m having difficulty understanding why my edit would cause this. I put in some debug lines and my library gets called once before the error appears.

Traceback (most recent call last):
File “main.py”, line 531, in
wfpiconsole().run()
File “/home/pi/.local/lib/python3.7/site-packages/kivy/app.py”, line 949, in run
self._run_prepare()
File “/home/pi/.local/lib/python3.7/site-packages/kivy/app.py”, line 919, in _run_prepare
root = self.build()
File “main.py”, line 201, in build
self.screenManager.add_widget(CurrentConditions())
File “main.py”, line 453, in init
self.app.Sched.dispMatrix = Clock.schedule_interval(wfmatrixlib.dispMatrix(self.Obs),1) #DANNO
File “kivy/_clock.pyx”, line 504, in kivy._clock.CyClockBase.schedule_interval
File “kivy/_clock.pyx”, line 521, in kivy._clock.CyClockBase.schedule_interval
ValueError: callback must be a callable, got 0

My main.py line numbers are a little off from the released version because of lines I added. Can you point me to another library call that I can use as an example. I would call myself a beginner with Python but I have some programming experience with other languages.

Thank you.

Dan

Hi Dan,

Sorry I managed to break your modifications! There were a lot of changes between v4 and v22.

I think this should be quite simple to fix though. In the Clock.schedule_interval function you need to pass a handle to a function that can be called at the specified interval. This is made more complex in your case because you also want to pass an argument (self.Obs) to that function. In your second attempt

you have removed partial() and this is causing trouble because you are no longer passing a function handle to the Clock function, but rather the output of that function (remember the () at the end of a function tells Python to evaluate it with the specified arguments). Hence the error:

It is basically saying I can’t call this function again after the specified interval, because you haven’t passed me a function handle.

So the correct way to handle this is to use partial(), which allows you to pass both a function handle (i.e. the function name without the final () ), and the function arguments to the Clock function. I rather unhelpfully removed partial from the import statements, however, between v4 and v22 as my code no longer needs it, and I imagine this is why your first version is now no longer working.

To fix this simply add

from functools import partial

to the rest of the import statements at the top of main.py and then revert to using

Hopefully that should get you back up and running

Thank you Peter. Back up and running now. I do ok with plain vanilla Python but add some complexity or libraries I’ve never seen and it trips me up. Clock.schedule_interval at the partial function were all new to me so I didn’t quite know what to do. That adjustment and some minor variable name changes and everything is running fine again.

Dan

1 Like

@peter Well. . .it started to appear again. Actually started 2 days ago. . .but didn’t have a chance to snap-shot it until now 26/0445 UTC.

When switching between Stations / Devices . . .then going back to the original. . .it shows the Red " ! " mark next to the year. . .and the “Error” for station status. . .just like my post approximately 26 threads up from here. It goes back to normal when I Exit then do pi@wfpiconsole~$ wfpiconsole start.

To me. . .this is Not particularly alarming and I Can Live with this . . .because the “fix action” is so easy . . .just doing a warm restart so that it will grab the station I have listed in the ini file (“Bellevue Tempest° – Backyard”). The " ! " and the “Error” doesn’t affect the quality of the data that I see displayed on the screens. Unlike most other Tempest users. . .I maintain one original WeatherFlow SWS (+ 2 extra WFAIR-01 devices) and three Tempest stations. I only need to switch between the stations / devices when there is rain so that I can record the "wfpiconsole’ amount of rain at each station and compare that to the WF/Tempest Apps. . .the Davis VantageVue and the “STRATUS” USWB-type rain gauge. Otherwise. . .I don’t switch off of the “Bellevue Tempest° – Backyard” station since I consider it the main one.

I’m including a snapshot I took of the last few lines of the log before I restarted it. Again. . .this is just an FYI for you; it does not bother me (unless something really more serious were to develop.)

I double-checked all of my Data (API) Authorizations – Personal Use Tokens. . .and they are all intact and correct. I’m still not highly comfortable working with coding. . .so if I don’t have to have too much involvement with that. . .then I’ll be okay.

Thanks for the report. It sounds a bit odd and I’m happy to have a look into it. Hopefully it’ll be a simple fix! Do you mind sending me a private message with the contents of your .ini file. That will help me recreate the issue. Thanks!

Just want to say I love the Rain Rate feature on this console.

1 Like

I’ve just installed this on a Windows 10 PC per the instructions, but there are dashed lines in place of all the station data.

It correctly shows my station name, number, lat, lon, etc., just no weather data.

Oops, I’ve let those instructions get out of date. Try running

python -m pip install websockets

Then try and start the console again. Do you see your weather data?

Thanks Peter, that did the trick!

Previously, there had been an error message about not finding a module named “Websockets”.

Do you know if this program would run under Linux Mint?

I did try to install the program on another Windows 10 machine, but it would not run due to only having OpenGL 1.1, when apparently 2.0 is required. Apparently, this particular machine will not support OpenGL 2.0.

Is there a way to create a desktop Windows 10 icon, which, when double-clicked, will launch this program?

Possibly - it isn’t something I have tried. If Linux Mint is Debian based then you can use the automated installer and see what happens. Might be worth trying on a live USB stick first though, rather than a production system.

Yes, but it is not straightforward. You can see some suggestions how to achieve this here: Windows Shortcut to Run Python Script in Anaconda Command Prompt - Stack Overflow

I did the console update today and afterwards I get hung up at Websocket: Connection Open and the start never completes. Has anyone else seen this issue after updating to the latest wfpiconsole?

Did you leave an issue on the GitHub page as well? Try deleting your wfpiconsole.ini file and then restart the console. You’ll be prompted to re-enter your station details, and then you should be up and running again