Any way to disable automatic background discovery?


Is there any way to disable the automatic background discovery? I’m running OpenHab2 on a Synology NAS and the permanent writes to the jsondb causes all disks to stay awake and prevent suspension.

I’m seeing the file org.eclipse.smarthome.config.discovery.DiscoveryResult.json gets written a lot and since I’m not needing the discovery it would be nice to disable it.

I tried setting org.eclipse.smarthome.config.discovery.DiscoveryService:background=false in runtime.cfg but without any effect. ( see )

I’m aware that logs and userdata can cause wakeups too but the openhab-syno-spk has a way to put those directories on tmpfs.

Sure, I could move jsondb as well (somehow) but I was wondering if it might be easier to disable automatic discovery and only discover manually if needed.

Automatic background discovery is not the only thing that causes OH to write out to disk, including the JSONDB. If you want your disks to go to sleep then a Synology is probably not an appropriate host for OH. There is no way to make this not happen as far as I know.

You’re right. Most likely there are other writes as well. But looking at the disk access logs the discovery is by far dominating. It gets written about every 10-15 minutes where other stuff is rarely touched.

The official OpenHab Synology package already supports tmpfs for logs and persistence so I’m surprised the discovery file is not covered by the tmpfs.

Do you know what the reasoning of automatic background discovery is? I assume it’s rarely that new devices showing up. And (independently of the disk usage) it looks strange to not make this configurable.

No. That’s more work and would have other disadvantages such as people misconfiguring it.
And you want developers to invest that work just for the sake of satisfying someone like you with a very uncommon (and suboptimal in a number of dimensions) setup? Nah. Move to a different server. Or change the OS layer (move dirs && replace by links).

That’s a bit unkind. I run OH on Windows boxes, decidedly suboptimal and I recognise that. But I’m using spare capacity on boxes that are there for other purposes, it’s a good use of my resources. Isn’t OH great allowing us to make the choices :smiley:

@nougad to make a case for any effort, you would have to show that it would be effective. If discovery is inhibited, “maybe” writes would stop? Probably need a clearer analysis.
Having said that, investigating instead a relocation of the key JSONDB sounds like it would have a more general impact anyway.

The problem is known.

Not obvious solution found.

Awesome. Thanks for the confirmation an the link to the ticket! Good to know I’m not the only one with a “very uncommon” setup.

By that term I was referring to your use of Synology and wish to shut down spindles.
Noone to run on PC, RPi or other SBC running off SD needs this.

On a sidenote, check out this brand new openHABian PR. That’s (hopefully) tackling the source of the problem. Won’t work on Synology or Windows, though.