Default disabled of things

I’m currently upgrading to Openhab 4.x and have decided to migrate from UI based configuration to Text based.

I have numerous things that are controlled outside of Openhab (by other things in Openhab) but I would like to be able to see them in Openhab as a way of tracking them. In order to do this I would like to create them but have them disabled.

Can this be done in the .things file definitions?

No, there is no way to create but have a Thing come up disabled using .things files.

Thanks for the info. Guess I’ll define it in the .things file but then comment it out.

  • Whilst there are ways to disable things for you through file based way (e.g. write a script to disable them, or create them in an initially disabled state)…
  • Would disabled Things be updated?
  • Can’t you just leave them enabled but not issue commands (through an item) to them?

I ended up creating them and naming them in such a way that it makes it self documenting. Such as putting the word “Load” on the items that actually do something and are not just controllers. Disabling on 100% startup is also a good idea. I’ll look into that.

I think your idea of disabling on startup is the best method. Do you have an example rule that would to this? I see to not be able to get an instance of a Thing…

Using JRuby addon

drop disable_things.rb in <CONF>/automation/ruby/

# List the UIDs of the things you'd like to disable on start up in this array
THINGS_TO_DISABLE = [
  "mqtt:topic:xxx1",
  "mqtt:topic:xxx2",
  "lgwebos:WebosTV:something"
].each { |uid| things[uid]&.disable }

Thanks. Not really a JRuby guy so I just did this: (Javascript)

var thing = things.getThing(‘insteon:device:50835B’);
thing.setEnabled(false);

It worked… I’ll wrap that around a startup rule and an iterator.

Thanks for all the help.

Scott