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

[OH 2.4.0 M6] Cannot add "Metadata" with key "channel:aLivingFloorLeftBulbs_switch". It exists already from provider "GenericMetadataProvider" #6649

Open
Hilbrand opened this issue Dec 8, 2018 · 2 comments

Comments

@Hilbrand
Copy link
Contributor

Hilbrand commented Dec 8, 2018

Problem description:

User ptweety made the following observation in when testing OH 2.4.0 M6:

there seems to be some kind of issue (just a warning though) with my item definition. I have 2 or 3 channels linked to a single item. Is this use case deprecated?

Dimmer aLivingCeilingBulb "Deckenlampe" <wallswitch> (gLivingCeilingBulb) { channel="hue:0220:00178840cd07:5:brightness", channel="hue:0220:00178840cd07:6:brightness", channel="hue:0220:00178840cd07:7:brightness" }
Dimmer aLivingFloorLeftBulbs "Stehlampe Links" <wallswitch> (gLivingFloorLeftBulbs) { channel="hue:0220:00178840cd07:12:brightness", channel="hue:0220:00178840cd07:13:brightness" }
Dimmer aLivingFloorRightBulbs "Stehlampe Rechts" <wallswitch> (gLivingFloorRightBulbs) { channel="hue:0220:00178840cd07:14:brightness", channel="hue:0220:00178840cd07:15:brightness" }

Logs:

2018-11-22 19:51:01.838 [WARN ] [ore.common.registry.AbstractRegistry] - Cannot add "Metadata" with key "channel:aLivingCeilingBulb". It exists already from provider "GenericMetadataProvider"! Failed to add a second with the same UID from provider "GenericMetadataProvider"!
2018-11-22 19:51:01.839 [WARN ] [ore.common.registry.AbstractRegistry] - Cannot add "Metadata" with key "channel:aLivingCeilingBulb". It exists already from provider "GenericMetadataProvider"! Failed to add a second with the same UID from provider "GenericMetadataProvider"!
2018-11-22 19:51:01.844 [WARN ] [ore.common.registry.AbstractRegistry] - Cannot add "Metadata" with key "channel:aLivingFloorRightBulbs". It exists already from provider "GenericMetadataProvider"! Failed to add a second with the same UID from provider "GenericMetadataProvider"!
2018-11-22 19:51:01.845 [WARN ] [ore.common.registry.AbstractRegistry] - Cannot add "Metadata" with key "channel:aLivingFloorRightBulbs_switch". It exists already from provider "GenericMetadataProvider"! Failed to add a second with the same UID from provider "GenericMetadataProvider"!
2018-11-22 19:51:01.846 [WARN ] [ore.common.registry.AbstractRegistry] - Cannot add "Metadata" with key "channel:aLivingFloorLeftBulbs". It exists already from provider "GenericMetadataProvider"! Failed to add a second with the same UID from provider "GenericMetadataProvider"!
2018-11-22 19:51:01.847 [WARN ] [ore.common.registry.AbstractRegistry] - Cannot add "Metadata" with key "channel:aLivingFloorLeftBulbs_switch". It exists already from provider "GenericMetadataProvider"! Failed to add a second with the same UID from provider "GenericMetadataProvider"!

Analysis:

Questions

  • Because these 2 calls seem to be triggered by service availability this looks like a timing issue. Where one call becomes before the other. It could even be due to the initial mentioned pr because that improved performance and it can be this changes the order because some services are now faster. Or was it intended design that it always was called in that order?
  • Looking at the warning message it tries to add channel:aLivingFloorLeftBulbs_switch as a meta data tag. That seems strange because channel should not be added as a meta tag. So why is is added as a meta tag?
  • The use of method internalDispatchBindings looks somewhat complex. There are several methods calling this method from different starting points. Maybe it needs some improvement here, like calling with a null reader to trigger a specific path seems somewhat hacky.
  • The question is if this is a problem. At first sight it looks like it might not be a problem it just tries to add a channel as a second meta tag. tags in an item must be unique, but channels are an exception. So it's ok to add multiple channels to an item and when added all these as meta tags the warning is logical because then. So the questions remain why is it adding channel as a tag? and what (change) could trigger this?
@kaikreuzer
Copy link
Contributor

this looks like a timing issue.

Sounds likely, I agree.

That seems strange because channel should not be added as a meta tag. So why is is added as a meta tag?

My assumption is that the GenericItemChannelLinkProvider (which implements BindingConfigReader) is not started at that moment and hence "channel" is considered to be some "random" meta-data.

At first sight it looks like it might not be a problem it

If the expected meta-data is available, it probably is not a problem that will break anything. Having "channel" metadata added is a bit ugly, but it shouldn't harm. Doing changes to internalDispatchBindings sounds pretty risky to me, so I'd rather go with reducing the log level for now.

@cweitkamp
Copy link
Contributor

I submitted openhab/openhab-core#755 to reduce the logging level.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants