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

Community Tip - You can Bookmark boards, posts or articles that you'd like to access again easily! X

[Subscription] Enable Subscription

gbeaumont
1-Newbie

[Subscription] Enable Subscription

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

1 ACCEPTED SOLUTION

Accepted Solutions
ankigupta
5-Regular Member
(To:gbeaumont)

Guillaume BEAUMONT​,

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

View solution in original post

4 REPLIES 4
supandey
19-Tanzanite
(To:gbeaumont)

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

ankigupta
5-Regular Member
(To:gbeaumont)

Guillaume BEAUMONT​,

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 !!

Top Tags