Emerson Sensi Thermostat

Yes I’ve tried removing and adding the Wink device several times. I xxxxx’ed out my tokens in earlier posts. Thanks for that good advice.

@42Network I was able to get the thermostat support to work again! I uploaded a new 2.4 jar, The jar has a lot of debugging logging that I will eventually trim out.

image

The problem was not with the herokuapp authentication. I set up the oauth through developer.wink.com and had the same issues. it ended up being a json parsing issue.

Let me know if it works for you. Please clear you cache and remove your items and then try the new jar.

Thanks,
Joel

1 Like

Joel,

Thanks for your hard work on this. I’m looking forward to it working. But I still get the same error as before about malformed JSON after clearing the OH cache & tmp files, installing the new jar, and restarting OH. I wish the error said what JSON file had an error.

How can I enable the debugging code you have in the jar? Perhaps we can get some more helpful errors!

2018-07-13 17:06:11.849 [ERROR] [org.apache.felix.configadmin        ] - [org.osgi.service.cm.ManagedService, id=99, bundle=157/file:/usr/share/openhab2/addons/org.openhab.binding.wink-2.4.0-SNAPSHOT.jar]: Unexpected problem updating configuration org.openhab.wink

com.google.gson.JsonSyntaxException: com.google.gson.stream.MalformedJsonException: Use JsonReader.setLenient(true) to accept malformed JSON at line 1 column 15 path $

	at com.google.gson.JsonParser.parse(JsonParser.java:65) [22:com.google.gson:2.7.0]

	at com.google.gson.JsonParser.parse(JsonParser.java:45) [22:com.google.gson:2.7.0]

	at org.openhab.binding.wink.client.DelegatedAuthenticationService.getResultAsJson(DelegatedAuthenticationService.java:93) [157:org.openhab.binding.wink:2.4.0.201807130010]

	at org.openhab.binding.wink.client.DelegatedAuthenticationService.<init>(DelegatedAuthenticationService.java:60) [157:org.openhab.binding.wink:2.4.0.201807130010]

	at org.openhab.binding.wink.internal.AuthenticationConfigurationService.configure(AuthenticationConfigurationService.java:51) [157:org.openhab.binding.wink:2.4.0.201807130010]

	at org.openhab.binding.wink.internal.AuthenticationConfigurationService.updated(AuthenticationConfigurationService.java:39) [157:org.openhab.binding.wink:2.4.0.201807130010]

	at org.apache.felix.cm.impl.helper.ManagedServiceTracker.updated(ManagedServiceTracker.java:189) [8:org.apache.felix.configadmin:1.8.16]

	at org.apache.felix.cm.impl.helper.ManagedServiceTracker.updateService(ManagedServiceTracker.java:152) [8:org.apache.felix.configadmin:1.8.16]

	at org.apache.felix.cm.impl.helper.ManagedServiceTracker.provideConfiguration(ManagedServiceTracker.java:85) [8:org.apache.felix.configadmin:1.8.16]

	at org.apache.felix.cm.impl.ConfigurationManager$ManagedServiceUpdate.provide(ConfigurationManager.java:1479) [8:org.apache.felix.configadmin:1.8.16]

	at org.apache.felix.cm.impl.ConfigurationManager$ManagedServiceUpdate.run(ConfigurationManager.java:1435) [8:org.apache.felix.configadmin:1.8.16]

	at org.apache.felix.cm.impl.UpdateThread.run0(UpdateThread.java:141) [8:org.apache.felix.configadmin:1.8.16]

	at org.apache.felix.cm.impl.UpdateThread.run(UpdateThread.java:109) [8:org.apache.felix.configadmin:1.8.16]

	at java.lang.Thread.run(Thread.java:748) [?:?]

Caused by: com.google.gson.stream.MalformedJsonException: Use JsonReader.setLenient(true) to accept malformed JSON at line 1 column 15 path $

	at com.google.gson.stream.JsonReader.syntaxError(JsonReader.java:1559) ~[?:?]

	at com.google.gson.stream.JsonReader.checkLenient(JsonReader.java:1401) ~[?:?]

	at com.google.gson.stream.JsonReader.doPeek(JsonReader.java:542) ~[?:?]

	at com.google.gson.stream.JsonReader.peek(JsonReader.java:425) ~[?:?]

	at com.google.gson.JsonParser.parse(JsonParser.java:60) ~[?:?]

	... 13 more

Despite the above error, I was able to add the Wink Hub. Discovery didn’t find anything, but I was able to manually add a thermostat. But it asked for a Wink-assigned UID. I have no idea how to find this UID. The Wink app on my phone, which shows my two Sensi thermostats, doesn’t tell me the UID.

I guessed and put in a UID of 1 and OH did add a thermostat, which I can see in the control area, but it shows no data.

Thoughts?

To manually add the uuid, you would have to use the wink api on their website to get it. I couldn’t figure out how to get it from there.

It looks like the errors you are getting are earlier than my error logging. It may be worth trying to got to the herokuapp and click disconnect from wink, then reconnect to wink. It shouldn’t change your I’d, but it may be worth trying.

Joel

How did you add your thermostat? Did Discovery work for you? Or did you add manually? If so, how did you determine the UID? Is this only a problem for me because I have two Sensis?

I manually added the wink hub, then discovery found my thermostat.

Maybe on your wink app you could remove one thermostat then try the wink binding again. I have never tried with two thermostats.

Joel

@42Network, Here is a jar with additional debugging messages. I added a ‘version’ debug message that should appear so we know OH isn’t running with an old jar like it did once before. The ‘version’ message is:

[ERROR] [lient.DelegatedAuthenticationService] - Debugging 'Version' 2.4.1  

In this jar, I added a JsonReader.setLenient(true) call based on your error messages, along with tracing out the string data we are trying to parse with a JsonParser.

Please let me know how it goes.

Joel

@42Network, This jar (debug ‘version’ 2.4.12) has a fix for the pubnub subscriptions for the thermostats. Please let me know how it goes for you.

Thank you,
Joel

Thanks for the update. I just installed it and it is much more responsive to hardware button changes. Except the change shows up in Celsius rather than Farenheit. Right now my thermostats in the paperUI Control area bounce back and forth between F and C. Didn’t used to do this.

Any ideas?

I’ve duplicated the behavior. I’ll let you know when it is fixed. Sorry about that.

Joel

I have fixed the temperature issue. Here is a jar with the fix.

debug ‘version’ 2.4.17

I noticed the humidity reading does something similar. I’ll get this fixed soon, but it may not be until next week.

Thanks,
Joel

Here is another update. I do not know of any more bugs. So this will hopefully be the last update for a while.
debugging ‘version’ 2.4.20

Thanks,
Joel

Hi Joel. Thanks for working on this.

I have recently noticed that OH will stop getting any data from my thermostats for days at a time. Like right now it hasn’t gotten an update since Aug.10. The behavior is the data will get stuck on one set of values and never update again. In the past when I saw this I would restart OH and I started getting data again.

I will install your latest jar and see if that behavior changes as well as whether the humidity stops bouncing around.

Thanks!

Hi Joel,

The new jar worked great for the past five days. Temps and humidity all reporting in within seconds in the right units. However, the data feed has now stopped. Here is a screenshot from my Grafana.

How can I begin helping troubleshoot?

Do you see any wink related error messages that show up in the log around the time it stops?

Joel

I’m just getting started in this. I’ve downloaded OpenHab 2.3.0 Stable Runtime, installed on Win 10 using the instructions, grabbed the latest org.openhab.binding.wink-2.4.0-SNAPSHOT.jar (commit 98cec76) and added to “addons” folder, got a token via openhab-authservice.herokuapp.com, configured the binding for “delegated” and added my token.

I add the Wink 2 Hub manually and shows “online” and i don’t get any discovery notifications, either manually or by scanning the binding.

I am “logged in” to Wink via herokuapp this whole time. Does that make a difference?

So, what information can I offer to help diagnose this problem? I have three Lutron Caseta Dimmers added to the Wink Hub, FYI.

Help is appreciated. Thank you!

Here’s “events.log” after manually adding the hub:

