The dashboard site can run on your Raspberry Pi. To turn your Pi into a web server, you need to first install Apache:
sudo apt-get install apache2
If you enabled persistence and want to be able to view logs, you also need to install PHP, and the MySQL PHP libraries:
sudo apt-get install php5 libapache2-mod-php5 sudo apt-get install php5-mysql
To check if Apache works, just browse to your Pi's IP address (eg. http://192.168.1.80). If Apache installed correctly, you'll see a page saying "It works!".
If you also followed the guide to install Samba (recommended!), you can now add a section to add access to /var/www, so you can develop the site from your regular computer:
sudo nano /etc/samba/smb.conf
At the end, add this:
[www] comment = www path = /var/www browseable = Yes writeable = Yes only guest = no create mask = 0777 directory mask = 0777 public = no force user = root
The weather bar uses the Weather Underground API to get weather data. Before it can get weather data, you'll need two things:
- A (free) Weather Underground API key
- A weather station ID
Start by requesting an API key:
- Go to the Weather Underground API and click the Sign Up button
- Create an account, and activate it using the confirmation e-mail
- Once you're logged in, you need to request an API key: you can select the biggest (Anvil) plan and the history add-on: as long as you select the Developer option it will be $0.
- Make a note of your API key.
- Also note that the free key allows 500 calls per day. By default, the weather refresh interval on the sample dashboard is every 10 minutes, which would make 144 calls per day. If you change it, make sure you don't go over your quota - or buy an upgrade plan.
The next step is to find a weather station ID:
- Go to the Weather Underground home page.
- Search for your location - it will take you to the weather detail page for a nearby station.
- Optional: change the default station to one closer to you by clicking on "Change Station".
- Click on the weather station name - it's right under your location name.
- On this page the station's ID will be right next to the station name - make a note of that ID.
- Example: if you search for "New York, New York", the default station is "Flatiron". If you click on Flatiron, the station's page lists the ID as "KNYNEWYO118".
Download the dashboard and unzip it to /var/www on your Pi. Then check index.html and look for all the places where it says TODO. That's where you need to change things like insert your weather API key.
You'll probably want to look through the code to understand what's going on. There are comments explaining things throughout. The main files are:
- index.html: set up general configuration + add, remove and configure widgets (HTML)
- css/style.css: widget style (CSS)
- data.php: used to query the openhab logs in MySQL and return the last 6 entries as JSON (PHP)
The latest version of the dashboard can always be found on GitHub.
If you're using an Android tablet as your screen, you'll want the browser to work in full screen mode so the various tool bars don't take up precious screen space.
There are probably several ways to do it - here's one way:
- Install the Chrome For Android browser, or update it to the latest version (you need at least version 39).
- Browse to to your dashboard site, and once it's loaded open the Settings menu and click "Add to homescreen". This will create a launcher icon, and allow it to start full-screen. If you're curious, see here for how that works.
- Install the Immersive Mode app. Once installed open the app and have it start on boot.
- Open your dashboard site using the launcher icon you created earlier. The Chrome interface (address bar etc) should be hidden, but you can still see the Android notifications bar at the top and actions bar at the bottom.
- Slide down the Android notifications from the top, and select the right-most icon in the Immersive Mode notification. This should hide both bars - your dashboard is now the only thing visible on the tablet.