Welcome to Hackster!
Hackster is a community dedicated to learning hardware, from beginner to pro. Join us, it's free!
Christian
Published © LGPL

Professional Hydroponics Database Management

Capture all your Hydroponics Sensor Data and make it simple to Understand and Manage

IntermediateFull instructions provided6 hours1,497

Things used in this project

Hardware components

IO Expander
×1
IO Expander Bundle
×1
Raspberry Pi 4 Model B
Raspberry Pi 4 Model B
×1

Software apps and online services

Visual Studio 2017
Microsoft Visual Studio 2017

Story

Read more

Schematics

Grafana Dashboard

Sample Grafana Dashboard of the Professional Hydroponics System

Code

MSSQL Create Database

SQL
MSSQL Script to Create Hydroponics Database Tables
CREATE TABLE [dbo].[Hydroponics](
    [ReadingTime] [datetime] NOT NULL,
    [InsideTemp] [DECIMAL](9, 2) NULL,
    [InsideRelative] [DECIMAL](9, 2) NULL,
    [InsideAbsolute] [DECIMAL](9, 2) NULL,
    [OutsideTemp] [DECIMAL](9, 2) NULL,
    [OutsideRelative] [DECIMAL](9, 2) NULL,
    [OutsideAbsolute] [DECIMAL](9, 2) NULL,
    [VentFan] [bit] NULL,
    [Lights] [bit] NULL,
    [POWER] [SMALLINT] NULL,
    [GrowBed1WaterTemp] [DECIMAL](9, 2) NULL,
    [GrowBed1WaterTDS] [SMALLINT] NULL,
    [GrowBed1WaterLevel] [bit] NULL,
    [GrowBed2WaterTemp] [DECIMAL](9, 2) NULL,
    [GrowBed2WaterTDS] [SMALLINT] NULL,
    [GrowBed2WaterLevel] [bit] NULL,
    [DailyCost] [DECIMAL](9, 2) NULL,
    [ColorTemp] [INT] NULL,
    [Lux] [INT] NULL,
    [CO2] [DECIMAL](9, 2) NULL,
    [CO2Temp] [DECIMAL](9, 2) NULL,
    [CO2Relative] [DECIMAL](9, 2) NULL,
    [GerminationTemp] [DECIMAL](9,2) NULL,
    [ChillerTemp] [DECIMAL](9,2) NULL,
    [pH] [DECIMAL](9,2) NULL,
    [DO] [DECIMAL](9,2) NULL,
PRIMARY KEY CLUSTERED
(
    [ReadingTime] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
 
CREATE TABLE [dbo].[Request](
    [RequestTime] [DATETIME] NOT NULL,
    [JsonData] [VARCHAR](MAX) NULL,
    [Processed] [BIT] NULL,
PRIMARY KEY CLUSTERED
(
    [RequestTime] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
 

MSSQL ASPX Data Converter

C#
MSSQL ASPX Code to Convert the JSON Data Payload to MSSQL
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.Script;
using System.Web.Script.Serialization;
using System.Data.SqlClient;
using System.Data;
using System.Configuration;
 
namespace Hydroponics
{
    public partial class adddata : System.Web.UI.Page
    {
        class GrowBed
        {
            public decimal WaterTemp { get; set; }
            public int WaterTDS { get; set; }
            public bool WaterLevel { get; set; }
        }
 
        class HydroponicsData
        {
            public DateTime ReadingTime { get; set; }
            public decimal InsideTemp { get; set; }
            public decimal InsideRelative { get; set; }
            public decimal InsideAbsolute { get; set; }
            public decimal OutsideTemp { get; set; }
            public decimal OutsideRelative { get; set; }
            public decimal OutsideAbsolute { get; set; }
            public bool VentFan { get; set; }
            public bool Lights { get; set; }
            public int Power { get; set; }
            public decimal DailyCost { get; set; }
            public int ColorTemp { get; set; }
            public int Lux { get; set; }
            public decimal CO2 { get; set; }
            public decimal CO2Temp { get; set; }
            public decimal CO2Relative { get; set; }
            public decimal GerminationTemp { get; set; }
            public decimal ChillerTemp { get; set; }
            public List<GrowBed> GrowBed { get; set; }
 
 
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            var data = new JavaScriptSerializer().Deserialize<HydroponicsData>(Request["data"].ToString());
 
            String strSQL = "INSERT INTO Hydroponics (ReadingTime,"
                "InsideTemp,InsideRelative,InsideAbsolute,"
                "OutsideTemp,OutsideRelative,OutsideAbsolute,"
                "VentFan,Lights,Power,DailyCost,"
                "ColorTemp,Lux,"
                "CO2,CO2Temp,CO2Relative,"
                "GerminationTemp,ChillerTemp,"
                "GrowBed1WaterTemp,GrowBed1WaterTDS,GrowBed1WaterLevel,"
                "GrowBed2WaterTemp,GrowBed2WaterTDS,GrowBed2WaterLevel)"
                " VALUES ("
                "'" data.ReadingTime.ToString() "',";
                if (data.InsideTemp >= 0) strSQL += data.InsideTemp.ToString() "," data.InsideRelative.ToString() "," data.InsideAbsolute.ToString() ",";
                else strSQL += "NULL,NULL,NULL,";
                if (data.OutsideTemp >= 0) strSQL += data.OutsideTemp.ToString() "," data.OutsideRelative.ToString() "," data.OutsideAbsolute.ToString() ",";
                else strSQL += "NULL,NULL,NULL,";
                strSQL += ((data.VentFan) ? "1" : "0") "," ((data.Lights) ? "1" : "0") "," data.Power.ToString() "," data.DailyCost.ToString() ",";
                if (data.ColorTemp >= 0) strSQL += data.ColorTemp.ToString() "," data.Lux.ToString() ",";
                else strSQL += "NULL,NULL,";
                if (data.CO2 >= 0) strSQL += data.CO2.ToString() "," data.CO2Temp.ToString() "," data.CO2Relative.ToString() ",";
                else strSQL += "NULL,NULL,NULL,";
                if (data.GerminationTemp >= 0) strSQL += data.GerminationTemp.ToString() ",";
                else strSQL += "NULL,";
                if (data.ChillerTemp >= 0) strSQL += data.ChillerTemp.ToString() ",";
                else strSQL += "NULL,";
                if (data.GrowBed[0].WaterTemp >= 0) strSQL += data.GrowBed[0].WaterTemp.ToString() ",";
                else strSQL += "NULL,";
                if (data.GrowBed[0].WaterTDS >= 0) strSQL += data.GrowBed[0].WaterTDS.ToString() ",";
                else strSQL += "NULL,";
                strSQL += ((data.GrowBed[0].WaterLevel) ? "1" : "0") ",";
                if (data.GrowBed[1].WaterTemp >= 0) strSQL += data.GrowBed[1].WaterTemp.ToString() ",";
                else strSQL += "NULL,";
                if (data.GrowBed[1].WaterTDS >= 0) strSQL += data.GrowBed[1].WaterTDS.ToString() ",";
                else strSQL += "NULL,";
                strSQL += ((data.GrowBed[1].WaterLevel) ? "1" : "0") ")";
 
            try
            {
                SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["ServerConnectionString"].ConnectionString);
                con.Open();
 
                SqlCommand cmd = new SqlCommand(strSQL, con);
                cmd.ExecuteNonQuery();
 
                strSQL = "SELECT * FROM Request WHERE Processed IS NULL ORDER BY RequestTime ASC";
                SqlCommand req = new SqlCommand(strSQL, con);
                SqlDataAdapter sda = new SqlDataAdapter(req);
                DataTable dtRequest = new DataTable();
                sda.Fill(dtRequest);
 
                if (dtRequest.Rows.Count > 0)
                {
                    for (int rows = 0; rows < dtRequest.Rows.Count; rows++)
                    {
                        if (dtRequest.Rows[0]["JsonData"] != DBNull.Value)
                        {
                            Response.Write(dtRequest.Rows[0]["JsonData"].ToString());
                            Response.Write("\n");
                        }
                    }
 
                    DateTime dt = (DateTime)dtRequest.Rows[dtRequest.Rows.Count-1]["RequestTime"];
                    strSQL = "UPDATE Request SET Processed=1 WHERE Processed IS NULL AND RequestTime <='" dt.ToString("yyyy-MM-dd HH:mm:ss.fff") "'";
                    SqlCommand upd = new SqlCommand(strSQL,con);
                    upd.ExecuteNonQuery();
                }
 
                con.Close();
            }
            catch (SqlException sqlex)
            {
                Response.Write(sqlex.Message.ToString() "\r\n");
            }
 
 
        }
    }
}

MSSQL ASPX Sensor Control

C#
MSSQL ASPX Code to Control your Sensors
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.SqlClient;
using System.Data;
using System.Configuration;
 
namespace Hydroponics
{
    public partial class addrequest : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Request["data"] != null)
            {
                String strSQL = "INSERT INTO Request (RequestTime, JsonData) VALUES (GETUTCDATE(),'" + Request["data"].ToString() + "')";
                try
                {
                    SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["ServerConnectionString"].ConnectionString);
                    con.Open();
 
                    SqlCommand cmd = new SqlCommand(strSQL, con);
                    cmd.ExecuteNonQuery();
 
                    con.Close();
                }
                catch (SqlException sqlex)
                {
                    Response.Write(sqlex.Message.ToString() + "\r\n");
                }
            }
 
            ClientScript.RegisterStartupScript(typeof(Page), "closePage", "window.close();", true);
        }
    }
}

