openhab / openhab1-addons

Add-ons for openHAB 1.x
Eclipse Public License 2.0
3.43k stars 1.71k forks source link

[Withings] 'consumerKey' configuration key is unknown #5281

Closed mboremski closed 6 years ago

mboremski commented 6 years ago

Binding throws the following exeption:

2017-08-21 00:08:45.350 [ERROR] [org.apache.felix.configadmin        ] - [org.osgi.service.cm.ManagedService, id=1171, bundle=217/file:/usr/share/openhab2/addons/org.openhab.binding.withings-1.10.0.jar]: Updating property consumerKey of configuration org.openhab.withings-oauth caused a problem: The given configuration key is unknown!

Expected Behavior

After trowing "org.openhab.binding.withings-1.10.0.jar" to the addons-folder this binding should setup itself.

Possible Solution / Context

Environment

[DEBUG] log of start / stop

2017-08-21 00:08:43.581 [DEBUG] [org.openhab.binding.withings        ] - BundleEvent STARTING - org.openhab.binding.withings
2017-08-21 00:08:43.812 [DEBUG] [org.openhab.binding.withings        ] - BundleEvent STARTED - org.openhab.binding.withings
2017-08-21 00:08:44.376 [DEBUG] [org.openhab.binding.withings        ] - ServiceEvent REGISTERED - {org.osgi.service.cm.ManagedService}={service.pid=org.openhab.withings-oauth, osgi.command.function=[startAuthentication,finishAuthentication], component.name=org.openhab.binding.withings.authenticator, component.id=309, osgi.command.scope=withings, service.id=1171, service.bundleid=217, service.scope=bundle} - org.openhab.binding.withings
2017-08-21 00:08:45.350 [ERROR] [org.apache.felix.configadmin        ] - [org.osgi.service.cm.ManagedService, id=1171, bundle=217/file:/usr/share/openhab2/addons/org.openhab.binding.withings-1.10.0.jar]: Updating property consumerKey of configuration org.openhab.withings-oauth caused a problem: The given configuration key is unknown!
org.osgi.service.cm.ConfigurationException: consumerKey : The given configuration key is unknown!
    at org.openhab.binding.withings.internal.api.WithingsAuthenticator.updated(WithingsAuthenticator.java:251) [217:org.openhab.binding.withings:1.10.0]
    at org.apache.felix.cm.impl.helper.ManagedServiceTracker.updated(ManagedServiceTracker.java:189) [7:org.apache.felix.configadmin:1.8.14]
    at org.apache.felix.cm.impl.helper.ManagedServiceTracker.updateService(ManagedServiceTracker.java:152) [7:org.apache.felix.configadmin:1.8.14]
    at org.apache.felix.cm.impl.helper.ManagedServiceTracker.provideConfiguration(ManagedServiceTracker.java:85) [7:org.apache.felix.configadmin:1.8.14]
    at org.apache.felix.cm.impl.ConfigurationManager$ManagedServiceUpdate.provide(ConfigurationManager.java:1463) [7:org.apache.felix.configadmin:1.8.14]
    at org.apache.felix.cm.impl.ConfigurationManager$ManagedServiceUpdate.run(ConfigurationManager.java:1419) [7:org.apache.felix.configadmin:1.8.14]
    at org.apache.felix.cm.impl.UpdateThread.run0(UpdateThread.java:141) [7:org.apache.felix.configadmin:1.8.14]
    at org.apache.felix.cm.impl.UpdateThread.run(UpdateThread.java:109) [7:org.apache.felix.configadmin:1.8.14]
    at java.lang.Thread.run(Thread.java:745) [?:?]
2017-08-21 00:08:45.444 [DEBUG] [org.openhab.binding.withings        ] - ServiceEvent REGISTERED - {org.openhab.model.item.binding.BindingConfigReader, org.openhab.binding.withings.WithingsBindingProvider}={component.name=org.openhab.binding.withings.genericbindingprovider, component.id=311, service.id=1172, service.bundleid=217, service.scope=bundle} - org.openhab.binding.withings
2017-08-21 00:08:47.763 [DEBUG] [org.openhab.binding.withings        ] - ServiceEvent REGISTERED - {org.osgi.service.cm.ManagedService}={service.pid=org.openhab.withings, component.name=org.openhab.binding.withings.binding, component.id=310, service.id=1174, service.bundleid=217, service.scope=bundle} - org.openhab.binding.withings
9037568 commented 6 years ago

It appears your withings.cfg contains the key "consumerKey".

Try replacing it with "consumerkey".

mboremski commented 6 years ago

ty, I also thought about that and tried everything thinkable. I watched the code around this error-message and did not come further.

Even an empty withings.cfg or detelting this file gives same error-message

Also the binding should generate its own .cfg (like its said in the wiki) or there should be a working example in the WIKI.

9037568 commented 6 years ago

An empty withings.cfg could not produce the same error message.

When you think you have an empty withings.cfg, you're probably running from a cached copy of the config that still has the erroneous keys.

And the binding will never generate its own .cfg file.

mboremski commented 6 years ago

could you give me a hint where i have to search for this chashed copy? Yesterday I searched for files containing withings in filename and found some data in "/var/lib/openhab2/config/org/openhab". Deleting those files didn't change anything.

9037568 commented 6 years ago

Cached data shows up under either userdata/cache or userdata/etc.

msth commented 6 years ago

I can't find anything about the withings-oauth.cfg in the Documentation.

pallemannen commented 5 years ago

I figured this out, at least for OpenHAB 2.4.0 M8 and Withings binding 1.13.0.201812120952

I found this page: https://github.com/openhab/openhab1-addons/wiki/withings-binding

It says " Furthermore: if there were no values stored into openhab.cfg yet the Binding itself saves it's configuration into the file  services/withings-oauth.cfg" - which none of the other readmes does.

So I moved all the config from services/withings.cfg to services/withings-oauth.cfg and things suddenly worked fine. (Or at least I got passed the auth - haven't checked for any real data yet.)

Guess it means the docs should be changed.

Hope it helps.

/P