I have a thermostat set up with a screen lock PIN. When I try to use this module with it, it gives me the error Thing ‘venstarthermostat:colorTouchThermostat:hall’ changed from ONLINE to OFFLINE (COMMUNICATION_ERROR): Wrong PIN. Is there a way to send a PIN with the module? I don’t see anything in the documentation.
I don’t believe there’s currently a way to pass a pin to the thermostat, and in fact, the Venstar only recently included a mention of a PIN in regards to the API. However, they don’t actually say how to provide it ![]()
Might take a little research to figure it out. This week is a little busy for me, but I’ll try to find some time to look into it.
When I was trying to look into it, my search engine AI suggested it may be as easy as appending the PIN to the url:
‘’’
When a security PIN is set on a Venstar thermostat, it must be included in the URL as a query parameter, specifically ?pin=xxxx, where xxxx is the PIN code. Simply including the PIN in the POST request body or headers does not work; it must be part of the URL path. This requirement applies to all API requests that require authentication, such as those sent via HTTP POST to control the thermostat.
‘’’
So i checked another venstar API client, and @dathbe is correct, if a pin is configured in the client, they include it as a URL param on every request like ?pin=xxxx
I can hold my own when coding simple things, but I’ve never tried to edit an OH module.
I would think we could accomplish this by adding an optional thing parameter of PIN. If PIN is set, pass the extra url language; if not set, send the url as currently exists. Hopefully this is an easy implement? I could volunteer to update the documentation.
Or…even easier, I would bet that the API is happy to accept an empty ?pin= if there is no PIN set. Less clean, but would avoid the need for extra logic. Just default PIN to blank or 0000 and update the url for all calls.
I’ll take a look at this tomorrow. Shouldn’t be too much work to add an optional PIN to the configuration.
My gut feeling is that passing a pin where one isn’t configured would result in an authentication failure, so it’s probably easier to just pass it when needed.
If I build a test version of the binding, what version of openhab are you running?
Stay tuned!
Since its a query parameter, and not say a Bearer token or something in the header, i would guess its harmless to pass in even if there is not a lock on the device, but yeah i would only add it if the user has set a value for that (new) config option…… but i can’t say for sure, you’ll have to let us know ! The API docs are rather odd in that they mention needing a pin, but then do not explain how to pass one in, strange.
Hi-
I’ve prepared a test version of the venstar binding that includes support for passing a pin on update requests (as described by the venstar developer documentation.) I don’t have a thermostat that requires this, so I haven’t tested all of the functionality, but it’s a simple change and we should know if it works pretty quickly.
You can try this by uninstalling your existing venstar binding and dropping this jar in your addons/ directory. Please give it a try and let me know if you still get errors.
https://bill.welliver.org/dist/openhab/org.openhab.binding.venstarthermostat-5.0.1.jar
It’s working ok for me.
It took me a while to figure out the new config, so for anyone else who is trying, just add a pin=0000 to the thing config for your thermostat. The full thing should look something like:
Thing venstarthermostat:colorTouchThermostat:MyTStat "Venstar Thermostat" [ username="MyUsername", password="MyPaSsWoRd", url="https://192.168.1.1", pin="1234" ]
And yes, that’s the kind of combination an idiot would have on their luggage.
Hi-
Glad it’s working for you. I apologize for not providing details of the configuration for files, I’ve been using the UI for configuration.
If all still seems well in a week, I’ll work on getting a merge request submitted. Do let me know if you experience any difficulties!
I’ve been using it for almost 2 weeks now without any issues. Thanks.
Lol, i use that quote all the time, but i’m not sure anyone gets it anymore… at least my car goes plaid ![]()
May the Schwartz be with you