How to change preferences by script?

I would also be interested in this feature, it’s something groovy can do (for both SmartApps and Device Handlers), it would be of great help to extend this feature to both SmartApps and Drivers in the new platform to effectively migrate the existing implementations. There are lots of use cases for this for both SmartApps (which I’ve already submitted requests and use cases in the past) and for drivers, for example with LAN driver that auto detect a camera feature has been enabled directly on the camera, this now needs to be reflected in the device settings. Perfect example if motion detection options. The user can select options X, but then the driver detects that the settings on the camera were updated to Y, it now needs to update the settings so that they are in sync. This is the current implementation in the groovy DTH’s.