Hi there,
I’m looking for some recommendations on how to deal with historical events such as past maintenance tasks.
My goal is to store all historical services performed on the machines my IoTs are connected to. This information is used to establish a predictive maintenance schedule.
My first idea is to use the Data Tables where I could store the dates as a number. I understand this is not recommended for time series data, hence my interrogation.
My second idea is to use a device attribute, but I would need to manipulate the timestamp of the device state (service history comes from a manual user entry). Also, the values would be lost after 30 days, which doesn’t work for me since I want to keep the entire service history.
Welcome to the Losant Forums, we’re happy to have you here!
Also, the values would be lost after 30 days, which doesn’t work for me since I want to keep the entire service history.
Is the 30 day limit you mention here referring to Data Retention limits? If so, that is correct for Sandbox customers. This limit is more flexible for Losant Enterprise Customers.
The second idea you presented, using Device Attributes, is our recommended best practice when dealing with Time Series data. Historical Device State is able to be updated, but only up to 30 days in the past.
There are some more advanced options that you can leverage to accomplish this. They include using a Notebook to generate a file, or using an external database (like SQL) to add that information when events occur.
I’d be happy to discuss these options in more detail, so please let me know if you would like to!
Using Losant Notebooks would require you to store the events in an attribute as you have mentioned. Using a Timer Node and then a Notebook: Execution node to execute a Notebook on an interval. Then, in another workflow, using a Notebook Trigger and the Notebook Custom File Output, the workflow will receive a link to download the file that the Notebook created.
There is some information about a similar process in this post, and this post.
Please let me know if you have any more questions!