Duplicate Z-wave items when using file config

I prefer to have all my Z-wave items (and other items too) configured in items files for various reasons. I clear auto-generated items and links with “items clear” and “links clear” commands from the openHAB console after a new device is added.

However, while I continue updating my items file, I encountered a problem where there are duplicate items with the same names in my items config file. This happens only for Z-wave items, so I suspect somehow the Z-Wave auto item generation runs and creates duplicate items!!!

After I restarted openHAB the problem looks to disappear, but I’m afraid that it can happen again when openHAB is running. Any insights on what happens here? Is it a bug or something?

I’m confused - the items files are files that you created? Right? If there are duplicates, then didn’t you add them?

I don’t think there is anything in OH that automatically writes the items files…

There is no such thing as “the Z-Wave auto item generation” so I’ve no idea what would cause this. The ZWave binding doesn’t create items - exactly the same as other bindings won’t.

I have just one items file, where I define all my items. Let me explain the problem more clearly. Suppose that I have the following item definition in my items file.

Switch ZW_Siren “Siren [%s]” (Group_ZWave) {channel=“zwave:device:0b96edd1:node45:switch_binary”}

Normally, if I don’t have that item defined, openHAB auto discovers the channels of Z-wave devices and auto creates items with names like: “zwave_device_ 0b96edd1_node45_switch_binary”.

I don’t want those auto created items, so I remove them with “items clear” and “links clear” commands from openHAB console.

So I expect to see only “ZW_Siren” when I run the “items” command in openHAB console. However, after a while and I don’t know what causes this, I see duplicate ZW_Siren items when I run “items” command in openHAB console.

Well, openHAB2 by default create items named like: “zwave_device_ 0b96edd1_node45_switch_binary”. So that’s automatic and I don’t need to do anything for that.

I didn’t say there was no such thing as auto creating of items - you said this was only related to the ZWave binding, and my point is that there is nothing in the ZWave binding that creates items.

I think what you are seeing is the (so called) “simple mode” in ESH. In this mode, ESH will create the items for you automatically if they don’t exist. This is nothing to do with Z-Wave though.

To disable this, you need to set the following configuration


I said it was only related to my ZWave items, not binding. I don’t know the level of knowledge if this problem can be caused by the binding or the openHAB core, or ESH, etc…

Anyways, still the problem persists, even if there’s such a feature of auto-creating items if they don’t exist, why would that feature create duplicates of my “custom defined” items? It should not try to create items with the same names as my custom created ones!!

I think there’s a bug somewhere because this doesn’t look right to me.

Ok, I am just pointing out that there is nothing that is zwave specific. I’m not sure what else to suggest - sorry - so maybe someone else has some ideas.

Dear chris ,

I believe that i know what this is about.
when opening the console we first approve a auto discoverd node.
we then see that this new thing has some channels we can link to item files.
i also made a test item file for my 3 test items and for my power plug i have suddenly double items without knowing where they come from.
alltough that everything works …


Switch Z_SmartPlug_Bureau “Smartplug Switch” (Bureau,Lights_Groundfloor) { channel=“zwave:device:controller:node3:switch_binary” }
Number Z_SmartPlug_Bureau_Power “Electric meter (watts) [%.1f W]” (Bureau,Energy) { channel=“zwave:device:controller:node3:meter_watts” }
Number Z_SmartPlug_Bureau_PowerUsage “Electric meter (kWh) [%.2f kWh]” (Bureau,Energy) { channel=“zwave:device:controller:node3:meter_kwh” }

Hey chris,

Realy strange , but i have shutdown openhab 2 , waited a few minutes and then started openhab 2 again and my double items where gone.
I run the package on synology maybe a symlink that did not work ok .
i also notice that when updating my item files it auto refreshes but sometimes it does not and keeps then previous values in openhab 2.
Anyway Openhab needed to be rebooted to get rid of the double items.
I posted this comment as clearly not only me has seen this and its confusing to think there is something wrong while it may just be lag and can be resolved with a reboot.

kindest regards

