Skip to main content
Jul 18, 2016 2:21 PM UTC
Solved

How to enable an MQTT thing programatically?

Hi community,

I am actually developping an application with MQTT extension provides on marketplace. However I encounter a problem. If I create a new MQTT thing with the composer, it's directly active after I pressed save in the composer but if I want to create programatically an MQTT thing with a service then the thing isn't active by default and I need to edit and save the thing in the composer if I want it works.

Someone know how to do it to active an MQTT thing created with a service?

Regards,

Anthony

    Jul 19, 2016 7:11 AM UTC

    Hi Anthony,

    You may need to Enable and Restart your new thing:

    Things["newThingName"].EnableThing();

    Things["newThingName"].RestartThing();

    5 replies

    Jul 18, 2016 4:15 PM UTC

    Hi Anthony,

    This is a great question to ask in the Developer Community so our technical support team can respond to you.  Please let me know if you need additional support.  Thank you,

    Laura

    Jul 19, 2016 7:11 AM UTC

    Hi Anthony,

    You may need to Enable and Restart your new thing:

    Things["newThingName"].EnableThing();

    Things["newThingName"].RestartThing();

    anthony1Author
    Jul 19, 2016 7:47 AM UTC

    Hi,

    Thank's, I did it but it doesn't work in first time but now it works good when I restart thing.

    Regards,

    Anthony