Did you check this :
Ohadm - A simple script to manipulate openHAB objects and sync them to YAML files - Tutorials & Examples / Solutions - openHAB Community