Fork of the default sioclient.py file which logs all readings to a .csv file in the base directory.
Expected behavior is:
Launch with python3 -m simoc_sam.csv_logger
Setup the socketio connection and begin receiving step-batch emits
Initialize a logfile as simoc_log_11-22-22_12-07-56.csv
For each batch, compile the list of fieldnames. Includes the timestamp and, for each field of each sensor, <sensor_id>_<field> (e.g. '6LC832_co2'). These correspond to 'columns' in the .csv.
If the logfile doesn't include all the fieldnames (i.e. sensors were refreshed), add new columns.
Write the batch to the .csv
Notes:
Currently this needs to be launched independent of the server (just like the sensor_manager).
Currently the file name is hardcoded with a timestamp, so it won't be continuous if disconnected/reconnected.
The columns are mapped to sensor_id, as found in the SENSOR_INFO dict sent/maintained by the server. That means for sensors with a persistent id (Vernier, or Adafruit after we map them to USB ports), data will go to the same columns before/after refreshing or disconnecting the sensors. For sensors with random id (MockSensor, Adafruit currently), they will create a new column after each refresh.
Fork of the default
sioclient.py
file which logs all readings to a .csv file in the base directory.Expected behavior is:
python3 -m simoc_sam.csv_logger
step-batch
emitssimoc_log_11-22-22_12-07-56.csv
fieldnames
. Includes thetimestamp
and, for each field of each sensor,<sensor_id>_<field>
(e.g. '6LC832_co2'). These correspond to 'columns' in the .csv.Notes:
sensor_manager
).sensor_id
, as found in theSENSOR_INFO
dict sent/maintained by the server. That means for sensors with a persistent id (Vernier, or Adafruit after we map them to USB ports), data will go to the same columns before/after refreshing or disconnecting the sensors. For sensors with random id (MockSensor, Adafruit currently), they will create a new column after each refresh.