New OH2 binding for Venstar Colortouch thermostats

Hi Bill,
I am running OpenHAB 2,1.0 on Ubuntu 16.04 on x64. I have a Venstar ColorTouch T7900 running FW V4.08-1A. At the time of my original report this was the latest firmware for the model. However, at your mention of new firmware, I downloaded and checked ColorTouch Assistant again and there is a new 5.x firmware that seems to have come out recently. I’ll try upgrading and see if that helps, then report back.

Bill,
Things are actually looking very promising in the new FW 5.10. No reboots for almost an hour when it was every few minutes before. I’ve seen the discovery process go off in the log a lot without issue. Hopefully this means that V4.08-1A was just buggy and that I’m finally set :slight_smile:

Thanks so much for the binding, its great to have this integrated with openhab. Best of luck if you try to get it merged as an official binding

That’s terrific!

I’ve been out of town but made a note to check my firmware revision… 4.35 seems to stick in my head; I also need to find a SD card to load the update onto! I’ve noticed that my thermostat will go offline for a minute every so often; maybe once or twice a day. I assumed it was because of DHCP, but now I wonder if it’s related to discovery.

I’d be glad to have it included in the official bistro; I suspect the software dependencies required to deal with the thermostat’s quirks may be disqualifying. The new IOT mall might be a good option as well… I need to look into that.

As always, please don’t hesitate to yell if you have any problems or suggestions!

Bill

@hww3 , Hi Bill, I just installed 5 venstar thermostats in my house, so thanks for the binding! I have a clone of your repo where I have made some changes that I think make sense to merge into your branch, see https://github.com/digitaldan/org.openhab.binding.venstarthermostat/commits/my-changes

I would like to see this binding merged into OH, I would be happy to help you in this regard, I think the binding is in pretty good shape, so I don’t see this being difficult. What do you think the next steps are here? My first suggestion would be to have you clone the openhab2-addons repo in your own github account and move the binding there to make PR’s easier.

Hi,

I’m glad to hear that the binding has been useful. I will definitely have a look at your branch… there are one or two little things I’ve been wanting to do before I call it “feature complete”:

  1. I’d like to have better monitoring of the communication with the thermostat. It does detect when communication fails outright, but I’ve noticed once or twice that requests can just hang up and thus channels never get updated. My thought is to add a timeout so that if the various channels aren’t updated in a multiple of the polling period, the state goes to offline.

  2. I have been using the HomeKit bridge and noticed that the system mode isn’t being reported properly. I’m not sure yet whether it’s a problem with the value mapping of the system mode or something else.

I’d be happy to have the binding be merged but I’m a bit over-committed at the moment, so if you’d be able/willing to help shepherd that process, I can get these last things cleaned up and ready for a PR.

Great, do you have a github clone of openhab2-addons? It would be good to start working there to make PR’s easier. I have a branch of the code that i imported into the main project that I could submit a PR to your clone on github.

I took some time this morning and re-patriated the venstar binding into fresh clone of openhab2-addons. It seems to build properly but I haven’t yet tested the result against my thermostats. Hopefully that will happen later today.

I squashed all of the commits (including yours) into a new branch: hww3/venstar_thermostat… Feel free to have a look and let me know what you think.

Awesome, thanks. I’m planning on taking a look tomorrow when I’m back in town.

Help, Tried out the Venstar binding. I am pretty sure I set everything up correctly (updated thermostats firmware, using 2.2 package ,enabled https on thermostat, set user/pass on thermostat, enabled local api on thermostat). I can log in to the thermostat using firefox from browser so I am quite sure it is working correctly. Openhab auto detected the thermostat and I added the username and password.

My status is:

Offline - Communication_Error Failed to connect to URL (https://192.168.XXX.XXX/): org.apache.http.impl.client.DefaultHttpClient.execute(Lorg/apache/http/client/methods/HttpUriRequest;)Lorg/apache/http/client/methods/CloseableHttpResponse;

Any help would be greatly appreciated. Also, I did not add any extra bundles since I read that the version 2.2 bundle included all its dependencies.

@hww3 looks good, I have a couple small changes I’ll get a PR for soon. Also, I have a plan to use the openHAB built in Jetty client instead of Apache which is preferred for bindings. I am waiting for the upstream jetty project to release a new version that fixes a bug I have been commenting on over at https://github.com/eclipse/jetty.project/issues/1555#issuecomment-382182405 . They have a fixed merged in, but have not released it to the stable builds.

@bumblebeebat I have a version that works with openHAB 2.3 (nightly builds) i can post, not sure if thats an option for you.

Hi @digitaldan,

I honestly don’t remember the reason I didn’t use the Jetty client in the first place (though there was one at the time… maybe relating to the certs the thermostat was using at the time?). I do know that the Apache client is also being used to parse the discovery messages, as the Venstar SSDP implementation is completely non-standard.

@bumblebeebat, I suspect that there’s some sort of class version conflict based on the message you’re getting; having a look at the full error message in the logs might help narrow it down. What version of OpenHAB are you using?

Hi @hww3 I am using openhabian on a raspberry pi. When I log into the openhab console it show version 2.2.0 Release Build.

I grabbed the venstar bundle from the bit bucket website. I got the version for openhab version 2.2.0 or greater. I think the publish was 2017-12-01.

The error in the log is as follows:

2018-04-22 00:13:12.315 [WARN ] [tat.handler.VenstarThermostatHandler] - communication error: org.apache.http.impl.client.DefaultHttpClient.execute(Lorg/apache/http/client/methods/HttpUriRequest;)Lorg/apache/http/client/methods/CloseableHttpResponse;
java.lang.NoSuchMethodError: org.apache.http.impl.client.DefaultHttpClient.execute(Lorg/apache/http/client/methods/HttpUriRequest;)Lorg/apache/http/client/methods/CloseableHttpResponse;
at org.openhab.binding.venstarthermostat.handler.VenstarThermostatHandler.getConnection(VenstarThermostatHandler.java:589) ~[261:org.openhab.binding.venstarthermostat:2.2.0.201712010139]
at org.openhab.binding.venstarthermostat.handler.VenstarThermostatHandler.getConnection(VenstarThermostatHandler.java:575) ~[261:org.openhab.binding.venstarthermostat:2.2.0.201712010139]
at org.openhab.binding.venstarthermostat.handler.VenstarThermostatHandler.checkCommunication(VenstarThermostatHandler.java:267) [261:org.openhab.binding.venstarthermostat:2.2.0.201712010139]
at org.openhab.binding.venstarthermostat.handler.VenstarThermostatHandler$3.run(VenstarThermostatHandler.java:296) [261:org.openhab.binding.venstarthermostat:2.2.0.201712010139]
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [?:?]
at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:?]
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180) [?:?]
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293) [?:?]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:?]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:?]
at java.lang.Thread.run(Thread.java:748) [?:?]

So, I am running 2.2.0 but I had the OSGI bundles for the apache client installed from a previous version of the binding… I removed them and restarted and I’m not getting this error. I did notice that my version might be newer than the one on the download page (not sure how that happened). I’ve uploaded the version I’ve been running, which is from February. Can you try downloading it to see if it fixes the error you’re getting?

https://bitbucket.org/hww3/org.openhab.binding.venstarthermostat/downloads/org.openhab.binding.venstarthermostat-2.2.0.jar

Thanks @hww3. It is working now.

Since I just set it up I noticed a few things I thought might improve the binding.

  1. I am located in a country with metric system. As such i have set my thermostat to Celsius. The numeric temperatures polled from the thermostat are in celsius. The issue is that the openhab assumes that these values are in fahrenheit and displays the value as 20.5 °F when it should be 20.5 °C. Perhaps is it possible to poll the thermostat to see what units it is using. If it is not possible to poll the thermostat to determine the units, perhaps an option for “units” can be added into the things “Configuration Parameters”.

  2. It would be nice if you could set/change the url in the things “Configuration Parameters” .