2018-09-12 21:07:56.676 [hingStatusInfoChangedEvent] - 'wink:wink_hub_2:a5bb19a9' changed from UNINITIALIZED to INITIALIZING
2018-09-12 21:07:56.677 [hingStatusInfoChangedEvent] - 'wink:wink_hub_2:a5bb19a9' changed from INITIALIZING to ONLINE

Here’s “openhab.log” from that timestamp onwards:

2018-09-12 21:07:56.671 [WARN ] [.core.thing.binding.BaseThingHandler] - BaseThingHandler.initialize() will be removed soon, ThingStatus can be set manually via updateStatus(ThingStatus.ONLINE)
2018-09-12 21:08:11.145 [WARN ] [okhttp3.OkHttpClient                ] - A connection to https://myopenhab.org/ was leaked. Did you forget to close a response body?
2018-09-12 21:08:38.756 [WARN ] [okhttp3.OkHttpClient                ] - A connection to https://myopenhab.org/ was leaked. Did you forget to close a response body?
2018-09-12 21:08:52.528 [WARN ] [mmon.WrappedScheduledExecutorService] - Scheduled runnable ended with an exception
java.lang.RuntimeException: java.lang.ClassNotFoundException: org.glassfish.jersey.client.JerseyClientBuilder cannot be found by javax.ws.rs-api_2.0.1
	at javax.ws.rs.client.ClientBuilder.newBuilder(ClientBuilder.java:103) [33:javax.ws.rs-api:2.0.1]
	at javax.ws.rs.client.ClientBuilder.newClient(ClientBuilder.java:114) [33:javax.ws.rs-api:2.0.1]
	at org.openhab.binding.wink.client.CloudRestfulWinkClient.listDevices(CloudRestfulWinkClient.java:49) [189:org.openhab.binding.wink:2.4.0.201808071632]
	at org.openhab.binding.wink.internal.discovery.WinkDeviceDiscoveryService$1.run(WinkDeviceDiscoveryService.java:56) [189:org.openhab.binding.wink:2.4.0.201808071632]
	at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) [?:?]
	at java.util.concurrent.FutureTask.run(Unknown Source) [?:?]
	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(Unknown Source) [?:?]
	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Unknown Source) [?:?]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) [?:?]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) [?:?]
	at java.lang.Thread.run(Unknown Source) [?:?]
Caused by: java.lang.ClassNotFoundException: org.glassfish.jersey.client.JerseyClientBuilder cannot be found by javax.ws.rs-api_2.0.1
	at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:484) ~[?:?]
	at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:395) ~[?:?]
	at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:387) ~[?:?]
	at org.eclipse.osgi.internal.loader.ModuleClassLoader.loadClass(ModuleClassLoader.java:150) ~[?:?]
	at java.lang.ClassLoader.loadClass(Unknown Source) ~[?:?]
	at java.lang.Class.forName0(Native Method) ~[?:?]
	at java.lang.Class.forName(Unknown Source) ~[?:?]
	at javax.ws.rs.client.FactoryFinder.newInstance(FactoryFinder.java:115) ~[?:?]
	at javax.ws.rs.client.FactoryFinder.find(FactoryFinder.java:225) ~[?:?]
	at javax.ws.rs.client.ClientBuilder.newBuilder(ClientBuilder.java:86) ~[?:?]

It looks like somehow your system is missing the org.glassfish.jersey.client.JerseyClientBuilder dependency. I’m not sure exactly how to get it added at this point, but I’ll do some looking around.

One thing you could try is installing a binding that has this same dependency thru paper ui. It looks like the nest binding has this same dependency. Try installing the nest binding and then try dropping in the wink binding to the addon folder again.

UPDATE: Working.
I misunderstood the readme and did not add the wink.cfg to the conf/services directory. I got it to see the dimmers already added to the Wink hub.

OK, So I decided to start fresh. Still not working.

I removed the current openhab install and re-installed to a new directory.

This time I picked the “UI Only” install option (no bindings installed automatically)

I added the WINK binding and then configured for “delegated” mode. Added the Hub manually and then searched.

