Controller – Current Values

The core function of the controller is to read current values from the sensors, and this is done in the current_values module. In order to make the design extensible, the sensor types are handled by sensor helper modules dropped into the sensor_helpers directory. The __init.py__ file just has to be updated to include the reference to the new sensor type.

The skeleton controller includes one sensor type – evaluate, which enables us to read the virtual sensor described in a previous post. To run the controller, without rebooting the pi, use the following command:

sudo su - -c /etc/rc.local

and inspect the logfile for any errors:

cat /var/log/hub/hub.log

and view the statistics on the website:

http://home-hub/home.php?page=Statistics

You should now see the sensor value changing every minute. It should be tracing out a sine wave, but we will need the graph features in later modules to prove this!  What we should do now is connect up a real sensor.