Skip to main content
1-Visitor
April 6, 2020
Question

How to generate a datachange event for a remotely bound property

  • April 6, 2020
  • 2 replies
  • 3638 views

Hi,

as part of my testing I am trying to generate a property change on a property that has a remote binding to a property on a remote thing. Because the property is remotely bound I am unable to set it via the composer.

 

I have a test utility thing and was hoping to create a service that would generate a server side property change event (I have successfully done this for remote thing events previously). I see that there is the option, but I'm unsure how to use it. I have selected a remote thing and inserted the DataChange event into my service, but there doesn't seem to be any way to set the property name.

 

khayes1_0-1586179001454.png

I have selected a remote thing (KH061) and inserted the DataChange event into my service, but there doesn't seem to be any way to set the property name.

 

var params = {
newValue: undefined /* INFOTABLE */,
oldValue: undefined /* INFOTABLE */
};
Things["KH061"].DataChange(params);

 

 

Presumably the 2 infotables (attached file) match the ones you see when subscribing to a property change? If so is there a defined datashape for that? Also not sure what value toset the Quality parameter to.

 

How would you set the property name? 

 

Thanks

K

 

 
 

 

 

 

 

 

2 replies

Community Manager
April 7, 2020

Hi @khayes1.

 

We're not totally understanding, but we would actually recommend testing with an actual device that better represents your use case, which in this situation appears to be a property push. You can leverage the ThingWorx EMS or another SDK to bind with the Thing for simulating property pushes.

 

Have you worked with the EMS or one of the SDK's?  If not, we can provide the appropriate guide to assist.

 

Regards.

 

--Sharon

khayes11-VisitorAuthor
1-Visitor
April 7, 2020

Hi,

thanks for the reply. Sorry it wasn't clear.

I am familiar with the edge server etc. but I'm looking to to mimic a remote property push from the server side.

This is for test purposes only, so that I can test my subscription code without involving a real remote device. The particular scenario I wish to test is difficult to actually replicate on a real device.

 

I have done something similar in the past but with remote events (faults & warnings). I have a test utility thing where I added service  that generates a remote event but it is all done on the server, using snippets on a remote entity's event. 

 

I'm looking to do the same thing for a remote property change. I can see that I can choose a remote entity's data change event from the snippets, but can't see how to configure it for a particular property. It just seems to take 2 infotables as inputs (which appear to be new & old value) but there isn't anything that allows you to say which property the data change event is for.

 

hope that makes a bit more sense.

K

 

18-Opal
April 8, 2020

Hello @khayes1,

 

I don't want to steal your topic, but we have exactly the same issue, which prevents us from running our unit tests in ThingWorx 8.5.3+. It worked differently in 8.5.1, where we were able to set those remote properties programmatically, but not anymore. Unit tests are confined within ThingWorx, they run unattended and shouldn't depend on external components, such as emulated EDGE devices.

 

To make it work there should be some "testing" mode (platform-wide or entity-wide -- we don't care really), which would enable setting those remote properties and receive DataChange events.

 

@slangley, Is there a chance to file an enhancement request for it, while we're thinking on some workaround?

 

Regards,

Constantine

1-Visitor
April 21, 2020

Hi, 

 

You can't, at least from Server Side Javascript (I don't know if you can do it with a Java extension...). I know it's not the solution, but actually we rely on AnyDataChange not DataChange, and you can simulate AnyDataChange event without problem.

 

Best Regards,

Carles.