WeatherFlow PiConsole - Archive

Great! Glad to hear it. I’ll hopefully have some time in the coming weeks to work on the code so I will try and get a fix in (and of course finish the units conversion code!).

3 Likes

I made a bit of a mess with an update so the download link is currently offline. It’ll be back up in a day or two with a brand new version.

1 Like

I started looking into this, found a few scripts that enable/disable the HDMI output - as that’s what I’m using (800x600) resolution on a standard 4:3 monitor. the scripts work fine when trying to turn off & on the display. However that only works for the Rpi desktop - if I run the piconsole - which seems to run in a virtual display? or KIVY console ?? I turn it off, goes dark - then turning it back on ‘nothing’ still dark.

I’ve tried the same on the Official Rpi 7" touchscreen - neither on/off has any effect - as it’s not using the HDMI port.

I have a hardware solution that is working well. I found a device that provides a 125vac outlet connected to an PIR sensor - it powers up/down my monitor when I walk up to or near it.

Westek MLC12BC-4

3 Likes

Not sure I can be much help here, but two thoughts

When you’re running the console, how long do you wait between turning the HDMI screen off and on? Is there any chance the HDMI screen is going into some power save mode between you turning it off and on again?

To turn the touchscreen on and off, try xset -display :0 dpms force off to turn the screen off, and xset -display :0 dpms force on to turn the screen on (or just touch it).

Thanks Peter…

I did try those commands and it does work as you stated. I have a PIR sensor on order and hope to intergrate that into the 7" PI Touchscreen setup that I have.I’ll use those commands to turn the touchscreen display off/on.

However I’m trying to do the same for my HDMI 800X600 setup - I have a solution that is working well (Westek MLC12BC-4)as I stated in my previous post. But I still trying to understand how KIVY(piconsole) takes over the Rpi display and how is it addressed to turn it on/off as well as getting a screenshot of the display.
I’ve tried using ‘scrot’ successfully to grab screenshots of the Rpi desktop, but can’t seem to grab the piconsole - ‘window/display’ do you know if it’s possible to do that - either through a shell command, or python code?

EDIT: and to answer your question : I’ve only waiting seconds - so I don’t think the screensaver function is the problem.

Give raspi2png a spin (GitHub - AndrewFromMelbourne/raspi2png: Utility to take a snapshot of the Raspberry Pi screen and save it as a PNG file). I tried to use Scrot as well but always ended up with a black screen. I have successfully used raspi2png to capture the screenshot that is at the top of this thread.

I’m afraid I am still also trying to understand exactly how the Kivy window is displayed on a Raspberry Pi. The reason that Scrot returns a black screen is probably exactly the same reason why the power off/power on cycle doesn’t work. I believe Kivy runs in the framebuffer rather than under the X environment, but don’t quote me on that…

Edit: just been Googling around a little bit. Found this snippet on the Raspberry Pi forums:

After reenabling tvservice with tvservice -p you should not forget to resurrect your framebuffer with something like

fbset -depth 8; fbset -depth 16; xrefresh

(Turning off HDMI backlight - Raspberry Pi Forums). Does that help in anyway?

1 Like

The RPi screen is at range to me also. I’m cheating and run Chromium. It works well and I learn a little more each day.

1 Like

THANKS Peter!
it worked! I was able to get a screenshot! - I’ll tell you why I’m wanting to get this working… I’ve been working on a Display Board similar to DakBoard (DAKboard - A customizable display for your photos, calendar, news, weather and more!) - I would like to include a screenshot of piconsole within the background image this will allow me to do that. Here’s a copy of the screenshot I just grabbed - you may not recognize it! I’ve been playing around with trying to get my wxCam image - overlaying the ‘Rainfall’ section that was the easy part. I can’t figure out how to update the image - as it’s updated from my camera every 5 mins. I figured out how to download a updated copy of the current.jpg file but refreshing the piconsole screen has me stumped. I only wanted the imaged overlayed if it’s NOT raining.

I also played around with the screen on/off - that is still creating a deeper mystery. I ran that command after turning the screen off then back on - and it sent my monitor into a strange mode resolution:

pi@pyconsole3:~ $ ./rpi-hdmi.sh off
Powering off HDMI
pi@pyconsole3:~ $ ./rpi-hdmi.sh on
Powering on HDMI with preferred settings
Couldn't get a file descriptor referring to the console
Couldn't get a file descriptor referring to the console
Couldn't get a file descriptor referring to the console
pi@pyconsole3:~ $ fbset -depth 8; fbset -depth 16; xrefresh
pi@pyconsole3:~ $ 

BAD_SCREEN

Looks great!! Nice work!

