Development

Thoughts:
1. Use netcat to transfer config fies quickly to from Branch to Root boxes and vice versa Left for posterity. Info will be passed via API now.

 Videos

                 

 Pictures

Database Planning:

 Click here to expand...
Collection: System
{
	"_id" : <auto gen>

}
Collection: Container
/*
Notes:
- Do I want to see the overall temp for each container? This could be stored 
somewhere else and this collection is only for reading. I can calculate this 
based on sensor data from all the branches in that container. 
- All calculations will be done using the metric system. 

*/
{
  "creationDate" : "stored in time since epoch",
  "containerId" : "container-<random string>",
  "name" : "",
  "description" : "",
  "notes" : "<may store HTML code that will be displayed when queried>",
  "log" : "<a list of events that have been entered....should this be an array
          or a huge glob of data?>" <--array would be cleaner,
  "dimensions" : "container/box/shed/etc in cubic ft/meters",
  "physicalLocation" : "",
  "size" : "<text entry (40ft container/customer box 5ftx5ftx2ft/etc)>",
  "cropType" : ["kale", "sprouts", "lemon grass"],
  "devices" : {
    "branch" : [branchId-<random>, branchId-<random>],
    "stem" : [stemId-<random>, stemId-<random>],
    "flower" : [flowerId-<random>]
  } 
}
Collection: Branch
/*
Notes:
- Sensors all should have their own unique ID that is hard coded in them. Also
one will be applied to them as well. 
- under db.branch.sensors.leaf-id - The leaf id will be its UID because I dont
trust that the sensors will always have a different hardwareId....we will see.

*/
{
  "creationDate" : "stored in time since epoch",
  "branchId" : "branch-<random string>",
  "containerId" : "container-<random string>",
  "networkSwitch" : "container-xSw0",
  "networkSwitchPort" : "Gi0/1",
  "ipAddressV4" : "",
  "ipAddressV6" : "",
  "operatingSystem" : "",
  "hardware" : "raspberry pi/etc",
  "status" : "<active/inactive>" maybe based this off last data collection may
              not even use it and just use last check in then the UI"s logic
              determines if it is an issue...ehhh a later improvement. ,
  "lastWrite" : "time in epoch",
  "name" : "",
  "description" : "",
  "notes" : "<may store HTML code that will be displayed when queried>",
  "log" : "<a list of events that have been entered....should this be an array
          or a huge glob of data?>" <--array would be cleaner and easier to 
          query using pagination.,
  "physicalLocation" : "",
  "sensors" : {
    "leaf-<random string>" : {
      "hardwareId" : "28-011830a09cf2",
      "type" : <temperature/moisture/humidity>,
      "model" : "DHT22",
      "notes" : "? might not need. but we will see."
  },
  "powerSource" : "PoE/Power Adapter",
  "battery" : "true/false",
  "speaker" : "true/false",
  "fans" : "true/false"
}
Collection: Stem
/*
Notes:
- How to count the amount of subdocuments. Might be the $size operator.
https://docs.mongodb.com/manual/reference/operator/aggregation/size/index.html

*/
{
  "creation_date" : "stored in time since epoch",
  "stemId" : "stem-<random string>",
  "containerId" : "container-<random string>",
  "networkSwitch" : "container-xSw0",
  "networkSwitch_port" : "Gi0/1",
  "ipAddressV4" : "",
  "ipAddressV6" : "",
  "operatingSystem" : "",
  "hardware" : "raspberry pi/etc",
  "status" : "<active/inactive> maybe based this off last data collection may not even use it and just use last check in then the UIs logic determines if it is an issue...ehhh a later improvement.",
  "lastWrite" : "time in epoch",
  "name" : "",
  "description" : "",
  "notes" : "<may store HTML code that will be displayed when queried>",
  "log" : "<a list of events that have been entered....should this be an array or a huge glob of data?> <--array would be cleaner and easier to query using pagination.",
  "physicalLocation" : "",
  "sensors" : {
    "leaf-<random string>" : {
      "hardwareId" : "28-011830a09cf2",
      "type" : "<temperature/moisture/humidity>",
      "model" : "DHT22",
      "notes" : "? might not need. but we will see."
	 }
 },
  "relay" : {
    "1" : {
      "gpioNumber" : 5,
      "gpioPin" : 29,
      "connected_device" : "<intake fan>"
    },
    "2" : {
      "gpioNumber" : 6,
      "gpioPin" : 31,
      "connected_device" : "<exhaust fan>"
    },
    "3" : {
      "gpioNumber" : 12,
      "gpioPin" : 32,
      "connected_device" : "<light column1_row0_etc/water pump 2/heater 3>"
    }
  },
  "powerSource" : "PoE/Power Adapter",
  "battery" : "true/false",
  "speaker" : "true/false",
  "fans" : "true/false"
}
Collection: Flower
{
	"_id" : "<auto gen>"
}
Collection: Tasks
{
	"_id" : <auto gen>
}
Collection: Sensor Data
{
	"_id" : "<auto gen>"
    "deviceId" : "from device config file",
    "containerId" : "from device config file",
	"sensorId" : "<sensor unique serial or ID>",
	"sensorDesc" : "Name or short description of sensor - Tray 1A Soil Temp"
    "readingType" : "<temperature/humidity/moisture/waterlevel/gas/airpressur/rain/motion/waterflow>",
    "readingRaw" : "parsed from /sys/bus/w1/devices/<sensor serial or ID>",
	"timeStamp" : "generated by the server upon entry in epoch"
}

Sensors: https://tutorials-raspberrypi.com/raspberry-pi-sensors-overview-50-important-components/
Collection: Notifications
{
	"_id" : <auto gen>
}

Login Flow:


Task Flow:


Flower:

 Images