Community Tip - Visit the PTCooler (the community lounge) to get to know your fellow community members and check out some of Dale's Friday Humor posts! X
Hi,
I have a thingshape that has 2 subscriptions.
I would like to enable the second subscription from within the first. I have tried to use the service EnableSubscription
var subParams = {
propertyName: undefined /* STRING */,
thingName: "RemoteTimerThing" /* THINGNAME */,
eventName: "Timer" /* STRING */
};
me.EnableSubscription(subParams);
This fails as it says it 'Cannot Update A Subscription That Does Not Exist'. Originally I thought it was a permissions issue and so changed the permissions, but it still failed. I have also tried running this service directly from within the composer (as an administrator) using the Test button and it also fails. Now I'm thinking it isn't a permissions issue at all, but maybe there is something wrong with my service call above.
If I manually enable the service via the checkbox it all works fine.
Does anyone know how to enable a thing's own subscription from within it's one of it's own services?
Thanks,
K
I tested here and worked fine:
var params = { propertyName: undefined /* STRING */, thingName: "TIMER60s" /* THINGNAME OF THE SOURCE OF THE SUBSCRIPTION*/, eventName: "Timer" /* STRING OF THE NAME OF THE EVENT OF THE SUBSCRIPTION */ }; me.EnableSubscription(params);
Using data change:
var params = { propertyName: "value1" /* STRING */, thingName: me.name /* THINGNAME */, eventName: "DataChange" /* STRING */ }; me.EnableSubscription(params);
Hi,
thanks for the reply. Not sure what is happening with mine as it still doesn't work. I have incorporated a work around by using a dynamic subscription to a timer event run in Administator context. Not ideal but at least it works.
Thanks again for the reply.
K