Community Tip - Have a PTC product question you need answered fast? Chances are someone has asked it before. Learn about the community search. X
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
Solved! Go to Solution.
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
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
Hi @cmorfin ,
Thank you for very clear explanations.
If I have understood well. I have created a thing with timer base template.
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.
While changing property signal in Rilevatore_mnaeem
It is not updating timer property in Timer Thing.
I think there is something I didn't understand.
Thank You,
Naeem
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
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
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!
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
Thank you @cmorfin
In attached file only time property is changing not the timeCopy property.
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
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
Yes this is the same issue as with the sample data, you need to create a subscription to the timer.
You can have a look at https://community.ptc.com/t5/IoT-Tech-Tips/Timers-and-Schedulers-Best-Practices/m-p/537812 for an example of creating a timer with subscription.
Christophe