Thanks again for all your hard work.

Hi @bumblebeebat,

Glad to hear it’s working now… thanks for reporting the problem!

I think having the ability to specify the units makes complete sense. I need to see if the thermostat reports the unit type or if it needs to be an option manually selected. One problem is that it’s not clear to me that the value formatting capability is rich enough to permit changing the formatting programmatically. I seem to recall it being specified in an XML configuration file. Obviously this seems like a problem that other bindings should have solved already, so perhaps I can find an example elsewhere.

Is there a particular reason why you’d want to change the thermostat’s URL? I ask because the URLis specified by the thermostat as part of its discovery announcements (along with the thermostat’s internal identifier) and is kept up to date automatically. Allowing the URL to be specified independently would seem to open up the possibility of getting that internal linkage mixed up.

Hey Bill! I’ve been away from OH for a while but have finally gotten back into the swing of things. I didn’t have much in my old install so I decided to back up what I had and do a fresh 2.3 install and get things running again. Most things have gone well but when I installed the Apache components and dropped the latest binding into the addons folder my logs filled with errors. (I rolled back my vm so I don’t have the logs anymore.)

Do you know if the binding is 2.3 compatible? If not I won’t worry about it for now. If you have it working with 2.3 I’ll take another swing at it and see if I can get it working. Or at least get some logs for you.

Thanks!

~Mark

Hi Mark,

I’m just putting the finishing touches on a new snapshot of the binding. I’m hoping to have some time to upload it tomorrow. It’s 2.3 ready and supports the new Units of Measurement system. Thanks to some excellent work by @digitaldan, the apache components are no longer needed. I’ll drop another note here when it’s ready to go.

Bill

I’ve uploaded a new snapshot built against openhab 2.3; you can get it from this location:

https://bitbucket.org/hww3/org.openhab.binding.venstarthermostat/downloads/

I recommend uninstalling whatever version you’ve currently installed (the bundle:list and bundle:uninstall commands in the console can help). I’ve been using it for a week or so and it seems okay here.

Comments and suggestions are welcome!

Boom goes the dynamite! Nice work Bill! (And Dan!)

I dropped the 2.3 binding in addons and it found it right away. So far things are going pretty well, but I do run into a problem if I malform the items. It seems to drop and I see this in the logs:


2018-07-10 04:02:28.740 [WARN ] [tat.handler.VenstarThermostatHandler] - Invalid thermostat command REFRESH
2018-07-10 04:02:28.741 [WARN ] [tat.handler.VenstarThermostatHandler] - Invalid thermostat command REFRESH
2018-07-10 04:02:28.741 [WARN ] [tat.handler.VenstarThermostatHandler] - Invalid thermostat command REFRESH

If I restart OH things go back to normal and I get values again. I’ll keep playing with it until I get the values right. So far so good!

~Mark

Hi Bill. I wanted to thank you for adding metric to the thermostat display. It looks great.

I tried loading the package last night and ran into a bit of trouble. You will have to excuse me if it is something obvious, I am relatively new to openhab.

  1. The package would not start because my system did not have the jupnp package. I am not sure if a dependency like that should auto install but in my case it did not. I eventually figured out that the jupnp package is also used in the sonos binding. Once I installed sonos, the venstar binding would start. I am just wondering if there is an easier way to work with dependencies?

  2. Using the paperui I am able to change the system mode without any issue. Then I went to change the setpoint for either heating or cooling I got an error. I think it has something to do with adding metric since the logged error was:

2018-07-10 00:00:00.000 [WARN ] [rest.core.internal.item.ItemResource] - Received HTTP POST request at ‘items/VenstarThermostatMAINFLOOR_CoolingSetpoint’ with an invalid status value ‘undefined °C’.

Also when I click the arrow to commit the set point change the following error flashes up in the bottom of the browser window.

Error 400: Bad Request

Thanks for all your help and time developing this binding. It would be great if this binding was part of the default openhab bindings.

Cheers,

Sean