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

Time Counter

SOLVED
Highlighted
Alexandrite

Time Counter

Hi,

I'd like to show timer increment every second on mashup, which is based on the property values 1 ON and 0 OFF. I'd like to start counting the time till property has value  (OFF) and the store it in database that I've already connected to my Thingworx.

Your help will be highly appreciated.

Thank You!

Naeem

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted

Re: Time Counter

Hi @mnaeem 

 

Ok I see.

You have created a second service checkONCopy to update the timeCopy property.

This service needs to be called by the subscription to the timer otherwise it is never executed and therefore the property is not updated.

You can do this by selecting the tab Subscription and edit the timer subscription, just add a line 

me.CheckONCopy();

 

However, since both service will be executed at the same time, you could probably do everything inside the CheckON service itself by modifying it:

 

if (me.switch === true) {
me.time = me.time + 1;

me.timeCopy = me.timeCopy + 1;
}

 

hope this helps

Christophe

View solution in original post

Tags (1)
12 REPLIES 12
Highlighted

Re: Time Counter

Hi @mnaeem 

 

One possible solution would be to have a timer thing set at 1 sec, with 2 services:

- one check the value of the on/off property and increment by 1 a time property if it is on

- one to set the value on/off from mashup and if off store the last value in database

 

In the mashup :

- a checkbox bound to the input parameter state of second service

- a led display that takes the value of time property

- an autorefresh set at 1 sec that refreshes the geproperty service to show in LED display

 

Hope this helps

Christophe

Highlighted

Re: Time Counter

Hi @cmorfin ,

Thank you for very clear explanations.

If I have understood well. I have created a thing with timer base template.

mnaeem_0-1579261288595.png

In this created a services which checks the value of the property created on another thing, if it is equal to 1 it updates the property timer created in Timer Thing.

mnaeem_1-1579261562310.png

 

 

Highlighted

Re: Time Counter

While changing property signal in Rilevatore_mnaeem

mnaeem_0-1579262023048.png

 

 

It is not updating timer property in Timer Thing.

mnaeem_1-1579261785136.png

 

I think there is something I didn't understand.

 

Thank You,

Naeem

Highlighted

Re: Time Counter

Hi @mnaeem 

 

I have attached a sample (Timer Thing + Mashup) I did that should make it easier to understand.

In my case all the properties are on the timer Thing, but you can easily have this on separate thing too.

 

Kind regards

Christophe

 

 

Highlighted

Re: Time Counter

Thank you @cmorfin 

I was trying on ptc academic server https://ptcu-thingworx83-fundamentals.portal.ptc.io/Thingworx, where it is not working.

But on internal server where I have installed Thingworx works fine.

Best Regards,

Naeem

Highlighted

Re: Time Counter

Hi @cmorfin ,

I was working on timer thing and I am experiencing that I'm not able to update two time properties in the same timer thing.

I need this kind of functionality for almost 33 signals.

Comment on this will be highly appreciated.

Thanks You!

 

 

Highlighted

Re: Time Counter

Hi @mnaeem 

 

I am not sure to understand.

If we take back the example I attached earlier, I simply add a new property time2 and update the checkON service with new lines to increment and reset time2 similar to time.

This works fine for me, both time and time2 are being updated.

Are you doing something different ?

 

Maybe you could attach your entities to have a closer look.

 

Thanks

Christophe

 

Highlighted

Re: Time Counter

Thank you @cmorfin 

In attached file only time property is changing not the timeCopy property.

Highlighted

Re: Time Counter

Hi @cmorfin ,

In attachement you can find the exported thing that I'd like to use to update the timer of all properties.

In this not even a single service is working.

Thank You!

Naeem

Announcements

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