Disable / enable a thing from DSL or?

This is how to enable/disable a thing from a DSL Rule without HTTP requests:

import org.openhab.core.thing.ThingManager

rule "Framework util"
when
    System reached start level 100
then
    val thingManagerBundleContext = org.osgi.framework.FrameworkUtil.getBundle(ThingManager).bundleContext
    val thingManagerServiceReference = thingManagerBundleContext.getServiceReference(ThingManager)
    val thingManager = thingManagerBundleContext.getService(thingManagerServiceReference)
    // ThingManager interface is described at https://www.openhab.org/javadoc/latest/org/openhab/core/thing/thingmanager
    thingManager.setEnabled(new org.openhab.core.thing.ThingUID("mqtt:topic:dht22_1"), false) // disables the thing; true enables it
end