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

Updating time of a property in Thingworx using lua

Aquamarine

Updating time of a property in Thingworx using lua

Hi,

Trying to update time of the property on thingworx using following code

ts = 1578034820000    -epoch unix time in miliseconds

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

 

,but except time it is updating value and quality of the property.

 

Tried to update after converting ts into different formats, but in vain.

Thank you!

 

Best Regards,

Naeem

6 REPLIES 6

Re: Updating time of a property in Thingworx using lua

We can reproduce this behavior and we will open a case in you name for further investigation.

Regards.

Re: Updating time of a property in Thingworx using lua

Thank you @smainente ,

I really need assistance in this issue.

I'd be really thankful to you.

 

Best Regards,

Muhammad Naeem Akhtar

Re: Updating time of a property in Thingworx using lua

Hello @mnaeem ,

 

We just created the following article that clarifies this behavior and should help you with the issue you encountered : Timestamp is lost when pushing property from Lua Script Resource in ThingWorx.

 

Best regards,

Charlotte Lowy

Re: Updating time of a property in Thingworx using lua

Thank you @c_lowy 

It's really helpful in the use case asked in the question.

In another use case I'd like to update VTQ of the property using updatePropertyValues in Lua Script. I couldn't find any guide to call Thingworx services in agent (LUA EMS).

 

Best Regards,

Naeem

Highlighted

Re: Updating time of a property in Thingworx using lua

Hi @mnaeem,

Why do you need to use the updatePropertyValues service instead of of the built in property push mechanism of the EMS/LSR ? What are you trying to implement ?

Re: Updating time of a property in Thingworx using lua

Hi @smainente 

In the following coding I have many if conditions, and I'd like to decrease lines of my code


lineToRead[i] = array of 3 entries

for i = 1, #lineToRead do
    if lineToRead[2] == "PencilCounter" then
    properties.Signal_Pencil.time = tonumber(lineToRead[1])*1000
    properties.Signal_Pencil.value = tonumber(lineToRead[3])
    log.info(p_data.name, "Signal_"..lineToRead[2].." is "..lineToRead[3])
elseif lineToRead[2] == "RPM" then
    properties.Signal_RPM.time = ........
    properties.Signal_RPM.value = ......

    log.info(p_data.name, "Signal_"..lineToRead[2].." is "..lineToRead[3])
elseif lineToRead[2]=="I15" then
    ....................
elseif lineToRead[2]=="I20" then
    ............. and so on

 

 

Announcements

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