OH 3 Tips and Tricks

Thanks to Rich for these tips and JustinG for this post Solved: Mass change for multiple items possible?

Here’s how I copy things (including channels) and copy items (including metadata) via OH3 UI. This works well for e.g. the KNX binding, which does not support discovery, yet. It is not as fast as copying and modifying text files, but works well for me.

Copy things

  • Create all things via UI (only basic settings, no channels)
  • Create all channels for one specific type (e.g. HVAC, lighting, blinds) of thing
  • Go to Code of thing
  • Copy channel configuration to editor of your choice
  • Do a search and replace in the channel configuration
  • Paste channel configuration to the other things

Copy items (including metadata)

Copy items

  • Go to API Explorer Administration → Developer Tools
  • Do a GET items with itemname
  • If you want to copy multiple items, it is easier to create a group (item) first. Then enter group name as itemname
  • Supply the relevant metadata when GETTING, if you want to copy it. (e.g. stateDescripton, widget, listWidget, widgetOrder, …)
  • Copy JSON response to editor of your choice
  • Do a search and replace in the editor (keep editor open for copying metadata)
  • Do a PUT items with the JSON (metadata will not be copied in this step)
  • Check the response, if all items have been created successfully

Copy metadata of items

Link channels

Best regards
Fritz