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

Syntax of updating the property VTQ

Aquamarine

Syntax of updating the property VTQ

Hello,

To update the property VTQ on Thingworx platform using lua EMS is the following possible.

 

properties.propertyName={baseType="NUMBER", pushType="ALWAYS", value=0}

--To update on thingworx

local variableName = propertyName

properties.variableName.value = <someValue>

 

I tried it in different ways but it's giving me an error.

 

Thank You,

Naeem

14 REPLIES 14

Re: Syntax of updating the property VTQ

You can use this service: 

UpdatePropertyValues

Re: Syntax of updating the property VTQ

Thank You @PaiChung 

properties.Signal_Q30={baseType="NUMBER", pushType="ALWAYS", value=0}

serviceDefinitions.GetSystemProperties(
     output { baseType="BOOLEAN", description="" },
     description { "updates properties" }
)

services.GetSystemProperties = function(me, headers, query, data)
     log.trace("[TemplateRilevatore]","########### in GetSystemProperties#############")
     queryHardware()
     -- if properties are successfully updated, return HTTP 200 code with a true service return value
     return 200, true
end
function queryHardware()
     nome = "Signal_Q30"
     valore = 2
     serviceName(nome, valore)

end

I'd like to call a service in place of serviceName, which has been written on thingworx platform.

Thank you!

Re: Syntax of updating the property VTQ

You are looking to do this from an agent?

Usually you would use 'UpdateSubscribedProperties' for that.

Re: Syntax of updating the property VTQ

Yes I'm trying to do this from the agent (Thingwworx WebSocket-based Edge Microserver (WS EMS) and Lua Script Resources (LSR)).

I'd like to understand how can I call a service (e.g UpdatePropertyValues or UpdateSubscribedPropertyValues etc) written on thingworx platform from the agent.

Re: Syntax of updating the property VTQ

I'm not much of an expert when it comes to the agent.

I think the pushsubscribed/update subscribed should be in the example for the agent.

besides that, I know that you can invoke any platform service after being connected, I forget the syntax though

Re: Syntax of updating the property VTQ

Thank You @PaiChung ,

I tried to invoke the service using

me.serviceName({input1 = inputValue, input2 = inputValue}) --1 way

me.serviceName({input1: inputValue, input2: inputValue})  --2 way

me.serviceName(input1 = inputValue, input2 = inputValue)  --3 way

--4 way (Opened a new topic as well https://community.ptc.com/t5/ThingWorx-Developers/Updating-time-of-a-property-in-Thingworx-using-lua...)

ts = 1578034820000 -epoch unix time in miliseconds

nome = "Signal"

local data = {}
data.value = 2
data.time = ts
data.quality = "Good"
me:setProperty(nome, nil, nil, data)

in 4th way it's not updating the time.

 

Actually I'd like to update value, time and quality of the property through agent.

Re: Syntax of updating the property VTQ

Hi @PaiChung ,

There are no push subscribed/update subscribed in the example for the agent.

I really need to solve it.

 

Thank You,

Naeem

Re: Syntax of updating the property VTQ

Unfortunately I don't know much about coding within the agent.

but you should be able to call the service I indicated form the agent.

Re: Syntax of updating the property VTQ

Hi @mnaeem.

 

If you have found a solution to your question, please post it here for the benefit of others with the same question.

 

Regards.

 

--Sharon

Announcements

Thingworx Navigate content has a new home! Click here to access the new Thingworx Navigate forum! ______________________________