MySQL Create Database

SQL
MySQL Script to Create Hydroponics Database Tables
CREATE TABLE Hydroponics(
    ReadingTime DATETIME NOT NULL,
    InsideTemp DECIMAL(9, 2) NULL,
    InsideRelative DECIMAL(9, 2) NULL,
    InsideAbsolute DECIMAL(9, 2) NULL,
    OutsideTemp DECIMAL(9, 2) NULL,
    OutsideRelative DECIMAL(9, 2) NULL,
    OutsideAbsolute DECIMAL(9, 2) NULL,
    VentFan BIT NULL,
    Lights BIT NULL,
    Power SMALLINT NULL,
    GrowBed1WaterTemp DECIMAL(9, 2) NULL,
    GrowBed1WaterTDS SMALLINT NULL,
    GrowBed1WaterLevel BIT NULL,
    GrowBed2WaterTemp DECIMAL(9, 2) NULL,
    GrowBed2WaterTDS SMALLINT NULL,
    GrowBed2WaterLevel BIT NULL,
    DailyCost INT NULL,
    ColorTemp INT NULL,
    Lux INT NULL,
    CO2 DECIMAL(9, 2) NULL,
    CO2Temp DECIMAL(9, 2) NULL,
    CO2Relative DECIMAL(9, 2) NULL,
    GerminationTemp DECIMAL(9,2) NULL,
    ChillerTemp DECIMAL(9,2) NULL,
    pH DECIMAL(9,2) NULL,
    DO DECIMAL(9,2) NULL,
    PRIMARY KEY(ReadingTime)
);
 
CREATE TABLE Request(
    RequestTime DATETIME NOT NULL,
    JsonData VARCHAR(4096) NULL,
    Processed BIT NULL,
    PRIMARY KEY(RequestTime)
);

PHP Data Converter

PHP
MySQL PHP Code to Convert the JSON Data Payload to MySQL
<?php
 
$servername = "localhost";
$dbname = "mydata";
$username = "admin";
$password = "password";
 
if ($_SERVER["REQUEST_METHOD"] == "POST") {
    $data = json_decode($_POST["data"]);
 
    // Create database connection
    $conn = new mysqli($servername, $username, $password, $dbname);
    // Check connection
    if ($conn->connect_error) {
        die("Connection failed: " . $conn->connect_error);
    }
 
    ini_set("date.timezone", "UTC");
 
    $sql = "INSERT INTO Hydroponics (ReadingTime," .
    "InsideTemp,InsideRelative,InsideAbsolute," .
    "OutsideTemp,OutsideRelative,OutsideAbsolute," .
    "VentFan,Lights,Power,DailyCost," .
    "ColorTemp,Lux," .
    "CO2,CO2Temp,CO2Relative," .
    "GerminationTemp,ChillerTemp," .
    "pH,DO," .
    "GrowBed1WaterTemp,GrowBed1WaterTDS,GrowBed1WaterLevel," .
    "GrowBed2WaterTemp,GrowBed2WaterTDS,GrowBed2WaterLevel) " .
    "VALUES (" .
    "STR_TO_DATE('" . $data->ReadingTime . "','%m/%d/%Y %H:%i:%s'),";
    if ($data->InsideTemp >= 0) $sql .= $data->InsideTemp . "," . $data->InsideRelative . "," . $data->InsideAbsolute . ",";
    else $sql .= "NULL,NULL,NULL,";
    if ($data->OutsideTemp >= 0) $sql .= $data->OutsideTemp . "," . $data->OutsideRelative . "," . $data->OutsideAbsolute . ",";
    else $sql .= "NULL,NULL,NULL,";
    $sql .= ($data->VentFan ? "1":"0") . "," . ($data->Lights ? "1":"0") . "," . $data->Power . "," . $data->DailyCost . ",";
    if ($data->ColorTemp >= 0) $sql .= $data->ColorTemp . "," . $data->Lux . ",";
    else $sql .= "NULL,NULL,";    
    if ($data->CO2 >= 0) $sql .= $data->CO2 . "," . $data->CO2Temp . "," . $data->CO2Relative . ",";
    else $sql .= "NULL,NULL,NULL,";
    if ($data->GerminationTemp >= 0) $sql .= $data->GerminationTemp . ",";
    else $sql .= "NULL,";
    if ($data->ChillerTemp >= 0) $sql .= $data->ChillerTemp . ",";
    else $sql .= "NULL,";
    if ($data->pH >= 0) &sql .= $data->pH . ",";
    else $sql .= "NULL,";
    if ($data->DO >= 0) &sql .= $data->DO . ",";
    else $sql .= "NULL,";
    if ($data->GrowBed[0]->WaterTemp >= 0) $sql .= $data->GrowBed[0]->WaterTemp . ",";
    else $sql .= "NULL,";
    if ($data->GrowBed[0]->WaterTDS >= 0) $sql .= $data->GrowBed[0]->WaterTDS . ",";
    else $sql .= "NULL,";
    $sql .= ($data->GrowBed[0]->WaterLevel ? "1":"0") . ",";
    if ($data->GrowBed[1]->WaterTemp >= 0) $sql .= $data->GrowBed[1]->WaterTemp . ",";
    else $sql .= "NULL,";
    if ($data->GrowBed[1]->WaterTDS >= 0) $sql .= $data->GrowBed[1]->WaterTDS . ",";
    else $sql .= "NULL,";
    $sql .= ($data->GrowBed[1]->WaterLevel ? "1":"0") . ")";
 
    if ($conn->query($sql) == FALSE) {
        echo "Error: " . $sql . "\r\n" . $conn->error . "\r\n";
    }
 
    $sql = "SELECT * FROM Request WHERE Processed IS NULL ORDER BY RequestTime ASC";
    $result = $conn->query($sql);  
    if ($result->num_rows > 0) {
        $lasttime = "";
        while($row = $result->fetch_assoc()) {
            echo $row["JsonData"] . "\n";
            $lasttime = $row["RequestTime"];  
        }
 
        $sql = "UPDATE Request SET Processed=1 WHERE Processed IS NULL AND RequestTime <= '" . $lasttime . "'";
        $conn->query($sql);
    }
 
    $conn->close();
}
else {
    echo "No data posted with HTTP POST.";
}
 

