DeeAnn
Posts: 4
Joined: Wed Apr 17, 2013 5:48 pm

Weather and info display

Sat Apr 20, 2013 7:43 pm

Hi!

I have a Pi Model B with a 32gb Class X card. Woot! I also have a wee itty bitty FAVI keyboard for it.

What I would ~like to do~ is feed the composite video out (no sound needed) into my security camera multiplexer. What it does is display multiple security cameras on one screen in a grid.
There are 16 input channels and I have the Pi feeding one of them. It displays in one of the grid squares along with the security cameras. That part of it works great, no problems. :)

My problem is, getting it to fetch the content I want and have it display it.

I would like to have it run a sequence of "slides" so to speak, with one of them being the local weather radar (animated .gif), then a national weather radar (animated .gif) then a slide with local temperature, humidity, wind speed & direction and when hurricane season arrives, I want to have near realtime updated stuff on hurricanes as I live right on the coast of hurricane alley..

I haven't found all the misc images I want to use just yet but I have three that I can use to help me work out how to do it then I figure I can just expand on it from there.

I know I can use wget to retrieve the three I am experimenting with.

For instance, wget http://ftpcontent.worldnow.com/kbmt/Mic ... s_full.JPG
and
wget http://ftpcontent.worldnow.com/kbmt/Ext ... recast.jpg
and
wget http://ftpcontent.worldnow.com/kbmt/Doppler_466.gif

Certainly over time I will find other things I need to add to the "slide show", so to speak.

The forecast, it only needs to be fetched like once every 24 hours. The Current temp, once an hour is fine. The animated radar, maybe twice an hour.

I assume I would use cron to schedule the wget events.

What I am in the dark about is how to have the Pi display them full screen. I don't want to be locked into a browser, I tried Midori and it can load the images but it won't run a slide show and it won't go to true full screen and it won't scale the images to fill the screen properly.

I've been using Linux since I dumped winblow$ back in 2000 but about 2 years ago I became soured from the crummy Suse and Ubuntu experience and built a Hackintosh and have been using OSX almost exclusively now. So my Linux skills have gotten pretty rusty..

I guess what I'm looking for is an image display utility that runs from the command line, that can display animated .gif images, and png, jpg, etc. because the weather stuff I scrape from various locations will be in various formats.

And some guidance on writing some sort of script I guess to accomplish this task.

Another thing I want to do in the near future is to setup my Pi so that I can connect to it remotely via my iPhone to open/close my garage door. I already have it motorized and I have a remote controller I can sacrifice. I bought an 8 channel relay board ( http://cgi.ebay.com/ws/eBayISAPI.dll?Vi ... 0984095956 ) but I am pretty sure I will need some other device to go between the Pi and it. Then I guess I'll need a web server running on it and some sort of very serious authentication method to restrict access to it. I would love it if I could restrict it to a range of IP addresses that it would respond to. I don't know if Verizon assigns static IP's to iPhone 5's but that would be excellent if they did.

Anyway, the garage door thing is a future project. For now I would be thrilled to get my weather/info display system running..

Any advice??

Thank you! :)

belfastrab
Posts: 1
Joined: Mon Apr 22, 2013 8:41 pm

Re: Weather and info display

Mon Apr 22, 2013 9:14 pm

I would love to know how to do something like this also. I have a small 4 inch lcd screen to run with my PI and was wanting to mount both the PI and the screen in an attractive box which will look something along with lines of an alarm clock.

However with regards to the software side of things I have no idea where to start and brand new to Linux.

I was thinking that there must be someout out there that has already made something like the original poster was talking about that it shows weather info and for my purposes a clock and perhaps some other info such as news headlines via a RSS reader.

So if anyone can help me or the original poster as I am happy to try and learn but don't really want to spend the next year learning Python and Linux if I don't have to as I just don't have the time.

Thanks

Rab

[email protected]
Posts: 37
Joined: Thu May 31, 2012 8:04 pm

Re: Weather and info display

Tue Apr 23, 2013 9:40 am

a program called feh is the answer

i think it gets installed with x, but if not sudo apt-get install feh

its an easy to use file viewer (ie. man feh)

DeeAnn
Posts: 4
Joined: Wed Apr 17, 2013 5:48 pm

