Community Tip - Need to share some code when posting a question or reply? Make sure to use the "Insert code sample" menu option. Learn more! X
Hello everyone,
i want do add a subscription to a Thing from within a script but i don't seem to be able to do so. I have tried using EnableSubscription which is not what i'm looking for since it simply activates or disables an already existing subscription. I have also tried using AddDynamicSubscription but this subscription is only in-memory which is not what i want. Is there any way to just add a subscription to a thing from a script like you would when using the editor?
Thanks in advance!
Solved! Go to Solution.
Right now you can't use a script to create a persistent subscription.
Is there a reason why you need to create it dynamically?
What you can create persistently is Alerts so if you have standard handling, you can create alerts into a AnyAlert subscription.
If they have to be dynamic, then you will need to
1. create them on demand
2. store the ones that you've created so they can be recreated during ThingStart
Right now you can't use a script to create a persistent subscription.
Is there a reason why you need to create it dynamically?
What you can create persistently is Alerts so if you have standard handling, you can create alerts into a AnyAlert subscription.
If they have to be dynamic, then you will need to
1. create them on demand
2. store the ones that you've created so they can be recreated during ThingStart