Disable simple-mode via REST or config file

I am installing OH remotely and do not use any UI. Is there a way to disable simple-mode on an install either via the REST api or a config file?

/etc/openhab2/services/runtime.cfg

# This setting allows to switch between a "simple" and an "advanced" mode for item management.
# In simple mode (autoLinks=true), links and their according items are automatically created for new Things.
# In advanced mode (autoLinks=false), the user has the full control about which items channels are linked to.
# Existing links will remain untouched. (default is true)
#
org.eclipse.smarthome.links:autoLinks=false
1 Like

Thank you!

REST API:

curl -X PUT --header "Content-Type: application/json" --header "Accept: application/json" -d "{
  \"id\": \"org.eclipse.smarthome.links\",
  \"label\": \"Item Linking\",
  \"category\": \"system\",
  \"configDescriptionURI\": \"system:links\",
  \"multiple\": false
}" "https://<openhab address>/rest/services/org.eclipse.smarthome.links/config"
2 Likes

Installing openHAB remotly doesn’t prevent the use of an UI!

Thanks @opus. I understand it is possible but this is an automatic install that uses scripts and the REST api.

It’s probably getting beyond the scope of the OP but I often find it’s far easier and more reliably to create a base configuration and back that up and then deploy that rather than writing scripts (or Ansible playbooks) to write scripts or create configurations. For something as involved and complex as openHAB, it doesn’t make much sense to me to script each and every configuration set. Configure a base, back that up then have your script deploy the backup. Then script just the little bit that needs to be different for each deployment. Setting simple mode off is certainly something that is likely to be part of a base configuration.

That makes sense. I suppose there is a way to do that without using things and items files?

@rlkoshak thank you for your help. When I look at the REST UI I see by default for “org.eclipse.smarthome.links” an “autoLinks” attribute in the config and I do not see what you put in your example post. there is no multiple attribute. I just wanted to confirm that I am adding attributes to the config?

Everything you do through the REST API gets saved to /var/lib/openhab2. When you run openhab-cli backup, it grabs everything in /etc/openhab2 and everything relevant from /var/lib/openhab2. Things and Items in particular are stored in /var/lib/openhab2/jsondb.

I opened the REST API. I scrolled down to services. I queried for all services and looked through the result to find the ID for the one for auto-links. Then I queried for that specific service to get the JSON for just that service. Then I copied the JSON and used it as the data to put to the update config endpoint. I already have autolinks set to false so I didn’t change anything. I got back

{
  "autoLinks": "false"
}

as the result.

The curl command I pasted in above is what the REST API docs gave me. Anything more than that I think you’ll have to experiment with to figure out what works for you.