Skip to content

Instantly share code, notes, and snippets.

@jvolkman
Created April 23, 2017 16:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save jvolkman/1068504ca686182dd38e62f036daaf30 to your computer and use it in GitHub Desktop.
Save jvolkman/1068504ca686182dd38e62f036daaf30 to your computer and use it in GitHub Desktop.
OpenHAB Thing.json cleanup script
import json;
import collections;
with open("org.eclipse.smarthome.core.thing.Thing.json", 'r') as f:
db = json.load(f, object_pairs_hook=collections.OrderedDict)
for thing in db.values():
properties = thing.get("value", {}).get("configuration", {}).get("properties")
if not properties:
continue
for key in properties:
if 'group_org.openhab.binding.zwave.internal.protocol.ZWaveAssociationGroup' in key:
del properties[key]
with open("org.eclipse.smarthome.core.thing.Thing.json.clean", 'w') as f:
json.dump(db, f, indent=2, separators=(',', ': '))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment