joshbaird / MoistureSensingSprinkler

2 stars 0 forks source link

Decide JSON object structure #1

Closed joshbaird closed 9 years ago

joshbaird commented 9 years ago

Need to come up with the params and fields for the JSON Object to store in Mongo: Ill start with this: { "address" : "string", "turnOnMoisture" : "string", "turnOffMoisture" : "string", "moistureHistory" : [ { "dateTime" : "string", "value": "string", {},{} ], "turnOnLight" : "string", "turnOffLight" : "string", "LightHistory" : [ { "dateTime" : "string", "value": "string", {},{} ], "turnOnTemp" : "string", "turnOffTemp" : "string", "tempHistory" : [ { "dateTime" : "string", "value": "string", {},{} ], "turnOnTime" : "string", "turnOffTime" : "string" }

Can anyone think of anything else?

bdcannon commented 9 years ago

I was thinking pretty much the same thing. I was thinking perhaps some additional metrics, but those numbers can be crunched when the data is pulled from the database and doesn't need to be actively stored. For example, I was thinking an interesting metric would be "duty cycle" (on time/unit of time).

bdcannon commented 9 years ago

The json format needs "unique" id to handle duplicates

{
  "sensorId" : "string", 
  "address" : "string",
  "turnOnMoisture" : "string",
  "turnOffMoisture" : "string",
  "moistureHistory" : [ { "dateTime" : "string", "value": "string", {},{} ],
  "turnOnLight" : "string",
  "turnOffLight" : "string",
  "LightHistory" : [ { "dateTime" : "string", "value": "string", {},{} ],
  "turnOnTemp" : "string",
  "turnOffTemp" : "string",
  "tempHistory" : [ { "dateTime" : "string", "value": "string", {},{} ],
  "turnOnTime" : "string",
  "turnOffTime" : "string"
}
joshbaird commented 9 years ago

Probably need to add an ID for the PIN that needs to be turned on to activate the sprinkler. We can also drop address and use sensorId sensortype might be nice also to support other systems for collecting data other than i2c... Then the script that grabs to sensor info can grab the collection and only collect data for that type. or decide how to collect the data based on type. { "sensorId" : "string", "sensorType" : "string", "pinId" : "string", "turnOnMoisture" : "string", "turnOffMoisture" : "string", "moistureHistory" : [ { "dateTime" : "string", "value": "string", {},{} ], "turnOnLight" : "string", "turnOffLight" : "string", "lightHistory" : [ { "dateTime" : "string", "value": "string", {},{} ], "turnOnTemp" : "string", "turnOffTemp" : "string", "tempHistory" : [ { "dateTime" : "string", "value": "string", {},{} ], "turnOnTime" : "string", "turnOffTime" : "string" }

bdcannon commented 9 years ago

+1

bdcannon commented 9 years ago

Like we talked about in the wrong thread.... use the epoch (unix seconds since) for all 'dateTime' fields

bdcannon commented 9 years ago

I think the unit millisecond needs to be used for the dateTime fields. JS Date object operates on Ms for getting and setting the epoch time for the object. Storing them in seconds requires an extra step plus loss of precision.

HarderBetterFasterStronger commented 9 years ago

+1 ewok it is

bdcannon commented 9 years ago

:+1:

bdcannon commented 9 years ago

Closing this issue. From now on, create new issues if you want to change a field, add, remove whatever.