I have a connect port X4 starter kit and have set up my devices, presentations and fileLogger that come with the iDigi starter guide. I have found that the logging tool is not very useful. I can only see my data instantaneously or in 15 minutes increments. I would like to be able to have all of my temperatures/humidities in a form where I can manipulate the data… ideally csv or something simple.
Being a BEGINNER programmer is there a way for me to edit the fileLogger.py to be able to do this? Should I write an entirely new python file? I know this is quite broad, just looking for some direction. Thanks.
The file logger that is there is more intended as a way to shared logged data with other presentations or devices in the system that may be interested. So you could take the existing logger and tie it into a presentation to grab the events that happened between two particular timestamps for instance.
It’s not really going to fit the need of writing out to a file that you will be able to download from the X4 and view in excel or something similar. The format of the log is pretty custom.
Just like devices and presentations, the logging system is extensible and allows for custom loggers to be added. So, if you’re interested in having a custom csv file written to the device, you could explore writing a simple logger that takes new data and just appends it to a file of that format. In the src/channels/logging directory there is a really simply example of a logger called simple_logger. You could use this as a base to make something like a csv_logger. Just modify the log_event method, which will be called each time a new channel is added or a channel has a new sample. Then you could append that new sample to your csv log file. (It’s possible for the log_event method to slow some operations in the system if the method takes a while to return, so it shouldn’t contain a lot of time consuming operations.)
The other half of a logger is the LoggerContext…this is really the piece that other code in the system would interact with to query the logger for samples and such, but this is not necessary if you’re only interested in something like writing a log file and using it externally.
Also…if you haven’t already, you might want to take a look at the cwm_exist (soon renamed iDigi_db) presentation. This one will push samples from your device up to the iDigi Platform. From there you can query with a web services client to retrieve sample values in XML format.
Chris Popp