Enabled/Disabled Things from a script or a rule

Hi there,
I would like to be able to activate or deactivate things (at a certain time) via a rule or a script but impossible despite my many searches to find how to do it. Anyone have an idea?

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 :