Skip to content
This repository has been archived by the owner on May 7, 2020. It is now read-only.

Metadata with key already exists from provider GenericMetadataProvider Error #5502

Closed
jsetton opened this issue Apr 28, 2018 · 11 comments · Fixed by #5510
Closed

Metadata with key already exists from provider GenericMetadataProvider Error #5502

jsetton opened this issue Apr 28, 2018 · 11 comments · Fixed by #5510
Labels

Comments

@jsetton
Copy link

jsetton commented Apr 28, 2018

While testing the newly added metadata infrastructure (#4390) in openHAB 2.3.0-SNAPSHOT Build #1263, there seems to be a bug with refreshing/deleting metadata on already configured item. Each time I tried to update the metadata, it is failing with the below error and if I delete it, I can still see it present on that item when querying though the rest api. The only way to flush that information is to remove and re-add the item with the proper metadata.

Error
[WARN ] [ore.common.registry.AbstractRegistry] - Metadata with key 'foo:TestSwitch' already exists from provider GenericMetadataProvider! Failed to add a second with the same UID from provider GenericMetadataProvider!

Items Config
Switch TestSwitch "Test Switch" {foo="bar" [baz=42]}

@kaikreuzer
Copy link
Contributor

Isn't this warning fully correct? If you define certain metadata textually, this is expected to be present - therefore you cannot change it.
If you want to maintain metadata through the REST API, you should not define it in the text files.

@jsetton
Copy link
Author

jsetton commented Apr 28, 2018

@kaikreuzer Thanks for getting back to me. I am not sure to follow what you are saying. I just trying to make changes to the metadata of a specific item the same way I would to change any other item settings. Each time I refresh an item file, I get these warnings for any items that have metadata configured even though I haven't change that data.

It looks to me that the refresh logic isn't able to process metadata updates or deletes and just tries to add new items to which it complains since the metadata key already exists. Am I missing something?

@kaikreuzer
Copy link
Contributor

Ok, so you are saying you see this warning even though you are not using the REST API at all?
They occur simply by changing/reloading the items file? If that's the case, I misunderstood you above and would say that this is indeed a bug.

@kaikreuzer kaikreuzer added the bug label Apr 29, 2018
@kaikreuzer
Copy link
Contributor

@SJKA Could you have a look?

@jsetton
Copy link
Author

jsetton commented Apr 29, 2018

Ok, so you are saying you see this warning even though you are not using the REST API at all?
They occur simply by changing/reloading the items file?

You are correct on both counts. I just mentioned the REST API as a way to show that metadata deletes don't seem to be processed either after updating an items file since that warning isn't generated in that case.

sjsf pushed a commit to sjsf/smarthome that referenced this issue Apr 30, 2018
...on model update.

fixes eclipse-archived#5502
Signed-off-by: Simon Kaufmann <simon.kfm@googlemail.com>
@sjsf
Copy link
Contributor

sjsf commented Apr 30, 2018

Looks like indeed the GenericItemProvider kept the old metadata on update. I have created #5510 to add the required amnesia.

kaikreuzer pushed a commit that referenced this issue Apr 30, 2018
...on model update.

fixes #5502
Signed-off-by: Simon Kaufmann <simon.kfm@googlemail.com>
@martinvw
Copy link
Contributor

In which version of openHAB / ESH should this solution be?

2018-05-31 20:26:23.984 [WARN ] [ore.common.registry.AbstractRegistry] - LocationItem with key 'IPadIPad_Location' already exists from provider GenericItemProvider! Failed to bulk-add a second with the same UID from provider ManagedItemProvider!
2018-05-31 20:26:23.996 [WARN ] [ore.common.registry.AbstractRegistry] - NumberItem with key 'ZWaveNode19MotionSensorPIRMotionSensor_SensorTemperature' already exists from provider GenericItemProvider! Failed to bulk-add a second with the same UID from provider ManagedItemProvider!
2018-05-31 20:26:24.005 [WARN ] [ore.common.registry.AbstractRegistry] - NumberItem with key 'ICloudAccount_NumberOfDevices' already exists from provider GenericItemProvider! Failed to bulk-add a second with the same UID from provider ManagedItemProvider!
2018-05-31 20:26:24.012 [WARN ] [ore.common.registry.AbstractRegistry] - NumberItem with key 'Node21_SceneNumber' already exists from provider GenericItemProvider! Failed to bulk-add a second with the same UID from provider ManagedItemProvider!
2018-05-31 20:26:24.015 [WARN ] [ore.common.registry.AbstractRegistry] - StringItem with key 'IPhoneVanMartinIPhone7_BatteryStatus' already exists from provider GenericItemProvider! Failed to bulk-add a second with the same UID from provider ManagedItemProvider!
2018-05-31 20:26:24.027 [WARN ] [ore.common.registry.AbstractRegistry] - NumberItem with key 'IPhoneVanMartinIPhone7_BatteryLevel' already exists from provider GenericItemProvider! Failed to bulk-add a second with the same UID from provider ManagedItemProvider!
2018-05-31 20:26:24.028 [WARN ] [ore.common.registry.AbstractRegistry] - DateTimeItem with key 'YvetteGalaxyS4_LastSeen' already exists from provider GenericItemProvider! Failed to bulk-add a second with the same UID from provider ManagedItemProvider!
2018-05-31 20:26:24.034 [WARN ] [ore.common.registry.AbstractRegistry] - SwitchItem with key 'IPadIPad_FindMyPhone' already exists from provider GenericItemProvider! Failed to bulk-add a second with the same UID from provider ManagedItemProvider!
2018-05-31 20:26:24.036 [WARN ] [ore.common.registry.AbstractRegistry] - LocationItem with key 'IPhoneVanMartinIPhone7_Location' already exists from provider GenericItemProvider! Failed to bulk-add a second with the same UID from provider ManagedItemProvider!
2018-05-31 20:26:24.158 [INFO ] [g.discovery.internal.PersistentInbox] - Added new thing 'ipp:printer:HP_Color_LaserJet_MFP_M277dw__739AFF_' to inbox.
2018-05-31 20:26:24.237 [INFO ] [g.discovery.internal.PersistentInbox] - Added new thing 'tradfri:gateway:gwa0c9a067ca2d' to inbox.
2018-05-31 20:26:24.273 [INFO ] [g.discovery.internal.PersistentInbox] - Added new thing 'weatherunderground:weather:local' to inbox.
2018-05-31 20:26:24.308 [INFO ] [g.discovery.internal.PersistentInbox] - Added new thing 'astro:sun:local' to inbox.
2018-05-31 20:26:24.422 [INFO ] [g.discovery.internal.PersistentInbox] - Added new thing 'astro:moon:local' to inbox.
2018-05-31 20:26:25.669 [WARN ] [ore.common.registry.AbstractRegistry] - ItemChannelLink with key 'IPadIPad_FindMyPhone -> icloud:device:8dc5e79d:e28dc7bf:findMyPhone' already exists from provider GenericItemChannelLinkProvider! Failed to bulk-add a second with the same UID from provider ManagedItemChannelLinkProvider!
2018-05-31 20:26:25.688 [WARN ] [ore.common.registry.AbstractRegistry] - ItemChannelLink with key 'ICloudAccount_NumberOfDevices -> icloud:account:8dc5e79d:numberOfDevices' already exists from provider GenericItemChannelLinkProvider! Failed to bulk-add a second with the same UID from provider ManagedItemChannelLinkProvider!
2018-05-31 20:26:25.699 [WARN ] [ore.common.registry.AbstractRegistry] - ItemChannelLink with key 'Network_mtin -> network:servicedevice:mtinnl:online' already exists from provider GenericItemChannelLinkProvider! Failed to bulk-add a second with the same UID from provider ManagedItemChannelLinkProvider!
2018-05-31 20:26:25.705 [WARN ] [ore.common.registry.AbstractRegistry] - ItemChannelLink with key 'tv_mute -> samsungtv:tv:13d45659:mute' already exists from provider GenericItemChannelLinkProvider! Failed to bulk-add a second with the same UID from provider ManagedItemChannelLinkProvider!
2018-05-31 20:26:25.709 [WARN ] [ore.common.registry.AbstractRegistry] - ItemChannelLink with key 'YvetteGalaxyS4_LastSeen -> unifi:client:cc5e5dcf:lastSeen' already exists from provider GenericItemChannelLinkProvider! Failed to bulk-add a second with the same UID from provider ManagedItemChannelLinkProvider!
2018-05-31 20:26:25.713 [WARN ] [ore.common.registry.AbstractRegistry] - ItemChannelLink with key 'IPhoneVanMartinIPhone7_BatteryStatus -> icloud:device:8dc5e79d:91119628:batteryStatus' already exists from provider GenericItemChannelLinkProvider! Failed to bulk-add a second with the same UID from provider ManagedItemChannelLinkProvider!
2018-05-31 20:26:25.734 [WARN ] [ore.common.registry.AbstractRegistry] - ItemChannelLink with key 'IPhoneVanMartinIPhone7_BatteryLevel -> icloud:device:8dc5e79d:91119628:batteryLevel' already exists from provider GenericItemChannelLinkProvider! Failed to bulk-add a second with the same UID from provider ManagedItemChannelLinkProvider!
2018-05-31 20:26:25.778 [WARN ] [ore.common.registry.AbstractRegistry] - ItemChannelLink with key 'Node21_SceneNumber -> zwave:device:f12de0b1:node21:scene_number' already exists from provider GenericItemChannelLinkProvider! Failed to bulk-add a second with the same UID from provider ManagedItemChannelLinkProvider!
2018-05-31 20:26:25.783 [WARN ] [ore.common.registry.AbstractRegistry] - ItemChannelLink with key 'ZWaveNode16MotionSensorPIRMotionSensor_SensorTemperature -> zwave:device:f12de0b1:node16:sensor_temperature' already exists from provider GenericItemChannelLinkProvider! Failed to bulk-add a second with the same UID from provider ManagedItemChannelLinkProvider!
2018-05-31 20:26:25.803 [WARN ] [ore.common.registry.AbstractRegistry] - ItemChannelLink with key 'ZWaveNode19MotionSensorPIRMotionSensor_SensorTemperature -> zwave:device:f12de0b1:node19:sensor_temperature' already exists from provider GenericItemChannelLinkProvider! Failed to bulk-add a second with the same UID from provider ManagedItemChannelLinkProvider!
2018-05-31 20:26:25.820 [WARN ] [ore.common.registry.AbstractRegistry] - ItemChannelLink with key 'IPadIPad_Location -> icloud:device:8dc5e79d:e28dc7bf:location' already exists from provider GenericItemChannelLinkProvider! Failed to bulk-add a second with the same UID from provider ManagedItemChannelLinkProvider!
2018-05-31 20:26:25.826 [WARN ] [ore.common.registry.AbstractRegistry] - ItemChannelLink with key 'YvetteGalaxyS4_Online -> unifi:client:cc5e5dcf:online' already exists from provider GenericItemChannelLinkProvider! Failed to bulk-add a second with the same UID from provider ManagedItemChannelLinkProvider!
2018-05-31 20:26:25.832 [WARN ] [ore.common.registry.AbstractRegistry] - ItemChannelLink with key 'IPhoneVanMartinIPhone7_Location -> icloud:device:8dc5e79d:91119628:location' already exists from provider GenericItemChannelLinkProvider! Failed to bulk-add a second with the same UID from provider ManagedItemChannelLinkProvider!

I'm running openHAB 2.4.0 Build #1292

232 │ Active   │  80 │ 0.10.0.201805241348    │ Eclipse SmartHome Configuration UPnP Discovery
233 │ Active   │  80 │ 0.10.0.201805241348    │ Eclipse SmartHome Configuration USB-Serial Discovery
234 │ Active   │  80 │ 0.10.0.201805241348    │ Eclipse SmartHome Configuration USB-Serial Discovery Linux sysf Scanning
235 │ Active   │  80 │ 0.10.0.201805241348    │ Eclipse SmartHome Config Serial
236 │ Active   │  80 │ 0.10.0.201805241348    │ Eclipse SmartHome IoT Marketplace Extension Service
237 │ Active   │  80 │ 0.10.0.201805241348    │ Eclipse SmartHome Serial Transport
238 │ Active   │  80 │ 0.10.0.201805241348    │ Eclipse SmartHome Serial Transport for RXTX
239 │ Active   │  80 │ 0.10.0.201805241348    │ Eclipse SmartHome UPnP Transport Bundle
240 │ Active   │  75 │ 0.10.0.201805241348    │ Eclipse SmartHome Exec Transformation Service
241 │ Active   │  75 │ 0.10.0.201805241348    │ Eclipse SmartHome JavaScript Transformation Service
242 │ Active   │  75 │ 0.10.0.201805241348    │ Eclipse SmartHome JSonPath Transformation Service
243 │ Active   │  75 │ 0.10.0.201805241348    │ Eclipse SmartHome Map Transformation Service
244 │ Active   │  75 │ 0.10.0.201805241348    │ Eclipse SmartHome RegEx Transformation Service
245 │ Active   │  75 │ 0.10.0.201805241348    │ Eclipse SmartHome Scale Transformation Service
246 │ Active   │  75 │ 0.10.0.201805241348    │ Eclipse SmartHome XPath Transformation Service
247 │ Active   │  75 │ 0.10.0.201805241348    │ Eclipse SmartHome Xslt Transformation Service
248 │ Active   │  80 │ 0.10.0.201805241348    │ Eclipse SmartHome Basic UI, Fragments: 277
249 │ Active   │  80 │ 0.10.0.201805241348    │ Eclipse SmartHome WebApp UI, Fragments: 278
250 │ Active   │  80 │ 0.10.0.201805241348    │ Eclipse SmartHome Paper UI, Fragments: 282

@martinvw
Copy link
Contributor

@SJKA do you want a new issue for this, is there specific information which would help?

@jsetton
Copy link
Author

jsetton commented May 31, 2018

@martinvw from my perspective, I was able to confirm that this fix was included in an early 2.3 snapshot version which I will assume was rolled into official 2.3.

@martinvw
Copy link
Contributor

@jsetton thanks!

Since I upgrade on the to the 2.4.0 snapshot it seems broken, maybe an other change came after this, although it seems that somehow some of my manual defined items where also defined in the json-db. I don't know for sure how they came there, but after removing I can start without any errors. Lets see whether my broken sensors also report again...

@martinvw
Copy link
Contributor

I got my new measurement, imho something changed maybe duplicates where not a problem before...

ermartens pushed a commit to ermartens/smarthome that referenced this issue Jun 15, 2018
…chived#5510)

...on model update.

fixes eclipse-archived#5502
Signed-off-by: Simon Kaufmann <simon.kfm@googlemail.com>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants