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

Community Tip - Stay updated on what is happening on the PTC Community by subscribing to PTC Community Announcements. X

Set Thingworx Platform property value from Thingworx AR (Vuforia) Experience

ptc-2839726
2-Guest

Set Thingworx Platform property value from Thingworx AR (Vuforia) Experience

Hi Experts -

I am looking for some help related to Thingworx Studio. I am able to pull property value from Thingworx and display within AR experience. But I am trying to update the value of a property of my Thing in Thingworx platform from my AR experience. Basically, like a toggle button within the (Vuforia) AR experience. On pressing the toggle button, I would like to update a property of my Thing. Is this even possible? Any help is highly appreciated.

Thanks,

Mubarak

Message was edited by: Sushant Pandey moved thread to ThingWorx Studio

1 ACCEPTED SOLUTION

Accepted Solutions
ankigupta
5-Regular Member
(To:ptc-2839726)

Hi Mubarak Ali​,

I tested the scenario on my instance and it worked fine on my instance.

For Authentication issue please check the following Post: Live Data Preview

Details about my use Case.

I created a New Property (NewTestProperty) in the Car1 Thing.

Then I created a Service with a Text input parameter (Test) and added code to update the Property:

me.NewTestProperty=Test;

Saved it. In ThingWorx Studio:

I added TextInput Widget and a Button widget.

Then I added my ThingWorx custom Service in External data and Binded Text property of TextInput Widget to Parameter of my Custom Service.

I also bound the click event of Button to Custom Service so that I can call it on button click.

In Preview; I entered the Text and clicked the Button and the Text showed in ThingWorx Property.

I hope it helps.

View solution in original post

7 REPLIES 7
ankigupta
5-Regular Member
(To:ptc-2839726)

Hi Mubarak Ali​,

You can try to use the update service like UpdatePropertyValue from ThingWorx and pass the widget output as parameter to that Service.

You will have to call this service to update the Data in ThingWorx.

If I remember correctly; I had tried this sometime back and it worked.

Do let me know if it doesn't work for you; I can try it again on my side.

Thanks,

Ankit Gupta

Hi Ankit. Thanks for your response. I added UpdatePropertyValues from my Thing to my AR experience. Then I added a toggle button and binded the pressed event of that toggle button to UpdatePropertyValues service. And then I added the following under the values (under Parameter) under UpdatePropertyValues service.

app.mdl['FactoryThing1'].data.parameter['LED1_Disp_Status'] = "XYZ"

I was expecting the UpdatePropertyValues service to update the value of my property 'LED1_Disp_Status' to 'XYZ'. But I don't see the values getting updated in Thingworx IoT platform. It seems I am doing something wrong. I have also attached a screen shot. Appreciate your help.

Thanks,

Mubarak

Hi Ankit. Some additional info. This is what I could see in Thingworx Studio logs when the UpdatePropertyValues service is invoked when I click on the toggle button.

[16:28:21] info: [twx-studio:basic] twxPreviewRouter proxying request to "MyThingworxIoTURL"

[16:28:21] debug: [twx-studio:proxy] /Things/RaspberryPiThing/Services/UpdatePropertyValues no Authorization added

Thanks,

Mubarak

ankigupta
5-Regular Member
(To:ptc-2839726)

Hi Mubarak Ali​,

Is your ThingWorx Studio Project public or does it require Authentication?

Please provide Runtime Permission to the corresponding user in ThingWorx.

es-public-access user for Public access.

thingserver user for access with Authentication.

Note: Username may be different in your ThingWorx instance.

Hi Ankit. Thanks for your response. My ThingWorx Studio Project requires authentication. I am using my studio credentials to publish the experience and able to use the same credentials to scan the ThinkMark and retrieve the experience and see the my Thing properties displayed in experience in real-time. The Thing was also created in ThingWorx using my same credentials and has an application key associated to it. The issue is happening only when I try to use "UpdatePropertyValues". Please note I am able to read the properties from ThingWorx using "GetPropertyValues". I am using the below in "UpdatePropertyValues" to update properties.

app.mdl['RaspberryPiThing'].data.parameter['IPAddress'] = "1234"

app.mdl['RaspberryPiThing'].data.parameter['IPAddress'] = "4567"

I also went through the below guide on setting public access.

https://help.vuforia.io/studio/#page/ThingWorx_Studio_Help_Center%2FAnonymousAccess.html%23

As per the guide, the application key need to be configured in the Administrative Console of the Experience Service. But I do not find any setting there which can be used to configured application key. Below screen shot for your reference. Highly appreciate your help.

Thanks,

Mubarak

ankigupta
5-Regular Member
(To:ptc-2839726)

Hi Mubarak Ali​,

I tested the scenario on my instance and it worked fine on my instance.

For Authentication issue please check the following Post: Live Data Preview

Details about my use Case.

I created a New Property (NewTestProperty) in the Car1 Thing.

Then I created a Service with a Text input parameter (Test) and added code to update the Property:

me.NewTestProperty=Test;

Saved it. In ThingWorx Studio:

I added TextInput Widget and a Button widget.

Then I added my ThingWorx custom Service in External data and Binded Text property of TextInput Widget to Parameter of my Custom Service.

I also bound the click event of Button to Custom Service so that I can call it on button click.

In Preview; I entered the Text and clicked the Button and the Text showed in ThingWorx Property.

I hope it helps.

Thanks Ankit for the additional details. I could get this working.

Thanks,

Mubarak

Top Tags