Colossus WordPress plugin is now GPL

That’s right.  Code commit 715b677  officially made the Colossus WordPress plugin 100% GPL liscensed.  Here at Geekaquarium.com we LOVE free and open source software.

/*
“Colossus Aquarium Plugin” Copyright (C) 2017 GeekAquarium.com

This file is part of Colossus WordPress Plugin for WordPress.

Colossus WordPress Plugin is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

Colossus WordPress Plugin is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with Contact Form to Database Extension.
If not, see http://www.gnu.org/licenses/gpl-3.0.html
*/

Relay Status Display

Growing up as a kid, I was obsessed with all things space.  TV shows like Battlestar Galactica, Buck Rogers , Space 1999, and others just helped to fuel that obsession.  As a kid, I knew that stuff I saw on TV wasn’t real.  For the real stuff you needed to pay attention to NASA.

S-IB Networks control panel. This panel monitored the state of the electrical bus communications within the Apollo S-IB rocket. Photo credit: Jonathan H. Ward

Rockets and spacewalks are cool, but the earliest impression of NASA that I have is Mission Control.  The rows of consoles with the CRT screens and status panels filled with blinking lights really stuck with me.  As such, I’ve always enjoyed a good control panel.

My original idea for Colossus was to have a section of the canopy to display relay status in this fashion. One of the MCP23017 I2C chips is reserved for driving an LED status panel.  Since we expanded Colossus and added a second Raspberry Pi (Guardian), we decided to do a virtual control panel instead.

Following the design inspirations of NASA, we created the following Relay Power Status Panel.

Relay Power Status Panel

This relay status panel displays highlighted status for powered on devices along with a spinning gear icon.  Relays that are off are not highlighted and display a power button icon.  Clicking a relay status will run the colossuscontrol.py script and toggle the relay state off and on.  We are still working on the final color scheme.  On our wish list is replacing one of the 17″ LCD displays with a touchscreen.    We can dream.

How it works

[colossus-relay-status]

This shortcode works by calling the colossuscontrol.py script with the webstatus option.  The webstatus option returns a single line of status output in a comma separated key/value list.  Key value pairs consist of command name, and relay power status.  Example output is listed below.

heater,0,Mood,0,Air,1,Filter,1,Light1,0,PartyBall,0,Floor,0,Game,0,Moonlight,
1,Powerhead,0,Light2,0,UV,0

The shortcode reads this output,  sorts the key/values alphabetically and generates the status panel display.  There is no hard coding of commands or relay names in the plug.  All commands are passed to the shortcode from the colossuscontrol.py.  Changes to channel command or gpio pin numbers will not affect the functionality of this shortcode.

WARNING!

This script uses PHP’s exec and system functions to run the colossuscontrol.py script. Certain aspects of the colossus control script require it to be run as root. In order to function properly, Apache must have root privileges. This creates MAJOR security holes. Our aquarium is not publicly accessible from the internet, otherwise we would not have done it. WE DO NOT ADVISE RUNNING APACHE AS ROOT!  DO SO AT YOUR OWN RISK!

Colossus WordPress Plugin

We are big fans of WordPress, so it’s no surprise that we are using it for Colossus.  While designing the web based control panel, I decided that it would be easier if I just incorporated all the individual scripts into a plugin.  I used Michael Simpson’s excellent WordPress Plugin Template to get started, and the Colossus Aquarium Plugin was born.    You can get git the code  at our BItBucket repository.

Important Note

For the on/off feature of the relay status panel to work, you must create docommand.php and install in Colossus’ www folder.  Please see this link for more details.

Shortcodes

The following shortcodes are available:

[colossus-tank-status] • Display Tank Info
[colossus-relay-status] • Display Relay Status
[colossus-temperature-status] • Display Temperature
[colossus-display-last-event] • Display Last Event from database
[colossus-display-last-ph] • Display Last pH reading from database
[colossus-display-last-waterchange] • Display Last Waterchange from database
[colossus-graph-water-change] • Display graph of water changes
[colossus-graph-temperature] • Display graph of temperature readings at 12:00pm
[colossus-graph-ph] • Display graph of pH readings
[colossus-show-camera] • Display RelOptic Camera Feed
[colossus-filterchange-add] • Data entry for filter media change
[colossus-] • 
[colossus-] • 

ColossusControl docommand.php

I needed a way to call the colossuscontrol.py script from a php script.  The script docommand.php allows you to call colossus control and pass command line options to it as a url.

Download

You can download the code respository at BitBucket.

WARNING!

This script uses PHP’s exec and system functions to run the colossuscontrol.py script. Certain aspects of the colossus control script require it to be run as root. In order to function properly, Apache must have root privileges. This creates MAJOR security holes. Our aquarium is not publicly accessible from the internet, otherwise we would not have done it. WE DO NOT ADVISE RUNNING APACHE AS ROOT!  DO SO AT YOUR OWN RISK!

http://colossus.local/docommand.php?cmd=webstatus

http://colossus.local/docommand.php?cmd=status&action=html