To only have the image showing when it is not raining, have a look at how I handle the Forecast/SagerForecast data for some hints. In the .kv file you’ll see that both are nested under individual FloatLayouts, with an id assigned to both (Lines 56/57 and 143/144). The opacity is set to 1 for the current forecast from the UK Metoffice/DarkSky and 0 for the Sager Forecast. Now look at lines 1798 to 1811 in main.py. You’ll see that when the Forecast button is pressed, the opacity is switched between the two widgets, and I update a variable keeping track of which screen is showing. That what every time the button is pressed, it switches between the two screens. You’ll want to do something similar, but instead of triggering the call to the switching function on a button press, you will want to add a call to the switching function when it starts/stops raining (probably best to do this in the WebsocketDecodeMessage function depending on whether the RainRate variable is zero or not.

As for updating the image, you can automatically tell Kivy to continuously call a function with a specific interval of time. For example see the UpdateMethods function. It has an argument dt and on line 287 of main.py I tell Kivy to call that function every second. You’ll want to write something similar that Kivy calls every 5 minutes. In that function you’ll want to update a variable that contains the path to the latest image (maybe something like self.Screen[‘wxCam’]), and then use that variable in the .kv file to set the image path (like I do for the wind rose or the barometer.

Hope this makes sense and is of some help!

1 Like

Peter;
Thanks for the detailed reply…

Because I’m hack I just pretend to know what I’m doing. Python is VERY new to me. So my attempts to understand what is going on reading the code - often gives me false hope. I have found all the sections of code you refer to, and have already ‘touched’ some of those areas with limited success. I was able to insert a line of code that downloads my wxCam image from WU - every 5mins within the “# DOWNLOAD THE LATEST FORECAST FOR STATION LOCATION”.

	def DownloadForecast(self):
	
		url2 = 'https://icons.wunderground.com/webcamramdisk/t/c/tcichowicz/2/current.jpg'  
		urllib.request.urlretrieve(url2, '/home/pi/wfpiconsole/Background/current.jpg')  

I get the image displayed on the background properly, but only upon launch - it’s the refresh that has me still working on the problem.

I’ve found it the past to step back for awhile, come back to it in a few days or more to get a fresh set of eyes. If I keep looking at it I tend to continue to get stuck in a loop -

Now that you have helped me get a good screenshot - I’ve drifted into another area of focus. Playing around more with creating a background image with the screenshot overlaid. I am attempting this in python - perhaps I can learn some of the basics, that will help me go back to your code and more fully understand the inter-workings better.

I’v resorted back to your original code with the exception of my date and time formatting change. I really don’t want to create a Frankenstein - so that when you come up with an update, I have to plow thru trying to figure out how to add/apply my mods.

Thanks again - I’m looking forward to playing/hacking about… again. And thanks for being my ‘python muse’.

My screen sleeps after a few minutes. I think I might want it on all the time. I wonder what this will do to the screen life?

I’ve been running ArchiveSW with the screen on. I have seen no issue. My only issue is I want to dim it at night so it’s time to add a light sensor and auto dimming code. I’m also thinking an IR motion to turn it on and off.

5 Likes

I’d go for option 2 :wink:

2 Likes

That sounds like a neat solution! At the moment I just use the DPMS (Display Power Management Signaling - ArchWiki) features of the screen to turn it off after 5 minutes. A simple tap brings the screen back up.

1 Like

I had screentime set to 5 minutes and I just wasn’t happy with having to physically tap the screen. I feel there should be a more natural way.

Here is a thread that talks about that very thing. rpi-backlight: Control over display brightness and power - Raspberry Pi Forums

I have set the default brightness down on my screen so on boot up it gets set lower than full brightness.

Weird (but probably simple) issue

I got my brand spankin new Pi 4 configured and ran the setup, it ran the whole way through completion, but when I try to launch the console, I get…

pi@raspb4:~/wfpiconsole $ wfpiconsole start
Traceback (most recent call last):
  File "main.py", line 20, in <module>
    from lib import configCreate
  File "/home/pi/wfpiconsole/lib/configCreate.py", line 25, in <module>
    from packaging import version
ModuleNotFoundError: No module named 'packaging'

Any ideas what I'm doing wrong?  

Thanks! 

Scott 

Never mind, I did an ‘update’ and it isntalled the packaging module. All good :slight_smile:

Enjoy the ice! I spent a year in McMurdo, it was (wait for it) cool.

That’s not a silly question! It’s what comes from living in the UK. We still doggedly stick with MPH whilst everything else is metric.

Check your inbox for instructions. Still haven’t decided the best way to distribute them!

3 Likes

installed it very quickly as I have to fly toParis, full test on Monday

beware : if you want to autoboot it, you need to change the ‘y’ in this trick with a i as the naming change from py to pi

only problem I found, when toggling the forecast instead changing it sur imposes the text

3 Likes