Closed vonw closed 5 years ago
I'm currently using a csv file to input sensor parameters into this script. I would still like to figure out how to properly format a JSON file for this. Hopefully this will also help me determine how to include sensor parameters in the data file as well.
@matthewRoetcisoender It looks like if you include metadata along with the actual data in a Python dictionary, and then read it into a Pandas DataFrame, Pandas just copies the metadata into every row. In other words, "name" is copied into every existing row of data. This is fine. It's a bit wasteful in terms of memory storage, but it won't hamper what we need to do with our data.
@matthewRoetcisoender So I guess we just need to figure out how to include the metadata into the JSON file that we're saving locally on the RPi.
Here's what it looks like now. I can change the "type" and "description to not be in a list, I just had it like that so it matched the format of the other data and looked a little better. (The "name" and "time interval I kept as a string and int because they are used in the code and need to stay as that data type).
And then here is what I did to make the original JSON file (using the commented out section) and then read it in as the sensorParameters.
1) So the code above creates a Python dictionary, correct? (If so, then it's trivial to use the "name" and "timeInterval" parameters in the script.)
2) Can I see the code that you used to create the JSON file that contains BOTH the data and the sensor parameters? I still don't understand how you did this, unless you did it manually. So how will we code this into our Python script?
Is this what you're asking for?
Yes!
So just to double-check... the data variables have more than one value, correct?
Correct, this is the method that resulted in the screenshot above. And then the same was done for the cloud packets as well (adding the meta data but still just sending one data value at a time though)
Great.
Now we just need to decide on what metadata we want to insert. Excellent job!
I will leave this Issue open until we decide on metadata variables to include.
Let's go with these for sensor parameters. We can always change things later, if needed. Please create a file for each sensor. Also when we deploy these, I think it would be good to add a parameter called "clarityOutdoorNode", which will include the ID for the particular Clarity Node that the indoor nodes are deployed with. So put this on your "deployment ToDo list"!!!
{ "name": "WSU_LAR_Indoor_Air_Quality_Node", "ID": 1, "type": "WSU LAR Indoor Air Quality Node", "description": "Indoor air quality sensor package (node) built at Washington State University's Laboratory for Atmospheric Research. Sensors include PMS5003 (particulate matter) and BME280 (TPU).", "contact": "Von P. Walden, Washington State University, v.walden@wsu.edu", "timeInterval": 120 }
timeInterval = 120 # Number of seconds
sounds good!
I'm closing this issue. Thanks!
Sensor information: name = 'WSU Indoor Air Quality Node #1' type = 'WSU Indoor Air Quality Node' description = 'Indoor air quality sensor package built at Washington State University's Laboratory for Atmospheric Research. Sensors include PMS5003 (particulate matter) and BME280 (TPU).' contact = 'Von P. Walden, Washington State University, v.walden@wsu.edu'
timeInterval = 120 # Number of seconds