Here is the log file after performing the search from startup to shutdown of openhab(I did two searches).

Thanks again for any help you can offer.

2018-09-14 19:04:22.850 [INFO ] [.internal.GenericScriptEngineFactory] - Activated scripting support for ECMAScript

2018-09-14 19:04:24.851 [ERROR] [org.apache.felix.configadmin        ] - [org.osgi.service.cm.ManagedService, id=123, bundle=204/file:/F:/openhab/addons/org.openhab.binding.wink-2.4.0-SNAPSHOT.jar]: Unexpected problem updating configuration org.openhab.wink
com.google.gson.JsonSyntaxException: com.google.gson.stream.MalformedJsonException: Use JsonReader.setLenient(true) to accept malformed JSON at line 1 column 15 path $
	at com.google.gson.JsonParser.parse(JsonParser.java:65) [22:com.google.gson:2.7.0]
	at com.google.gson.JsonParser.parse(JsonParser.java:45) [22:com.google.gson:2.7.0]
	at org.openhab.binding.wink.client.DelegatedAuthenticationService.getResultAsJson(DelegatedAuthenticationService.java:98) [204:org.openhab.binding.wink:2.4.0.201808071632]
	at org.openhab.binding.wink.client.DelegatedAuthenticationService.<init>(DelegatedAuthenticationService.java:60) [204:org.openhab.binding.wink:2.4.0.201808071632]
	at org.openhab.binding.wink.internal.AuthenticationConfigurationService.configure(AuthenticationConfigurationService.java:51) [204:org.openhab.binding.wink:2.4.0.201808071632]
	at org.openhab.binding.wink.internal.AuthenticationConfigurationService.updated(AuthenticationConfigurationService.java:39) [204:org.openhab.binding.wink:2.4.0.201808071632]
	at org.apache.felix.cm.impl.helper.ManagedServiceTracker.updated(ManagedServiceTracker.java:189) [8:org.apache.felix.configadmin:1.8.16]
	at org.apache.felix.cm.impl.helper.ManagedServiceTracker.updateService(ManagedServiceTracker.java:152) [8:org.apache.felix.configadmin:1.8.16]
	at org.apache.felix.cm.impl.helper.ManagedServiceTracker.provideConfiguration(ManagedServiceTracker.java:85) [8:org.apache.felix.configadmin:1.8.16]
	at org.apache.felix.cm.impl.ConfigurationManager$ManagedServiceUpdate.provide(ConfigurationManager.java:1479) [8:org.apache.felix.configadmin:1.8.16]
	at org.apache.felix.cm.impl.ConfigurationManager$ManagedServiceUpdate.run(ConfigurationManager.java:1435) [8:org.apache.felix.configadmin:1.8.16]
	at org.apache.felix.cm.impl.UpdateThread.run0(UpdateThread.java:141) [8:org.apache.felix.configadmin:1.8.16]
	at org.apache.felix.cm.impl.UpdateThread.run(UpdateThread.java:109) [8:org.apache.felix.configadmin:1.8.16]
	at java.lang.Thread.run(Unknown Source) [?:?]
Caused by: com.google.gson.stream.MalformedJsonException: Use JsonReader.setLenient(true) to accept malformed JSON at line 1 column 15 path $
	at com.google.gson.stream.JsonReader.syntaxError(JsonReader.java:1559) ~[?:?]
	at com.google.gson.stream.JsonReader.checkLenient(JsonReader.java:1401) ~[?:?]
	at com.google.gson.stream.JsonReader.doPeek(JsonReader.java:542) ~[?:?]
	at com.google.gson.stream.JsonReader.peek(JsonReader.java:425) ~[?:?]
	at com.google.gson.JsonParser.parse(JsonParser.java:60) ~[?:?]
	... 13 more
