You need to configure cache time in order to fix this.
cacheTime — Tells the ThingWorx server how to behave when reading a
remote property. This parameter can take the following values:
○ -1 — Indicates that the VirtualThing always sends its value, and the
server should never request it from the remote application. The value
returned always comes from the in-memory cache of the server. Use this
value for properties that are configured to be pushed to the server.
○ 0 — Indicates that every time the server uses the value, it should request it
from the VirtualThing.
○ Any other positive value — Indicates that the server should cache the
value for that many seconds and then retrieve it from the VirtualThing
only after that time expires. This setting is important for properties that
may be accessed frequently by many users. For example, if 100 users
attempt to access a property value within a 10 second period, you may
want to set this value to 30 seconds. That would ensure that only a single
request for the property is sent to the edge every 30 seconds. However, the
value returned by the platform could be out of date by up to 30 seconds.
This setting is important for properties that may be frequently accessed by
many users. For example, if 100 users attempt to access a property value
within a 10 second period, you may want to set this value to 30 seconds.
That setting would ensure that only a single request for the property is sent
to the edge every 30 seconds. However, the value returned by the Platform
could be out of date by up to 30 seconds
Dear Tori, my subsciption is as follows,besides the subscription,what else should I do?
If the thing is not the Kepware remotething,the subscription works well ,but that didn't useful in my work.
me.measureTemperature = 0;
Sorry for the delay. Yes, I believe there is an issue. You have the cache option set for "Fetch from Remote Every Read". This means that there is no way to ping this property when the remote device is offline, so setting it to 0 will not benefit you in any way. What are you using this property for that you need to set it to 0? Are you using the EMS or an SDK?
There is a workaround to achieve your objects. A little bit hacky, but if you really need to reset the value, you can follow those steps:
1. Create additional, normal property on your Remote Thing. On the screenshot below I have two properties: remote (gets data from my Agent) and actual (local property with no remote binding).
2. Create two subscriptions:
a. One on DataChange of your remote property - this subscription should update the value of actual with the value of your remote property:
b. Second on DataChange of isConnected property - this subscription should check if property isConnected is being set to false, if so - should reset the value of actual to 0.
Now all you need to use the property actual, not remote. When the value of remote changes, the value of actual is changed too. If your Agent disconnects, the value is set to 0.
This method is not the most clean solution, however it works.
Hope it helps in your problem.
Thanks Mr Jakub, yes, the method you mentioned solved my problem.
I once did another test ,that was ,built another local thing(thing2), bind the thing1(which kepware provided the property value) property to thing2's property(thing2.Conn = thing1.isConnected). When thing1 is offline ,use the thing2's Conn to trigger thing2's other property into 0.But accidentally ,parts of thing2's property would become to 0, and then the thing1's property is not 0,I didn't kown why.