Enabled/Disabled Things from a script or a rule

Guys… It’s good, I finally found it :slight_smile:
I put the code to use below :

var thingMgr = osgi.getService('org.openhab.core.thing.ThingManager');
var ThingUID = Java.type('org.openhab.core.thing.ThingUID');
thingMgr.setEnabled(new ThingUID('thing:uid:string'), false);

And the link where I finally found the information :

2 Likes