cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - When posting, your subject should be specific and summarize your question. Here are some additional tips on asking a great question. X

Reading property values from Remote Thing

ehalvordsson
13-Aquamarine

Reading property values from Remote Thing

We are setting up an edge device using the Java SDK. Some of the values we want to read are counters - for example cumulative running hours. During startup or reboot of the edge device we would like to read the last value stored in the cloud and continue the counter from there. However, after initialisation it seems that the Virtual Thing automatically sets the value in the cloud to 0.

Is there any way to avoid that this happens?

We have used a bound Virtual Thing and annotations to define the Thing properties

@ThingworxPropertyDefinition(name="Counter",     

    description="The desired temperature",

    baseType="NUMBER",

    aspects={"dataChangeType:NEVER",

              "dataChangeThreshold:0",

              "cacheTime:0",

              "isPersistent:TRUE",

              "isReadOnly:FALSE",

              "pushType:VALUE"})

Immediately after this.initializeFromAnnotations();


The following returns 0 : this.getCurrentPropertyValue("Counter").getStringValue()

I have tried a few combinations of pushType settings but was not successful so far.

Many thanks in advance for your help!

Erik

2 REPLIES 2
ttielebein
14-Alexandrite
(To:ehalvordsson)

I believe this article will help you: https://support.ptc.com/appserver/cs/view/solution.jsp?n=CS254674

Good luck!

gnandyala
14-Alexandrite
(To:ehalvordsson)

Try keeping the property persistent.

Announcements


Top Tags