MySQL PHP Sensor Control

PHP
MySQL PHP Code to Control your Sensors
<?php
 
$servername = "localhost";
$dbname = "mydata";
$username = "admin";
$password = "mysql";
 
if ($_SERVER["REQUEST_METHOD"] == "GET") {
 
    // Create database connection
    $conn = new mysqli($servername, $username, $password, $dbname);
    // Check connection
    if ($conn->connect_error) {
        die("Connection failed: " . $conn->connect_error);
    }
 
    ini_set("date.timezone", "UTC");
 
    $sql = "INSERT INTO Request (RequestTime,JsonData) " .
    "VALUES (" .
    "UTC_TIMESTAMP(),'" . $_GET["data"] . "')";
 
    if ($conn->query($sql) == FALSE) {
        echo "Error: " . $sql . "\r\n" . $conn->error;
    }
 
    $conn->close();
 
    echo "<script>window.close();</script>";
}
else {
    echo "No data posted with HTTP POST.";
}
 
echo "\r\n";
 

MSSQL Grafana JSON

JSON
MSSQL Grafana JSON Code for the Hydroponics Dashboard
{
  "annotations": {
    "list": [
      {
        "builtIn": 1,
        "datasource": "-- Grafana --",
        "enable": true,
        "hide": true,
        "iconColor": "rgba(0, 211, 255, 1)",
        "name": "Annotations & Alerts",
        "type": "dashboard"
      }
    ]
  },
  "description": "Garage Hydroponics",
  "editable": true,
  "gnetId": null,
  "graphTooltip": 0,
  "id": 1,
  "links": [],
  "panels": [
    {
      "datasource": null,
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "thresholds"
          },
          "custom": {},
          "decimals": 1,
          "mappings": [],
          "max": 100,
          "min": 0,
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "blue",
                "value": null
              },
              {
                "color": "green",
                "value": 60
              },
              {
                "color": "red",
                "value": 80
              }
            ]
          },
          "unit": "fahrenheit"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 6,
        "w": 5,
        "x": 0,
        "y": 0
      },
      "id": 10,
      "options": {
        "orientation": "auto",
        "reduceOptions": {
          "calcs": [
            "first"
          ],
          "fields": "",
          "values": false
        },
        "showThresholdLabels": true,
        "showThresholdMarkers": true
      },
      "pluginVersion": "7.1.5",
      "targets": [
        {
          "alias": "",
          "format": "table",
          "rawSql": "SELECT TOP 1\n  ((InsideTemp*1.8)+32) AS 'Inside Temperature'\nFROM\n  Hydroponics\nORDER BY\n  ReadingTime DESC",
          "refId": "A"
        }
      ],
      "timeFrom": null,
      "timeShift": null,
      "title": "Inside Temperature",
      "type": "gauge"
    },
    {
      "datasource": null,
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "thresholds"
          },
          "custom": {},
          "decimals": 1,
          "mappings": [],
          "max": 100,
          "min": 0,
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "blue",
                "value": null
              },
              {
                "color": "green",
                "value": 60
              },
              {
                "color": "red",
                "value": 80
              }
            ]
          },
          "unit": "fahrenheit"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 6,
        "w": 5,
        "x": 5,
        "y": 0
      },
      "id": 11,
      "options": {
        "orientation": "auto",
        "reduceOptions": {
          "calcs": [
            "first"
          ],
          "fields": "",
          "values": false
        },
        "showThresholdLabels": true,
        "showThresholdMarkers": true
      },
      "pluginVersion": "7.1.5",
      "targets": [
        {
          "alias": "",
          "format": "table",
          "rawSql": "SELECT TOP 1\n  ((OutsideTemp*1.8)+32) AS 'Outside Temperature'\nFROM\n  Hydroponics\nORDER BY\n  ReadingTime DESC",
          "refId": "A"
        }
      ],
      "timeFrom": null,
      "timeShift": null,
      "title": "Outside Temperature",
      "type": "gauge"
    },
    {
      "datasource": null,
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "thresholds"
          },
          "custom": {},
          "decimals": 1,
          "mappings": [],
          "max": 100,
          "min": 0,
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "blue",
                "value": null
              },
              {
                "color": "green",
                "value": 50
              },
              {
                "color": "red",
                "value": 70
              }
            ]
          },
          "unit": "humidity"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 6,
        "w": 5,
        "x": 10,
        "y": 0
      },
      "id": 12,
      "options": {
        "orientation": "auto",
        "reduceOptions": {
          "calcs": [
            "first"
          ],
          "fields": "",
          "values": false
        },
        "showThresholdLabels": true,
        "showThresholdMarkers": true
      },
      "pluginVersion": "7.1.5",
      "targets": [
        {
          "alias": "",
          "format": "table",
          "rawSql": "SELECT TOP 1\n  InsideRelative AS 'Inside Relative Humidity'\nFROM\n  Hydroponics\nORDER BY\n  ReadingTime DESC",
          "refId": "A"
        }
      ],
      "timeFrom": null,
      "timeShift": null,
      "title": "Inside Relative Humidity",
      "type": "gauge"
    },
    {
      "datasource": null,
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "thresholds"
          },
          "custom": {},
          "decimals": 1,
          "mappings": [],
          "max": 100,
          "min": 0,
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "blue",
                "value": null
              },
              {
                "color": "green",
                "value": 50
              },
              {
                "color": "red",
                "value": 70
              }
            ]
          },
          "unit": "humidity"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 6,
        "w": 5,
        "x": 15,
        "y": 0
      },
      "id": 13,
      "options": {
        "orientation": "auto",
        "reduceOptions": {
          "calcs": [
            "first"
          ],
          "fields": "",
          "values": false
        },
        "showThresholdLabels": true,
        "showThresholdMarkers": true
      },
      "pluginVersion": "7.1.5",
      "targets": [
        {
          "alias": "",
          "format": "table",
          "rawSql": "SELECT TOP 1\n  OutsideRelative AS 'Outside Relative Humidity'\nFROM\n  Hydroponics\nORDER BY\n  ReadingTime DESC",
          "refId": "A"
        }
      ],
      "timeFrom": null,
      "timeShift": null,
      "title": "Outside Relative Humidity",
      "type": "gauge"
    },
    {
      "cacheTimeout": null,
      "datasource": null,
      "fieldConfig": {
        "defaults": {
          "custom": {},
          "decimals": 0,
          "mappings": [
            {
              "id": 0,
              "op": "=",
              "text": "OFF",
              "type": 1,
              "value": "0"
            },
            {
              "id": 1,
              "op": "=",
              "text": "ON",
              "type": 1,
              "value": "1"
            }
          ],
          "nullValueMode": "connected",
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "#73BF69",
                "value": null
              },
              {
                "color": "rgb(255, 255, 255)",
                "value": 0
              },
              {
                "color": "#FADE2A",
                "value": 1
              }
            ]
          },
          "unit": "none"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 2,
        "w": 3,
        "x": 0,
        "y": 6
      },
      "id": 19,
      "interval": null,
      "links": [
        {
          "targetBlank": true,
          "title": "ON for 10 minutes",
          "url": "http://www.mywebsite.com/hydroponics/addrequest.aspx?data={\"OVERRIDE_LIGHTS_TIME\":10,\"OVERRIDE_LIGHTS\":true}"
        },
        {
          "targetBlank": true,
          "title": "OFF for 10 minutes",
          "url": "http://www.mywebsite.com/hydroponics/addrequest.aspx?data={\"OVERRIDE_LIGHTS_TIME\":10,\"OVERRIDE_LIGHTS\":false}"
        }
      ],
      "maxDataPoints": 100,
      "options": {
        "colorMode": "value",
        "graphMode": "none",
        "justifyMode": "auto",
        "orientation": "horizontal",
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "",
          "values": false
        },
        "textMode": "auto"
      },
      "pluginVersion": "7.1.5",
      "targets": [
        {
          "alias": "",
          "format": "table",
          "rawSql": "SELECT TOP 1\n  CAST(Lights AS INT) AS Lights\nFROM\n  Hydroponics\nORDER BY\n  ReadingTime DESC",
          "refId": "A"
        }
      ],
      "timeFrom": null,
      "timeShift": null,
      "title": "Lights",
      "type": "stat"
    },
    {
      "cacheTimeout": null,
      "datasource": null,
      "fieldConfig": {
        "defaults": {
          "custom": {},
          "decimals": 0,
          "mappings": [
            {
              "id": 0,
              "op": "=",
              "text": "OFF",
              "type": 1,
              "value": "0"
            },
            {
              "id": 1,
              "op": "=",
              "text": "ON",
              "type": 1,
              "value": "1"
            }
          ],
          "nullValueMode": "connected",
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "#73BF69",
                "value": null
              },
              {
                "color": "rgb(255, 255, 255)",
                "value": 0
              },
              {
                "color": "#5794F2",
                "value": 1
              }
            ]
          },
          "unit": "none"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 2,
        "w": 3,
        "x": 3,
        "y": 6
      },
      "id": 20,
      "interval": null,
      "links": [
        {
          "targetBlank": true,
          "title": "ON for 10 minutes",
          "url": "http://www.mywebsite.com/hydroponics/addrequest.aspx?data={\"OVERRIDE_VENT_FAN_TIME\":10,\"OVERRIDE_VENT_FAN\":true}"
        },
        {
          "targetBlank": true,
          "title": "OFF for 10 minutes",
          "url": "http://www.mywebsite.com/hydroponics/addrequest.aspx?data={\"OVERRIDE_VENT_FAN_TIME\":10,\"OVERRIDE_VENT_FAN\":false}"
        }
      ],
      "maxDataPoints": 100,
      "options": {
        "colorMode": "value",
        "graphMode": "none",
        "justifyMode": "auto",
        "orientation": "horizontal",
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "",
          "values": false
        },
        "textMode": "auto"
      },
      "pluginVersion": "7.1.5",
      "targets": [
        {
          "alias": "",
          "format": "table",
          "rawSql": "SELECT TOP 1\n  CAST(VentFan AS INT) AS 'Vent Fan'\nFROM\n  Hydroponics\nORDER BY\n  ReadingTime DESC",
          "refId": "A"
        }
      ],
      "timeFrom": null,
      "timeShift": null,
      "title": "Vent Fan",
      "type": "stat"
    },
    {
      "cacheTimeout": null,
      "datasource": null,
      "fieldConfig": {
        "defaults": {
          "custom": {},
          "decimals": 0,
          "mappings": [],
          "nullValueMode": "connected",
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "red",
                "value": null
              }
            ]
          },
          "unit": "watt"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 2,
        "w": 3,
        "x": 6,
        "y": 6
      },
      "id": 21,
      "interval": null,
      "links": [],
      "maxDataPoints": 100,
      "options": {
        "colorMode": "value",
        "graphMode": "none",
        "justifyMode": "auto",
        "orientation": "horizontal",
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "",
          "values": false
        },
        "textMode": "auto"
      },
      "pluginVersion": "7.1.5",
      "targets": [
        {
          "alias": "",
          "format": "table",
          "rawSql": "SELECT TOP 1\n  Power\nFROM\n  Hydroponics\nORDER BY\n  ReadingTime DESC",
          "refId": "A"
        }
      ],
      "timeFrom": null,
      "timeShift": null,
      "title": "Power",
      "type": "stat"
    },
    {
      "cacheTimeout": null,
      "datasource": null,
      "fieldConfig": {
        "defaults": {
          "custom": {},
          "decimals": 2,
          "mappings": [],
          "nullValueMode": "connected",
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              }
            ]
          },
          "unit": "currencyUSD"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 2,
        "w": 3,
        "x": 9,
        "y": 6
      },
      "id": 22,
      "interval": null,
      "links": [],
      "maxDataPoints": 100,
      "options": {
        "colorMode": "value",
        "graphMode": "none",
        "justifyMode": "auto",
        "orientation": "horizontal",
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "",
          "values": false
        },
        "textMode": "auto"
      },
      "pluginVersion": "7.1.5",
      "targets": [
        {
          "alias": "",
          "format": "table",
          "rawSql": "SELECT TOP 1\n  DailyCost\nFROM\n  Hydroponics\nORDER BY\n  ReadingTime DESC",
          "refId": "A"
        }
      ],
      "timeFrom": null,
      "timeShift": null,
      "title": "Daily Cost",
      "type": "stat"
    },
    {
      "datasource": null,
      "fieldConfig": {
        "defaults": {
          "custom": {},
          "decimals": 1,
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "blue",
                "value": null
              }
            ]
          }
        },
        "overrides": []
      },
      "gridPos": {
        "h": 2,
        "w": 2,
        "x": 12,
        "y": 6
      },
      "id": 36,
      "options": {
        "colorMode": "value",
        "graphMode": "area",
        "justifyMode": "auto",
        "orientation": "auto",
        "reduceOptions": {
          "calcs": [
            "mean"
          ],
          "fields": "",
          "values": false
        },
        "textMode": "auto"
      },
      "pluginVersion": "7.1.5",
      "targets": [
        {
          "alias": "",
          "format": "table",
          "rawSql": "SELECT TOP 1\n  pH\nFROM\n  Hydroponics\nORDER BY\n  ReadingTime DESC",
          "refId": "A"
        }
      ],
      "timeFrom": null,
      "timeShift": null,
      "title": "pH",
      "type": "stat"
    },
    {
      "datasource": null,
      "description": "",
      "fieldConfig": {
        "defaults": {
          "custom": {},
          "decimals": 1,
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "yellow",
                "value": null
              }
            ]
          },
          "unit": "none"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 2,
        "w": 2,
        "x": 14,
        "y": 6
      },
      "id": 37,
      "options": {
        "colorMode": "value",
        "graphMode": "area",
        "justifyMode": "center",
        "orientation": "auto",
        "reduceOptions": {
          "calcs": [
            "mean"
          ],
          "fields": "",
          "values": false
        },
        "textMode": "auto"
      },
      "pluginVersion": "7.1.5",
      "targets": [
        {
          "alias": "",
          "format": "table",
          "rawSql": "SELECT TOP 1\n  DO\nFROM\n  Hydroponics\nORDER BY\n  ReadingTime DESC",
          "refId": "A"
        }
      ],
      "timeFrom": null,
      "timeShift": null,
      "title": "DO",
      "type": "stat"
    },
    {
      "cacheTimeout": null,
      "datasource": null,
      "fieldConfig": {
        "defaults": {
          "custom": {},
          "decimals": 0,
          "mappings": [],
          "nullValueMode": "connected",
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "purple",
                "value": null
              }
            ]
          },
          "unit": "ppm"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 2,
        "w": 3,
        "x": 16,
        "y": 6
      },
      "id": 23,
      "interval": null,
      "links": [],
      "maxDataPoints": 100,
      "options": {
        "colorMode": "value",
        "graphMode": "none",
        "justifyMode": "auto",
        "orientation": "horizontal",
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "",
          "values": false
        },
        "textMode": "auto"
      },
      "pluginVersion": "7.1.5",
      "targets": [
        {
          "alias": "",
          "format": "table",
          "rawSql": "SELECT TOP 1\n  CO2\nFROM\n  Hydroponics\nORDER BY\n  ReadingTime DESC",
          "refId": "A"
        }
      ],
      "timeFrom": null,
      "timeShift": null,
      "title": "CO2",
      "type": "stat"
    },
    {
      "cacheTimeout": null,
      "datasource": null,
      "fieldConfig": {
        "defaults": {
          "custom": {},
          "decimals": 0,
          "mappings": [],
          "nullValueMode": "connected",
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              }
            ]
          },
          "unit": "kelvin"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 2,
        "w": 4,
        "x": 19,
        "y": 6
      },
      "id": 27,
      "interval": null,
      "links": [],
      "maxDataPoints": 100,
      "options": {
        "colorMode": "value",
        "graphMode": "none",
        "justifyMode": "auto",
        "orientation": "horizontal",
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "",
          "values": true
        },
        "textMode": "auto"
      },
      "pluginVersion": "7.1.5",
      "targets": [
        {
          "alias": "",
          "format": "table",
          "rawSql": "SELECT TOP 1\n  ColorTemp\nFROM\n  Hydroponics\nORDER BY\n  ReadingTime DESC",
          "refId": "A"
        }
      ],
      "timeFrom": null,
      "timeShift": null,
      "title": "Color Temperature",
      "type": "stat"
    },
    {
      "aliasColors": {},
      "bars": false,
      "dashLength": 10,
      "dashes": false,
      "datasource": null,
      "decimals": 1,
      "description": "Inside/Outside Temperature",
      "fieldConfig": {
        "defaults": {
          "custom": {},
          "links": []
        },
        "overrides": []
      },
      "fill": 1,
      "fillGradient": 0,
      "gridPos": {
        "h": 16,
        "w": 24,
        "x": 0,
        "y": 8
      },
      "hiddenSeries": false,
      "id": 2,
      "legend": {
        "alignAsTable": true,
        "avg": true,
        "current": true,
        "max": true,
        "min": true,
        "show": true,
        "total": false,
        "values": true
      },
      "lines": true,
      "linewidth": 2,
      "nullPointMode": "null",
      "percentage": false,
      "pluginVersion": "7.1.5",
      "pointradius": 2,
      "points": false,
      "renderer": "flot",
      "seriesOverrides": [
        {
          "alias": "Inside Temperature",
          "fill": 0,
          "yaxis": 1
        },
        {
          "alias": "Outside Temperature",
          "fill": 0,
          "yaxis": 1
        },
        {
          "alias": "Inside Relative Humidity",
          "yaxis": 2
        },
        {
          "alias": "Outside Relative Humidity",
          "yaxis": 2
        }
      ],
      "spaceLength": 10,
      "stack": false,
      "steppedLine": false,
      "targets": [
        {
          "alias": "",
          "format": "time_series",
          "rawSql": "SELECT\n  $__timeEpoch(ReadingTime),\n  ((InsideTemp*1.8)+32) AS 'Inside Temperature',\n  ((OutsideTemp*1.8)+32) AS 'Outside Temperature',\n  InsideRelative AS 'Inside Relative Humidity',\n  OutsideRelative AS 'Outside Relative Humidity'\nFROM\n  Hydroponics\nWHERE\n  $__timeFilter(ReadingTime)\nORDER BY\n  ReadingTime ASC",
          "refId": "A"
        }
      ],
      "thresholds": [
        {
          "colorMode": "custom",
          "fill": false,
          "fillColor": "rgba(50, 116, 217, 0.2)",
          "line": true,
          "lineColor": "rgba(31, 96, 196, 0.6)",
          "op": "gt",
          "value": 60,
          "yaxis": "left"
        },
        {
          "colorMode": "critical",
          "fill": false,
          "line": true,
          "op": "gt",
          "value": 80,
          "yaxis": "left"
        },
        {
          "colorMode": "custom",
          "fill": false,
          "fillColor": "rgba(50, 116, 217, 0.2)",
          "line": true,
          "lineColor": "rgba(31, 96, 196, 0.6)",
          "op": "gt",
          "value": 50,
          "yaxis": "right"
        },
        {
          "colorMode": "critical",
          "fill": false,
          "line": true,
          "op": "gt",
          "value": 70,
          "yaxis": "right"
        }
      ],
      "timeFrom": null,
      "timeRegions": [
        {
          "colorMode": "gray",
          "fill": true,
          "fillColor": "rgba(234, 112, 112, 0.12)",
          "from": "10:00",
          "line": false,
          "lineColor": "rgba(237, 46, 24, 0.60)",
          "op": "time",
          "to": "22:00"
        }
      ],
      "timeShift": null,
      "title": "Temperature/Relative Humidity",
      "tooltip": {
        "shared": true,
        "sort": 0,
        "value_type": "individual"
      },
      "type": "graph",
      "xaxis": {
        "buckets": null,
        "mode": "time",
        "name": null,
        "show": true,
        "values": []
      },
      "yaxes": [
        {
          "format": "fahrenheit",
          "label": "",
          "logBase": 1,
          "max": "90",
          "min": "10",
          "show": true
        },
        {
          "decimals": null,
          "format": "humidity",
          "label": null,
          "logBase": 1,
          "max": "180",
          "min": "20",
          "show": true
        }
      ],
      "yaxis": {
        "align": false,
        "alignLevel": null
      }
    },
    {
      "aliasColors": {
        "Inside Absolute": "#6ed0e0",
        "Outside Absolute": "#ef843c"
      },
      "bars": false,
      "dashLength": 10,
      "dashes": false,
      "datasource": null,
      "fieldConfig": {
        "defaults": {
          "custom": {},
          "links": []
...

This file has been truncated, please download it to see its full contents.

Http Post

C/C++
REST API to post Hydroponics Data
void HttpPost(const char *url, String &post_data)
{
  HTTPClient http;
  http.begin(url);
  http.addHeader("Content-Type", "application/x-www-form-urlencoded");
 
  int http_code = http.POST(post_data);   // Send the request
  String payload = http.getString();      // Get the response payload
 
  SerialDebug.println(http_code);         // Print HTTP return code
  SerialDebug.println(payload);           // Print request response payload
 
  if (payload.length() > 0) {
    int index = 0;
    do
    {
      if (index > 0) index++;
      int next = payload.indexOf('\n', index);
      if (next == -1) break;
      String request = payload.substring(index, next);
      if (request.substring(0, 9).equals("<!DOCTYPE")) break;
 
      SerialDebug.println(request);
      StaticJsonDocument<100> doc;
      DeserializationError error = deserializeJson(doc, request);
      if (!error) {
        if (doc["OVERRIDE_LIGHTS_TIME"])   OVERRIDE_LIGHTS_TIME = doc["OVERRIDE_LIGHTS_TIME"];
        if (doc["OVERRIDE_LIGHTS"])        OVERRIDE_LIGHTS = doc["OVERRIDE_LIGHTS"];
        if (doc["OVERRIDE_VENT_FAN_TIME"]) OVERRIDE_VENT_FAN_TIME = doc["OVERRIDE_VENT_FAN_TIME"];
        if (doc["OVERRIDE_VENT_FAN"])      OVERRIDE_VENT_FAN = doc["OVERRIDE_VENT_FAN"];
      }
      index = next;
    } while (index >= 0);
  }
 
  http.end();                             // Close connection
}
 
...
 
void loop() {
 
...
 
        char buffer[80];
        strftime(buffer, sizeof(buffer), "%m/%d/%Y %H:%M:%S", &rtc);
 
        // Allocate JsonDocument
        // Use arduinojson.org/assistant to compute the capacity
        StaticJsonDocument<500> doc;
 
        // Create the root object
        doc["ReadingTime"] = buffer;
        doc["InsideTemp"] = (inside.error) ? ERROR_READ : inside.temp;
        doc["InsideRelative"] = (inside.error) ? ERROR_READ : inside.relative;
        doc["InsideAbsolute"] = (inside.error) ? ERROR_READ : inside.absolute;
        doc["OutsideTemp"] = (outside.error) ? ERROR_READ : outside.temp;
        doc["OutsideRelative"] = (outside.error) ? ERROR_READ : outside.relative;
        doc["OutsideAbsolute"] = (outside.error) ? ERROR_READ : outside.absolute;
        doc["VentFan"] = vent_fan;
        doc["Lights"] = lights;
        doc["Power"] = power;
        doc["DailyCost"] = cost;
        doc["ColorTemp"] = color_temp;
        doc["Lux"] = lux;
        doc["CO2"] = co2;
        doc["CO2Temp"] = co2_temp;
        doc["CO2Relative"] = co2_relative;
        doc["GerminationTemp"] = germination_temp;
        doc["ChillerTemp"] = chiller_temp;
        doc["pH"] = pH;
        doc["DO"] = DO;
        JsonArray array = doc.createNestedArray("GrowBed");
        for (i = 0; i < sizeof(grow_bed_table) / sizeof(GROWBED_t); i++) {
          JsonObject object = array.createNestedObject();
          object["WaterTemp"] = (grow_bed_table[i].water_temp_error) ? ERROR_READ : grow_bed_table[i].water_temp;
          object["WaterTDS"] = grow_bed_table[i].water_tds;
          object["WaterLevel"] = grow_bed_table[i].water_level;
        }
        String json_data;
        serializeJson(doc, json_data);
        post_data = "data=" json_data;
        SerialDebug.println(post_data);
 
#ifdef MySQL
        HttpPost(mysql_url, post_data);
#endif
#ifdef MSSQL
        HttpPost(mssql_url, post_data);
#endif
 
...
 
}

MySQL Grafana JSON

JSON
MySQL Grafana JSON code for the Hydroponics Dashboard
{
  "annotations": {
    "list": [
      {
        "builtIn": 1,
        "datasource": "-- Grafana --",
        "enable": true,
        "hide": true,
        "iconColor": "rgba(0, 211, 255, 1)",
        "name": "Annotations & Alerts",
        "type": "dashboard"
      }
    ]
  },
  "description": "Garage Hydroponics",
  "editable": true,
  "gnetId": null,
  "graphTooltip": 0,
  "id": 1,
  "links": [],
  "panels": [
    {
      "datasource": null,
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "thresholds"
          },
          "custom": {},
          "decimals": 1,
          "mappings": [],
          "max": 100,
          "min": 0,
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "blue",
                "value": null
              },
              {
                "color": "green",
                "value": 60
              },
              {
                "color": "red",
                "value": 80
              }
            ]
          },
          "unit": "fahrenheit"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 6,
        "w": 5,
        "x": 0,
        "y": 0
      },
      "id": 10,
      "options": {
        "orientation": "auto",
        "reduceOptions": {
          "calcs": [
            "first"
          ],
          "fields": "",
          "values": false
        },
        "showThresholdLabels": true,
        "showThresholdMarkers": true
      },
      "pluginVersion": "7.1.0",
      "targets": [
        {
          "alias": "",
          "format": "table",
          "group": [],
          "metricColumn": "none",
          "rawQuery": true,
          "rawSql": "SELECT\n  ((InsideTemp*1.8)+32) AS 'Inside Temperature'\nFROM\n  Hydroponics\nORDER BY\n  ReadingTime DESC\nLIMIT 1",
          "refId": "A",
          "select": [
            [
              {
                "params": [
                  "value"
                ],
                "type": "column"
              }
            ]
          ],
          "timeColumn": "time",
          "where": [
            {
              "name": "$__timeFilter",
              "params": [],
              "type": "macro"
            }
          ]
        }
      ],
      "timeFrom": null,
      "timeShift": null,
      "title": "Inside Temperature",
      "type": "gauge"
    },
    {
      "datasource": null,
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "thresholds"
          },
          "custom": {},
          "decimals": 1,
          "mappings": [],
          "max": 100,
          "min": 0,
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "blue",
                "value": null
              },
              {
                "color": "green",
                "value": 60
              },
              {
                "color": "red",
                "value": 80
              }
            ]
          },
          "unit": "fahrenheit"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 6,
        "w": 5,
        "x": 5,
        "y": 0
      },
      "id": 11,
      "options": {
        "orientation": "auto",
        "reduceOptions": {
          "calcs": [
            "first"
          ],
          "fields": "",
          "values": false
        },
        "showThresholdLabels": true,
        "showThresholdMarkers": true
      },
      "pluginVersion": "7.1.0",
      "targets": [
        {
          "alias": "",
          "format": "table",
          "group": [],
          "metricColumn": "none",
          "rawQuery": true,
          "rawSql": "SELECT \n  ((OutsideTemp*1.8)+32) AS 'Outside Temperature'\nFROM\n  Hydroponics\nORDER BY\n  ReadingTime DESC\nLIMIT 1  ",
          "refId": "A",
          "select": [
            [
              {
                "params": [
                  "value"
                ],
                "type": "column"
              }
            ]
          ],
          "timeColumn": "time",
          "where": [
            {
              "name": "$__timeFilter",
              "params": [],
              "type": "macro"
            }
          ]
        }
      ],
      "timeFrom": null,
      "timeShift": null,
      "title": "Outside Temperature",
      "type": "gauge"
    },
    {
      "datasource": null,
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "thresholds"
          },
          "custom": {},
          "decimals": 1,
          "mappings": [],
          "max": 100,
          "min": 0,
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "blue",
                "value": null
              },
              {
                "color": "green",
                "value": 50
              },
              {
                "color": "red",
                "value": 70
              }
            ]
          },
          "unit": "humidity"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 6,
        "w": 5,
        "x": 10,
        "y": 0
      },
      "id": 12,
      "options": {
        "orientation": "auto",
        "reduceOptions": {
          "calcs": [
            "first"
          ],
          "fields": "",
          "values": false
        },
        "showThresholdLabels": true,
        "showThresholdMarkers": true
      },
      "pluginVersion": "7.1.0",
      "targets": [
        {
          "alias": "",
          "format": "table",
          "group": [],
          "metricColumn": "none",
          "rawQuery": true,
          "rawSql": "SELECT \n  InsideRelative AS 'Inside Relative Humidity'\nFROM\n  Hydroponics\nORDER BY\n  ReadingTime DESC\nLIMIT 1  ",
          "refId": "A",
          "select": [
            [
              {
                "params": [
                  "value"
                ],
                "type": "column"
              }
            ]
          ],
          "timeColumn": "time",
          "where": [
            {
              "name": "$__timeFilter",
              "params": [],
              "type": "macro"
            }
          ]
        }
      ],
      "timeFrom": null,
      "timeShift": null,
      "title": "Inside Relative Humidity",
      "type": "gauge"
    },
    {
      "datasource": null,
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "thresholds"
          },
          "custom": {},
          "decimals": 1,
          "mappings": [],
          "max": 100,
          "min": 0,
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "blue",
                "value": null
              },
              {
                "color": "green",
                "value": 50
              },
              {
                "color": "red",
                "value": 70
              }
            ]
          },
          "unit": "humidity"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 6,
        "w": 5,
        "x": 15,
        "y": 0
      },
      "id": 13,
      "options": {
        "orientation": "auto",
        "reduceOptions": {
          "calcs": [
            "first"
          ],
          "fields": "",
          "values": false
        },
        "showThresholdLabels": true,
        "showThresholdMarkers": true
      },
      "pluginVersion": "7.1.0",
      "targets": [
        {
          "alias": "",
          "format": "table",
          "group": [],
          "metricColumn": "none",
          "rawQuery": true,
          "rawSql": "SELECT\n  OutsideRelative AS 'Outside Relative Humidity'\nFROM\n  Hydroponics\nORDER BY\n  ReadingTime DESC\nLIMIT 1  ",
          "refId": "A",
          "select": [
            [
              {
                "params": [
                  "value"
                ],
                "type": "column"
              }
            ]
          ],
          "timeColumn": "time",
          "where": [
            {
              "name": "$__timeFilter",
              "params": [],
              "type": "macro"
            }
          ]
        }
      ],
      "timeFrom": null,
      "timeShift": null,
      "title": "Outside Relative Humidity",
      "type": "gauge"
    },
    {
      "cacheTimeout": null,
      "datasource": null,
      "fieldConfig": {
        "defaults": {
          "custom": {},
          "decimals": 0,
          "mappings": [
            {
              "id": 0,
              "op": "=",
              "text": "OFF",
              "type": 1,
              "value": "0"
            },
            {
              "id": 1,
              "op": "=",
              "text": "ON",
              "type": 1,
              "value": "1"
            }
          ],
          "nullValueMode": "connected",
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "#73BF69",
                "value": null
              },
              {
                "color": "rgb(255, 255, 255)",
                "value": 0
              },
              {
                "color": "#FADE2A",
                "value": 1
              }
            ]
          },
          "unit": "none"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 2,
        "w": 3,
        "x": 0,
        "y": 6
      },
      "id": 19,
      "interval": null,
      "links": [
        {
          "targetBlank": true,
          "title": "ON for 10 minutes",
          "url": "http://192.168.1.50/hydroponics/addrequest.php?data={\"OVERRIDE_LIGHTS_TIME\":10,\"OVERRIDE_LIGHTS\":true}"
        },
        {
          "targetBlank": true,
          "title": "OFF for 10 minutes",
          "url": "http://192.168.1.50/hydroponics/addrequest.php?data={\"OVERRIDE_LIGHTS_TIME\":10,\"OVERRIDE_LIGHTS\":false}"
        }
      ],
      "maxDataPoints": 100,
      "options": {
        "colorMode": "value",
        "graphMode": "none",
        "justifyMode": "auto",
        "orientation": "horizontal",
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "",
          "values": false
        },
        "textMode": "auto"
      },
      "pluginVersion": "7.1.0",
      "targets": [
        {
          "alias": "",
          "format": "table",
          "group": [],
          "metricColumn": "none",
          "rawQuery": true,
          "rawSql": "SELECT \n  CAST(Lights AS INT) AS Lights\nFROM\n  Hydroponics\nORDER BY\n  ReadingTime DESC\nLIMIT 1  ",
          "refId": "A",
          "select": [
            [
              {
                "params": [
                  "value"
                ],
                "type": "column"
              }
            ]
          ],
          "timeColumn": "time",
          "where": [
            {
              "name": "$__timeFilter",
              "params": [],
              "type": "macro"
            }
          ]
        }
      ],
      "timeFrom": null,
      "timeShift": null,
      "title": "Lights",
      "type": "stat"
    },
    {
      "cacheTimeout": null,
      "datasource": null,
      "fieldConfig": {
        "defaults": {
          "custom": {},
          "decimals": 0,
          "mappings": [
            {
              "id": 0,
              "op": "=",
              "text": "OFF",
              "type": 1,
              "value": "0"
            },
            {
              "id": 1,
              "op": "=",
              "text": "ON",
              "type": 1,
              "value": "1"
            }
          ],
          "nullValueMode": "connected",
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "#73BF69",
                "value": null
              },
              {
                "color": "rgb(255, 255, 255)",
                "value": 0
              },
              {
                "color": "#5794F2",
                "value": 1
              }
            ]
          },
          "unit": "none"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 2,
        "w": 3,
        "x": 3,
        "y": 6
      },
      "id": 20,
      "interval": null,
      "links": [
        {
          "targetBlank": true,
          "title": "ON for 10 minutes",
          "url": "http://192.168.1.50/hydroponics/addrequest.aspx?data={\"OVERRIDE_VENT_FAN_TIME\":10,\"OVERRIDE_VENT_FAN\":true}"
        },
        {
          "targetBlank": true,
          "title": "OFF for 10 minutes",
          "url": "http://192.168.1.50/hydroponics/addrequest.aspx?data={\"OVERRIDE_VENT_FAN_TIME\":10,\"OVERRIDE_VENT_FAN\":false}"
        }
      ],
      "maxDataPoints": 100,
      "options": {
        "colorMode": "value",
        "graphMode": "none",
        "justifyMode": "auto",
        "orientation": "horizontal",
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "",
          "values": false
        },
        "textMode": "auto"
      },
      "pluginVersion": "7.1.0",
      "targets": [
        {
          "alias": "",
          "format": "table",
          "group": [],
          "metricColumn": "none",
          "rawQuery": true,
          "rawSql": "SELECT \n  CAST(VentFan AS INT) AS 'Vent Fan'\nFROM\n  Hydroponics\nORDER BY\n  ReadingTime DESC\nLIMIT 1  ",
          "refId": "A",
          "select": [
            [
              {
                "params": [
                  "value"
                ],
                "type": "column"
              }
            ]
          ],
          "timeColumn": "time",
          "where": [
            {
              "name": "$__timeFilter",
              "params": [],
              "type": "macro"
            }
          ]
        }
      ],
      "timeFrom": null,
      "timeShift": null,
      "title": "Vent Fan",
      "type": "stat"
    },
    {
      "cacheTimeout": null,
      "datasource": null,
      "fieldConfig": {
        "defaults": {
          "custom": {},
          "decimals": 0,
          "mappings": [],
          "nullValueMode": "connected",
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "red",
                "value": null
              }
            ]
          },
          "unit": "watt"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 2,
        "w": 3,
        "x": 6,
        "y": 6
      },
      "id": 21,
      "interval": null,
      "links": [],
      "maxDataPoints": 100,
      "options": {
        "colorMode": "value",
        "graphMode": "none",
        "justifyMode": "auto",
        "orientation": "horizontal",
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "",
          "values": false
        },
        "textMode": "auto"
      },
      "pluginVersion": "7.1.0",
      "targets": [
        {
          "alias": "",
          "format": "table",
          "group": [],
          "metricColumn": "none",
          "rawQuery": true,
          "rawSql": "SELECT \n  Power\nFROM\n  Hydroponics\nORDER BY\n  ReadingTime DESC\nLIMIT 1  ",
          "refId": "A",
          "select": [
            [
              {
                "params": [
                  "value"
                ],
                "type": "column"
              }
            ]
          ],
          "timeColumn": "time",
          "where": [
            {
              "name": "$__timeFilter",
              "params": [],
              "type": "macro"
            }
          ]
        }
      ],
      "timeFrom": null,
      "timeShift": null,
      "title": "Power",
      "type": "stat"
    },
    {
      "cacheTimeout": null,
      "datasource": null,
      "fieldConfig": {
        "defaults": {
          "custom": {},
          "decimals": 2,
          "mappings": [],
          "nullValueMode": "connected",
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "green",
                "value": 80
              }
            ]
          },
          "unit": "currencyUSD"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 2,
        "w": 3,
        "x": 9,
        "y": 6
      },
      "id": 22,
      "interval": null,
      "links": [],
      "maxDataPoints": 100,
      "options": {
        "colorMode": "value",
        "graphMode": "none",
        "justifyMode": "auto",
        "orientation": "horizontal",
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "",
          "values": false
        },
        "textMode": "auto"
      },
      "pluginVersion": "7.1.0",
      "targets": [
        {
          "alias": "",
          "format": "table",
          "group": [],
          "metricColumn": "none",
          "rawQuery": true,
          "rawSql": "SELECT \n  DailyCost\nFROM\n  Hydroponics\nORDER BY\n  ReadingTime DESC\nLIMIT 1  ",
          "refId": "A",
          "select": [
            [
              {
                "params": [
                  "value"
                ],
                "type": "column"
              }
            ]
          ],
          "timeColumn": "time",
          "where": [
            {
              "name": "$__timeFilter",
              "params": [],
              "type": "macro"
            }
          ]
        }
      ],
      "timeFrom": null,
      "timeShift": null,
      "title": "Daily Cost",
      "type": "stat"
    },
    {
      "cacheTimeout": null,
      "datasource": null,
      "fieldConfig": {
        "defaults": {
          "custom": {},
          "decimals": 1,
          "mappings": [],
          "nullValueMode": "connected",
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "blue",
                "value": null
              }
            ]
          },
          "unit": "none"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 2,
        "w": 2,
        "x": 12,
        "y": 6
      },
      "id": 23,
      "interval": null,
      "links": [],
      "maxDataPoints": 100,
      "options": {
        "colorMode": "value",
        "graphMode": "none",
        "justifyMode": "auto",
        "orientation": "horizontal",
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "",
          "values": false
        },
        "textMode": "auto"
      },
      "pluginVersion": "7.1.0",
      "targets": [
        {
          "alias": "",
          "format": "table",
          "group": [],
          "metricColumn": "none",
          "rawQuery": true,
          "rawSql": "SELECT\n  pH\nFROM\n  Hydroponics\nORDER BY\n  ReadingTime DESC\nLIMIT 1  ",
          "refId": "A",
          "select": [
            [
              {
                "params": [
                  "value"
                ],
                "type": "column"
              }
            ]
          ],
          "timeColumn": "time",
          "where": [
            {
              "name": "$__timeFilter",
              "params": [],
              "type": "macro"
            }
          ]
        }
      ],
      "timeFrom": null,
      "timeShift": null,
      "title": "pH",
      "type": "stat"
    },
    {
      "cacheTimeout": null,
      "datasource": null,
      "fieldConfig": {
        "defaults": {
          "custom": {},
          "decimals": 1,
          "mappings": [],
          "nullValueMode": "connected",
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "yellow",
                "value": null
              }
            ]
          },
          "unit": "none"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 2,
        "w": 2,
        "x": 14,
        "y": 6
      },
      "id": 31,
      "interval": null,
      "links": [],
      "maxDataPoints": 100,
      "options": {
        "colorMode": "value",
        "graphMode": "none",
        "justifyMode": "auto",
        "orientation": "horizontal",
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "",
          "values": false
        },
        "textMode": "auto"
      },
      "pluginVersion": "7.1.0",
      "targets": [
        {
          "alias": "",
          "format": "table",
          "group": [],
          "metricColumn": "none",
          "rawQuery": true,
          "rawSql": "SELECT\n  DO\nFROM\n  Hydroponics\nORDER BY\n  ReadingTime DESC\nLIMIT 1  ",
          "refId": "A",
          "select": [
            [
              {
                "params": [
                  "value"
                ],
                "type": "column"
              }
            ]
          ],
          "timeColumn": "time",
          "where": [
            {
              "name": "$__timeFilter",
              "params": [],
              "type": "macro"
            }
          ]
        }
      ],
      "timeFrom": null,
      "timeShift": null,
      "title": "DO",
      "type": "stat"
    },
    {
      "cacheTimeout": null,
      "datasource": null,
      "fieldConfig": {
        "defaults": {
          "custom": {},
          "decimals": 0,
          "mappings": [],
          "nullValueMode": "connected",
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "purple",
                "value": null
              }
            ]
          },
          "unit": "ppm"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 2,
        "w": 3,
        "x": 16,
        "y": 6
      },
      "id": 32,
      "interval": null,
      "links": [],
      "maxDataPoints": 100,
      "options": {
        "colorMode": "value",
        "graphMode": "none",
        "justifyMode": "auto",
        "orientation": "horizontal",
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "",
          "values": false
        },
        "textMode": "auto"
      },
      "pluginVersion": "7.1.0",
      "targets": [
        {
          "alias": "",
          "format": "table",
          "group": [],
          "metricColumn": "none",
          "rawQuery": true,
          "rawSql": "SELECT\n  CO2\nFROM\n  Hydroponics\nORDER BY\n  ReadingTime DESC\nLIMIT 1  ",
          "refId": "A",
          "select": [
            [
              {
                "params": [
                  "value"
                ],
                "type": "column"
              }
            ]
          ],
          "timeColumn": "time",
          "where": [
            {
              "name": "$__timeFilter",
              "params": [],
              "type": "macro"
            }
...

This file has been truncated, please download it to see its full contents.

Credits

Christian
24 projects • 135 followers
Senior Embedded Engineer
Contact

Comments

Please log in or sign up to comment.