I have the same issue. To give some more insights, if you use a binding 2.x and create additionally an item file and use bindings already defined the item will show up in the control part of the Paperui.

Find a solution? I have autoLinks=false, but I added a new zwave node and then added it to my zwave.things and now I am getting:

2017-12-04 16:34:50.632 [INFO ] [el.core.internal.ModelRepositoryImpl] - Refreshing model 'zwave.things'
2017-12-04 16:34:50.658 [ERROR] [.core.internal.folder.FolderObserver] - Error handling update of file '/etc/openhab2/things/zwave.things': Duplicate channels zwave:rtc_ct100plus_00_000:controller:node57:battery-level.
java.lang.IllegalArgumentException: Duplicate channels zwave:rtc_ct100plus_00_000:controller:node57:battery-level
	at org.eclipse.smarthome.core.thing.util.ThingHelper.ensureUniqueChannels(ThingHelper.java:157) ~[?:?]
	at org.eclipse.smarthome.core.thing.util.ThingHelper.ensureUniqueChannels(ThingHelper.java:133) ~[?:?]
	at org.eclipse.smarthome.core.thing.binding.builder.ThingBuilder.withChannels(ThingBuilder.java:77) ~[?:?]
	at org.eclipse.smarthome.core.thing.binding.ThingFactory.createThing(ThingFactory.java:102) ~[?:?]
	at org.eclipse.smarthome.core.thing.binding.BaseThingHandlerFactory.createThing(BaseThingHandlerFactory.java:255) ~[?:?]
	at org.eclipse.smarthome.model.thing.internal.GenericThingProvider.getThingFromThingHandlerFactory(GenericThingProvider.java:478) ~[?:?]
	at org.eclipse.smarthome.model.thing.internal.GenericThingProvider.getThingFromThingHandlerFactories(GenericThingProvider.java:461) ~[?:?]
	at org.eclipse.smarthome.model.thing.internal.GenericThingProvider.createThing(GenericThingProvider.java:390) ~[?:?]
	at org.eclipse.smarthome.model.thing.internal.GenericThingProvider.lambda$20(GenericThingProvider.java:879) ~[?:?]
	at java.lang.Iterable.forEach(Iterable.java:75) ~[?:?]
	at org.eclipse.smarthome.model.thing.internal.GenericThingProvider.createThingsFromModelForThingHandlerFactory(GenericThingProvider.java:881) ~[?:?]
	at org.eclipse.smarthome.model.thing.internal.GenericThingProvider.lambda$3(GenericThingProvider.java:294) ~[?:?]
	at java.lang.Iterable.forEach(Iterable.java:75) [?:?]
	at org.eclipse.smarthome.model.thing.internal.GenericThingProvider.createThingsFromModel(GenericThingProvider.java:296) [133:org.eclipse.smarthome.model.thing:]
	at org.eclipse.smarthome.model.thing.internal.GenericThingProvider.modelChanged(GenericThingProvider.java:736) [133:org.eclipse.smarthome.model.thing:]
	at org.eclipse.smarthome.model.core.internal.ModelRepositoryImpl.notifyListeners(ModelRepositoryImpl.java:309) [122:org.eclipse.smarthome.model.core:]
	at org.eclipse.smarthome.model.core.internal.ModelRepositoryImpl.addOrRefreshModel(ModelRepositoryImpl.java:138) [122:org.eclipse.smarthome.model.core:]
	at org.eclipse.smarthome.model.core.internal.folder.FolderObserver.checkFile(FolderObserver.java:242) [122:org.eclipse.smarthome.model.core:]
	at org.eclipse.smarthome.model.core.internal.folder.FolderObserver.processWatchEvent(FolderObserver.java:306) [122:org.eclipse.smarthome.model.core:]
	at org.eclipse.smarthome.core.service.WatchQueueReader.run(WatchQueueReader.java:204) [97:org.eclipse.smarthome.core:]
	at java.lang.Thread.run(Thread.java:748) [?:?]

I replied because I thought I had a related/similar issue but I decide it was more appropriate to create a seperate topic for this…

Duplicate Things when manually adding things using text file config