Re: Weather and info display

Wed Apr 24, 2013 7:32 am

Well, I've sort of made progress.

Basically I wrote a script that

1. Erases previously downloaded weather images.
2. wget's current weather images.
3. invokes display app.

I installed Eye Of Gnome - eog and it seems to handle the images just fine, it displays animated gifs for radar and satellite and jpg, png, etc..

My script is very simple, I just called it "fetch"

Code: Select all

rm *.PNG
rm *.jpg
rm *.JPG
rm *.gif
wget http://ftpcontent.worldnow.com/kbmt/Microcast%20Current%20Temperatures_full.JPG
wget http://ftpcontent.worldnow.com/kbmt/Extended%20Forecast.jpg
wget http://ftpcontent.worldnow.com/kbmt/Doppler_466.gif
wget http://www.kfdm.com/weather/images/maps/5dayabox.JPG
wget http://ftpcontent4.worldnow.com/kplc/weather/National%20SatRad_640.gif
wget http://www.kfdm.com/weather/images/maps/setxairport.JPG
wget http://ftpcontent.worldnow.com/kbmt/ALL%20WATCHES%20WARNINGS.jpg
eog -s 5dayabox.JPG
Apparently you have to give it a filename to start up with, once it opens one file it will look for and display all the images it finds in the current directory.

Also, I use rm to erase old images because I can't figure out how to make wget overwrite old images. It just creates new images with .1, .2, .3 etc. appended to the file name so that's no good.
I know there's a no clobber option for wget but how about an option TO CLOBBER? :?

Well anyway, this pretty much works. But, I can't figure out how to control the delay between slides.
I would prefer to have it linger longer on the animated radar images so I can watch it for like, 15 seconds so I can figure out what's what and where it's headed. The non-animated things I don't need to see for 15 seconds, 5 seconds each for static images would be fine.

Problem is, I can not figure out how to make eog understand delays via command line.

This isn't all that bad but what I'm wondering is how to setup a cron task so that every 30 minutes eog is killed and the "fetch" script is run again so that the old images are erased, fresh ones loaded and eog is run again to resume displaying current weather.

As it is now, I'm doing this manually while I'm sitting at my desk and that's fine but when I'm in other parts of the house I have displays for the security cameras and that weather display from the Pi and when I'm away from my desk I don't have anyway to update stuff.. So this is why I need it to be automated..

Image


Also, someone mentioned above about running weather to a small screen TV.
The spot outputs on my security system are several little composite 7" LCD screens. The weather stuff looks excellent on them because I'm scraping them from my local TV stations, these are the same, exact images they display on the air every evening so they are designed to look good on a TV screen. So yeah, this is very doable and looks pretty darn good if you do something like that.

Any advice on this would be greatly appreciated! Thanks!

rpiuser3000
Posts: 23
Joined: Sat Apr 27, 2013 11:47 pm

Re: Weather and info display

Sun Apr 28, 2013 1:32 am

You can do something similar to what I did with my Clock project. You can run web browser in full screen and make very simple html page + jquery that will switch pictures. You don't even have to download them to your rasberry, you can just link them directly to the source server. I can show you an example if interested.

DeeAnn
Posts: 4
Joined: Wed Apr 17, 2013 5:48 pm

Re: Weather and info display

Sun Apr 28, 2013 7:01 am

I would be very interested. I would be very grateful if you could share an example.

Thanks! :)

rpiuser3000
Posts: 23
Joined: Sat Apr 27, 2013 11:47 pm

Re: Weather and info display

Sun Apr 28, 2013 7:22 am

Something like this. Make txt file and rename it into weather.html and then open it using browser.
Right now its set to change pictures every 5 seconds(5000 ms) you can change it to anything.

Code: Select all

<html>
<head>
 <script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