2018-09-14 19:04:27.771 [INFO ] [thome.model.lsp.internal.ModelServer] - Started Language Server Protocol (LSP) service on port 5007
2018-09-14 19:04:28.830 [INFO ] [.dashboard.internal.DashboardService] - Started Dashboard at http://192.168.1.100:8080
2018-09-14 19:04:28.831 [INFO ] [.dashboard.internal.DashboardService] - Started Dashboard at https://192.168.1.100:8443
2018-09-14 19:04:29.652 [INFO ] [arthome.ui.paper.internal.PaperUIApp] - Started Paper UI at /paperui
2018-09-14 19:04:29.668 [INFO ] [panel.internal.HABPanelDashboardTile] - Started HABPanel at /habpanel
2018-09-14 20:38:13.835 [WARN ] [.core.thing.binding.BaseThingHandler] - BaseThingHandler.initialize() will be removed soon, ThingStatus can be set manually via updateStatus(ThingStatus.ONLINE)
2018-09-14 20:39:35.580 [WARN ] [mmon.WrappedScheduledExecutorService] - Scheduled runnable ended with an exception
java.lang.IllegalStateException: Not a JSON Object: null
	at com.google.gson.JsonElement.getAsJsonObject(JsonElement.java:90) [22:com.google.gson:2.7.0]
	at org.openhab.binding.wink.client.CloudRestfulWinkClient.getResultAsJson(CloudRestfulWinkClient.java:147) [204:org.openhab.binding.wink:2.4.0.201808071632]
	at org.openhab.binding.wink.client.CloudRestfulWinkClient.executeGet(CloudRestfulWinkClient.java:124) [204:org.openhab.binding.wink:2.4.0.201808071632]
	at org.openhab.binding.wink.client.CloudRestfulWinkClient.listDevices(CloudRestfulWinkClient.java:52) [204:org.openhab.binding.wink:2.4.0.201808071632]
	at org.openhab.binding.wink.internal.discovery.WinkDeviceDiscoveryService$1.run(WinkDeviceDiscoveryService.java:56) [204:org.openhab.binding.wink:2.4.0.201808071632]
	at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) [?:?]
	at java.util.concurrent.FutureTask.run(Unknown Source) [?:?]
	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(Unknown Source) [?:?]
	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Unknown Source) [?:?]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) [?:?]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) [?:?]
	at java.lang.Thread.run(Unknown Source) [?:?]
2018-09-14 20:40:31.723 [WARN ] [mmon.WrappedScheduledExecutorService] - Scheduled runnable ended with an exception
java.lang.IllegalStateException: Not a JSON Object: null
	at com.google.gson.JsonElement.getAsJsonObject(JsonElement.java:90) [22:com.google.gson:2.7.0]
	at org.openhab.binding.wink.client.CloudRestfulWinkClient.getResultAsJson(CloudRestfulWinkClient.java:147) [204:org.openhab.binding.wink:2.4.0.201808071632]
	at org.openhab.binding.wink.client.CloudRestfulWinkClient.executeGet(CloudRestfulWinkClient.java:124) [204:org.openhab.binding.wink:2.4.0.201808071632]
	at org.openhab.binding.wink.client.CloudRestfulWinkClient.listDevices(CloudRestfulWinkClient.java:52) [204:org.openhab.binding.wink:2.4.0.201808071632]
	at org.openhab.binding.wink.internal.discovery.WinkDeviceDiscoveryService$1.run(WinkDeviceDiscoveryService.java:56) [204:org.openhab.binding.wink:2.4.0.201808071632]
	at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) [?:?]
	at java.util.concurrent.FutureTask.run(Unknown Source) [?:?]
	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(Unknown Source) [?:?]
	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Unknown Source) [?:?]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) [?:?]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) [?:?]
	at java.lang.Thread.run(Unknown Source) [?:?]
2018-09-14 20:41:37.384 [INFO ] [arthome.ui.paper.internal.PaperUIApp] - Stopped Paper UI
2018-09-14 20:41:37.388 [INFO ] [panel.internal.HABPanelDashboardTile] - Stopped HABPanel
2018-09-14 20:41:37.392 [INFO ] [.dashboard.internal.DashboardService] - Stopped Dashboard

OK, got the control of dimmers via openhab. When I adjust the settings via openhab, I see it reflected in the Wink app on my phone. However, if I adjust settings in the Wink App, they are not updated in openhab. Should openhab update after adjusting in Wink app?