ref: 2a24507795dcd52a154227ed41793788f47c88f3 rpi-clock/README.md -rw-r--r-- 2.5 KiB View raw
2a245077Tim Morgan Add screenshot to readme 5 years ago


This is a very simple clock and weather page for Raspberry Pi.

I needed a clock in my office and had a spare (cheap) flat-screen TV and a raspberry pi, so this was born.

It shows the current time, weather conditions (via Erik Flower's beautiful weather icons), current temperature (using the OpenWeatherMap API), low temp, high temp, and sunset.


I'm using Raspbian -- you can use any distro, but YMMV.

  1. Install Ruby 2.2.2 on your Raspberry Pi. I used RVM, but you can do it however you want.

  2. Clone this repo or download the tarball and expand into your home directory on the Pi.

  3. Write a script in your home directory to start the app called run_clock. This is mine:

    cd /home/pi/status
    GEM_PATH=/home/pi/.rvm/gems/ruby-2.2.1@status:/home/pi/.rvm/gems/ruby-2.2.1@global /home/pi/.rvm/rubies/ruby-2.2.1/bin/ruby app.rb &
    sleep 30
    midori -e Fullscreen -a http://localhost:4567

    The GEM_PATH stuff and full path to ruby is because I used RVM. You might only need the ruby app.rb & part.

    Notice that it sleeps for 30 seconds. This was me being generous because it takes several seconds for my Pi's wifi adapter to connect to the network.

  4. Make the script executable:

    chmod +x run_clock
  5. Run the script to make sure it works:

  6. Now create a desktop item that will automatically start the script:

    sudo vim /etc/xdg/autostart/clock.desktop

    Put this in the file:

    [Desktop Entry]
    Name=Clock App
  7. Last, set the Pi to start with no desktop:

    sudo vim /etc/xdg/lxsession/LXDE/autostart

    Comment out the stuff in that file and then put this in the file:

    @xset s off
    @xset -dpms
    @xset s noblank
  8. (Optional) Disable overscan and force HDMI output:

    sudo vim /boot/config.txt

    Set the following options:


Boot the Pi and see if it works!

The weather icons are licensed SIL Open Font License 1.1.

All other code was written by me and is public domain. Use it as you wish.