<script type="text/javascript">
        jQuery( function( $ ) {
         $('#bg_fade' ).css( {backgroundImage: 'url(http://ftpcontent.worldnow.com/kbmt/Microcast%20Current%20Temperatures_full.JPG)' } ) ;
    var images = [ "http://ftpcontent.worldnow.com/kbmt/Extended%20Forecast.jpg",
                  "http://ftpcontent.worldnow.com/kbmt/Doppler_466.gif",
                  "http://www.kfdm.com/weather/images/maps/5dayabox.JPG",
                  "http://ftpcontent4.worldnow.com/kplc/weather/National%20SatRad_640.gif",
                  "http://www.kfdm.com/weather/images/maps/setxairport.JPG",
                  "http://ftpcontent.worldnow.com/kbmt/ALL%20WATCHES%20WARNINGS.jpg"];
    var currentImage = 0;

    function changeBackground() {
        $('#bg_fade' ).css( { backgroundImage: 'url(' + images[ ++currentImage ] + ')' } ) ;
        if ( currentImage >= images.length - 1 ) {
            currentImage -= images.length;
        }
        
    }    
    setInterval(function(){
     changeBackground();
    },5000);
    
});
         </script>
</head>
<body>
<div id="bg_fade" style="z-index: 1; position: absolute; top: 0px; left: 0px;width:100%;height:100%;background-repeat:no-repeat;background-size:100%;"></div>
</body>
</html>
Look for

Code: Select all

setInterval(function(){
     changeBackground();
    },5000);

To make it display on raspberry modify /etc/xdg/lxsession/LXDE/autostart
and make sure to install chromium.

Code: Select all

@sed -i 's/"exited_cleanly": false/"exited_cleanly": true/' ~/.config/chromium/Default/Preferences
@chromium --kiosk http://localhost/clock/index.php
Instead of http://localhost/clock/index.php you'll have to write something like

file://localhost/home/pi/weather.html

All depends on where you place that html.


Ah one more thing, you have to disable caching on rasb's chromium or you'll see old pictures.

DeeAnn
Posts: 4
Joined: Wed Apr 17, 2013 5:48 pm

Re: Weather and info display

Tue Apr 30, 2013 9:14 am

Oh wow! Thank you!

This may do the trick!

I'm going to have to spend some time on this figuring it out but it looks good!

I installed Chromium and saved the html. It loads into Chromium and pages the screens.
There are some tweaks I need to figure out like some of the graphics don't scale and fill the screen but that's not that big of a problem, I can live with it if I have to. There was something about modifying LXDE autostart and the cache. I'll work on those this week too. I think I can muddle my way through it.

A most sincere and humble THANK YOU! :)



edit: Question, do the script self update the images on some interval? Say like, once an hour it fetches updated images from the web?

Thanks again! :)

rpiuser3000
Posts: 23
Joined: Sat Apr 27, 2013 11:47 pm

Re: Weather and info display

Tue Apr 30, 2013 4:12 pm

DeeAnn wrote:Oh wow! Thank you!

This may do the trick!

I'm going to have to spend some time on this figuring it out but it looks good!

I installed Chromium and saved the html. It loads into Chromium and pages the screens.
There are some tweaks I need to figure out like some of the graphics don't scale and fill the screen but that's not that big of a problem, I can live with it if I have to. There was something about modifying LXDE autostart and the cache. I'll work on those this week too. I think I can muddle my way through it.

A most sincere and humble THANK YOU! :)



edit: Question, do the script self update the images on some interval? Say like, once an hour it fetches updated images from the web?

Thanks again! :)
It tries to download pictures from server on every switch(5000ms or 5 seconds), but it also loads them from cache when it thinks that picture on server didn't change. So, you probably don't have to disable cache in chromium as it seems to work properly.


As for filling the whole screen try changing div inside body tag.

Code: Select all

<div id="bg_fade" style="z-index: 1; position: absolute; top: 0px; left: 0px;width:720px;height:480px;background-repeat:no-repeat;background-size:720px 480px;"></div>
To modify autostart just open terminal and type sudo nano /etc/xdg/lxsession/LXDE/autostart
Copy-paste lines for chrome that I wrote above and press ctrl-x, it will ask about name, press y on keyboard and then enter and it should save changes.

OH650R
Posts: 18
Joined: Fri Feb 27, 2015 12:43 am

Re: Weather and info display

Wed Jun 17, 2015 11:31 pm

I know this post is old, but how can I change the code to my location? I'm guessing it's in the jquery code, but have no idea. Any help appreciated!

Return to “Other projects”