Latest update: September 2018
Up to 5 measurement value functions can now can registered at the same time.
In order to register the CSV output coming from the equipment (such as the data logger) to the FlashAir IoT Hub as the measured value, it is necessary to read the CSV file with a Lua script and then register it.
It's convenient to directly register a CSV as a measured value!
In this tutorial, we will walk through the procedure of uploading the value of the CSV file on FlashAir to the IoT Hub as a measured value.
upload_csv.luadirectly under the root folder of FlashAir. If not, download the latest script from 'Script' at the top of the IoT Hub site.
You can display graphs by aligning them vertically, and you can add / delete graphs to be displayed with buttons. Up to 10 graphs can be added.
In a CSV upload, values on the first and second rows and after are automatically registered as labels (legend names on the graph) and displayed in the pull down. During that time, if you upload CSV files with different labels, both labels will be registered.
Example: When CSV of
time,label001,label003 are registered on the first line of CSV, three
label001,label002,label003 are registered in total.
However, since the maximum number of labels is 100, if you exceed it, you will not be able to register.
All labels of the CSV file are not registered if the label registration fails. If this happens, reset the registered label. Please correct the CSV file again after label reset and register again.
The time format of CSV has the following format.
time,label001,label002,label003,label004,label005 2018-06-12T08:40:00-04:00,10,20,2,15,26 2018-06-12T08:41:00-04:00,10,20,3,16,27 2018-06-12T08:42:00-04:00,10,20,4,17,28
time,label001,label002,label003,label004,label005 0,10,20,2,15,16 60000,10,20,3,16,17 120000,10,20,4,17,18
When uploading the above example to 9:00:00, it is registered as the time
09:00:00 from the top.
The default option is registration at absolute time. However, if you can not acquire the current time with an embedded board or an old FlashAir's Lua etc. and can not be embedded in CSV, use the relative time to complement the time on the server side and register it.
Let's upload the file using relative time.
print("HTTP/1.1 200 Internal OK\n\n") local last_fname = "" local last_fpath = "" local last_modif = 0 local last_moddir = 0 local last_dirname = "/" local fpath = "/" local timestamp_type = "relative"