Website Home Page

Right, let’s get some code for our website. The following wget shell command will fetch the files for a skeleton website from the project’s code repository, and place them in your html web content directory.

wget -r -nH --cut-dirs=4 --reject "index.html*" -P /var/www/html/ -i /var/www/html/manifest1.txt

The key files are home.php, login.php, logout.php, signIn.php and A bunch of other javascript scripts and css styles will also be downloaded, which are needed for the website. There is a lot of code in this project, so I won’t go into detail about every file, but essentially home.php provides the menu structure based on the jQuery accordion. This is what you should see if you point your browser to http://home-hub/home.php and login.

login, logout, signIn and auth provide the authentication framework, in conjunction with the Users table in the database. The skeleton database already has the hub user ‘pi’ set up as an administrator, with the password ‘raspberry’ . We can use this login to complete most of the tasks in upcoming posts, but you should change the password as soon as possible!.  Each of the menu items, when selected, reads in the relevant feature file. The only file provided in this first skeleton website download is statistics.php

The Statistics page provides tables of technical data such as sensor values, actuator states, alert states, maximum/minimum values, queued messages and system information. We have implemented this first, so we have a simple view of our sensor values, but there are many other ways to view data which we will implement in later posts.

The skeleton database has one sensor pre-configured, the Sinewave Angle virtual sensor, but as we have no controller software running it is stuck at its last reading.  This is our next task.

Leave a Reply

Your email address will not be published. Required fields are marked *