Skip to main content
15-Moonstone
June 7, 2021
Solved

Retain property value on thing restart.

  • June 7, 2021
  • 1 reply
  • 2593 views

Hello,

I have a remotething with an average of 20 properties per remote thing and the no. of remote things can grow until 1000's. It is always recommended that a remote property is just logged but not persisted which adds up an extra operation to hold the value against each property.

If i have a thing restart, i loose all the property values and if for some reason the remote thing is not updated for a certain period of time and would like to retrieve the last values then its not available because its not persisted.

So what is the better approach to such kind of scenarios. 

 

Appreciate any support.

Thanks

Best answer by yhan

Yes, that's why the logged properties are called time-series data. The thing cannot receive the edge data during the time when it is restarted, so in this scenario, you can think it's a part of the restart that we keep the latest value before restarting, and properties will not be updated during this time period.

Of course, you can specify which properties need to get the previous value, according to your previous description, that the remote thing is not updated for a certain period of time and would like to retrieve the last values.

1 reply

17-Peridot
June 8, 2021

Assign or create a value stream for this thing, export this value stream before restarting the thing. You can import it if the properties' value cannot be queried after thing restarts.

sbt15-MoonstoneAuthor
15-Moonstone
June 8, 2021

sorry I didnt get your point. Yes i have a value stream associated to it, and as the property gets updated they are in the valuestream. So i just need the last property value updated to the stream which essentially i cannot get it from getpropertyvalues() because its refreshed over thing restart.

 

Thanks you.

17-Peridot
June 9, 2021

You can use QueryPropertyHistory() to get the latest values of logged properties.  For example, after thing restarts, execute below service (test and string is the name of my logged properties):

 

var infotable = me.QueryPropertyHistory();
me.test = infotable.test;
me.string = infotable.string;

 

Then property test and string will get their latest value before restarting.