Community Tip - Learn all about the Community Ranking System, a fun gamification element of the PTC Community. X
Hi guys,
I try to deploy an application which display the information from a weather station. Currently, I access the data via an API using token & credentials. I have three services, one for get access token, one for have new token with a refresh token and one other to access the data. I need to launch the services at specifics timeloop.
So I create a subscription to Thingstart event to launch my first service. I also create two others subscriptions which bind two differents timers to launch my services, they are basically disable.
I want to add at my first subscription (Thingstart event) an enable subscription method to enable my other service when I launch my thing. Badly it don't recognize it :
"Error processing local event: Execution error in service script [QAI_netatmoConnector ThingStart] : ReferenceError: "QAI_Timer30S" not recognize (ThingStart#5)"
this is my first subscription:
// result: JSON
var result = me.GetAccessToken();
var params = {
propertyName: QAI_Timer30S /* STRING */,
thingName: undefined /* THINGNAME */,
eventName: Timer /* STRING */
};
me.EnableSubscription(params);
any idea ?
Regards,
Guillaume
Solved! Go to Solution.
You are trying to enable a timer event subscription; so propertyName should remain undefined as there is no propertyName for timer event.
thingName is the name of the timer thing. Should be within Double Quotes.
eventName is name of the event which is "Timer".
So, your code should be something like:
var params = {
propertyName: undefined /* STRING */,
thingName: "QAI_Timer30S" /* THINGNAME */,
eventName: "Timer" /* STRING */
};
me.EnableSubscription(params);
I hope it helps.
Thanks,
Ankit Gupta
Hi Guillaume, the value for thingName is missing and have you tried this :
var params = {
propertyName: "QAI_Timer30S" /* STRING */,
thingName: "thingName" /* THINGNAME */,
eventName: "Timer" /* STRING */
};
thanks for your answer
You are trying to enable a timer event subscription; so propertyName should remain undefined as there is no propertyName for timer event.
thingName is the name of the timer thing. Should be within Double Quotes.
eventName is name of the event which is "Timer".
So, your code should be something like:
var params = {
propertyName: undefined /* STRING */,
thingName: "QAI_Timer30S" /* THINGNAME */,
eventName: "Timer" /* STRING */
};
me.EnableSubscription(params);
I hope it helps.
Thanks,
Ankit Gupta
It works perfectly, thanks a lot !!