Develop a driver - (Venstar Thermostat Driver Development)

now, I'm more confident with HE. installed a lot of devices, built-in apps, created rules, etc.
I also installed third party apps, so I know more about the "way to do".
Now, I'm stuck with a Venstar thermostat. There is an (unfinished) app here, not working with my T5800. And I want to make it work ! It works and has all the features I need.

I have some other tools able to connect through TTL, some devices able to connect through post/get, etc and I want to integrate them into my HE.

So, I'm willing to (try to) develop myself an app [*Edit: mostly a driver like @bertabcd1234 explained to me in his reply] to control it.
I checked the doc section but those explanations are beyond my knowledge (for now).
Groovy ? Well, it's a new name for me (when I installed my first third party app).

I saw here guys, writing something like "hmm, using a complicated rule ? Will write my own app, faster..." That easy ?

I have some time and capabilities. I programmed several languages in my life, so not really afraid of learning new things. But I need some guidance.

Can you explain me briefly (good links too are welcome ) what to do at first ? Learn a new language (which one) ?

Thank you all of you

1 Like

First, it looks like you're actually trying to develop a driver and not an app. In general, drivers--as their name suggests--tell Hubitat how to communicate with real-world devices, and they also abstract away lots of implementation details (like what protocol the device uses: Z-Wave, Zigbee, LAN, etc.) from the user. Apps are more or less automation templates that help you control the device after its already on Hubitat. So, unfortunately, if you are familiar only with apps, it won't help much here aside from the fact that both are written in Groovy.

Hubitat's developer documentation is not great at the moment. However, it is quite similar to that of SmartThings, for which there are decent docs. I've summarized this here before: Developer detailed API documentation

For drivers, I'd also recommend you familiarize yourself with the term "capabilities." Aside from buttons, Hubitat's are pretty similar to ST's, so what you see for the thermostat-related capabilities should transfer. Basically, capabilities are contracts you can claim your driver adheres to and require the implementation of certain attributes and commands/functions. It's then the job of the driver to act as the middle man and receive/parse reports from the device and send commands to the device. That's something not Hubitat- or ST-specific; in your case, you'll need to know the API for that thermostat.

There's also the Groovy language itself, but it's similar to Java (to which it ultimately compiles), which itself is similar to various other C-style languages. There are probably lots of tutorials online. Keep in mind that Hubitat doesn't let you access Groovy's full set of built-in libraries and Hubitat provides a bit for you on top of that (the docs explain this), but everything you need to write a LAN-based driver should be there.


Thank you for this clarification !
Will follow your link and learn a little bit more about drivers and way to write them.
The API for the thermostat itself seems not vey complicated (at first) and well described:

Cross your fingers, I'll plunge on it with pleasure... And I hope to submit (for my own and maybe for others) a fully functional Venstar driver for HE :joy::joy::joy:

1 Like

Middle of the night, away from my "smart" bed :thinking::thinking:

I found that Venstar has Zigbee and Zwave+ modules for their Voyager "new" (year 2016, aka older than my T5800) model . But nowhere (even in their website), we can find this module !
Only (but in fact, could be a good choice too) a Z-wave+ module for their Explorer series.

But (a lot of but with Venstar), the T3700 is sometimes called Voyager, sometimes Explorer...

Consequences: sent message to Venstar to see if Zigbee module is still available.

@bravenel, maybe obvious for you, may I assume that a Venstar Z-wave+ / Zigbee thermostat could/should work natively with HE ? I'll probably purchase this as a test/exchange and see what happend, easier than programming a driver :sleeping:

*Edit: found this:
Venstar Z-Wave module

does this info helps you ?

Depending on the cost of the radio module, it could be cheaper in the long run to just replace the thermostat with one that's already on our comparability list


Indeed, but unfortunately those thermostats are not provided with an external temperature sensor (even optional), and in my case, I really need an external sensor. Only the sinope has one but it's not compatible with geothermal units with fans (just hydronic).

@tsand, @JasonJoelOld, @jabecker

About that Venstar Hubitat driver...

Because I'm obviously stuborn somewhere, I dig a little bit the driver @dtarin wrote, without knowledge but some critical sense.
I tried to run a RM4 with a direct url post (thx @bravenel for your help, but I'm far from that), without success.
So, I read the driver code and searched why this thermostat is not running as expected.

I found a little (a tiny little) explanation and maybe this community will help me learning more.
On the code (line 318), there is a
body : command,
and I obtained an error in the log when trying to set a command on the driver commands page, except for the fan ON and the fan AUTO modes... weird
I changed the line body: command, for this:

  "mode=1" + "&" //setting mode  0:OFF 1:HEAT 2:COOL
  + "fan=0" + "&" //fan mode: 0:AUTO 1:ON 2: unknown (maybe timer)
  + "heattemp=25" + "&" // heat to 23 celsius
  + "cooltemp=21" // cool to 21 celsius [obligatory lower in heat mode]

and it works ! ok, not fully as expected, but...

pushing any command button (because I removed the command, instruction), I'm able to change the settings in real time in my thermostat. Please note that I work in Celsius, but the idea is the same.

on this long body command, if I change mode (from 0 to 2), it works. If I change fan (from 0 to 1), it works... the heattemp must be higher than coolmode in HEAT mode and I suppose this statement is valid in cool mode too (not tested, Quebec here, Winter is coming).

But after this, I can maybe assume that the body: command, is defective somewhere because to obtain a valid result, the body command must contain a big concatenation (and not a single action).
But I reached my limits here. Anyone can help me understand further ?
Thank you

This is a limitation of the Venstar API... All values MUST be set at the same time and in the specified order. If any are missing, or they are out of order, the API will throw an error.

In addition to the heattemp being greater that cooltemp, the must differ by at least the value defined by setpointdelta (which can't be set by the API).

The driver you linked does not work because it tries to set the parameters individually. As is speculated in the comments in the driver, there will need to be state variables to hold the parameters, so that they can be individually changed and then sent to the API all at once.

Does it mean I could define some global variables (and connectors to define them in a tile) and concatenate them all into one string and inject that string into the driver (if it's possible of course)?
Or should I throw that nice thermostat and buy a new one ?

You could do it any number of ways... The driver shell you currently have is not too bad... And I'm currently bored... So if you hang on a bit, I'll post an update that should get you working....

What can I say ? No ? :thinking:
Of course, take your time.
I managed, because I'm really into it (and because it amuses me) to create some connector to generate a "Venstar string", depending of the button pressed.
Maybe it's absolutely useless, it will be a kind of practice...

Anyway, thank you in advance !

This should get you working.... You should be able to link it to a dashboard "thermostat" tile...

Replace the existing driver code with the code below, save it, then refresh the device... It should get the thermostat state from the thermostat and display a bunch of parameters under "Current States" and "State Variables".

Be aware... I do NOT have a Venstar thermostat, and my Venstar emulator is MIA... So make sure you post any error, so we can figure out

UPDATE: Removed old version...

You're bored, but obviously, you're not lazy :laughing:

Installed the driver. I obtain now some info (on the right side) on the command side of the device. But not everywhere. Fan mode (auto/on) info is displayed but without effective results (the real thermostat doesn't run). Same for heat/cool mode: info displayed but no run.
some null on the setpoints, whatever the settings (celsius or Fahrenheit). my thermostat is set in celsius but I can change this for making things easier for you.
On the tile, no info displayed and no changes possible.

That's the technical info. I'm tired here (1:30AM). Thank you for your changes, I'll try tomorrow to replicate/see more !
Thank you again for the time spent on this.

Ok... Please post the log info for the device so I can see what it's doing...

I have now a tile with some info !
I tested twice: first clicking on the tile (no results) and then on the device commands directly
here are the logs, heattemp value (null) seems have a problem

*Edit: nope: I have to set a heattemp value before doing anything !

venstar log 3: after setting heat and cool

1 Like

Ok... A new version...

This one should work better... Once you upload the new code you will need to execute the initialize() function...

UPDATE: Removed old version...

I did install your updated device.
At first, nothing changed on the tile, even after initializing. Hours later (don't know exactly), the tile displayed the settings and I was able to modify them.
I tried to change the temperature and the result was weird: from 112 to 3900+F, just by pushing the increase button.
Hopefuly (...), no effective effect on the thermostat itself. fan changes, mode changes, setpoint changes have no real effect on the thermostat.

I'll try to change the settings to Fahrenheit, to simplify what you've done here.
*Edit: I've changed my thermostat to fahrenheit.
on device commands. when I modify values (set cooling point AND set heating point), I obtain consistently (increasing or decreasing values):
65 -> 149
70 -> 158
80 -> 176
75 -> 167
65 -> 149
the log is the latest pic below

Here are the screen capture, including commands and logs.

after changing thermostat to Fahrenheit:

Ok... I see the issue with the temp... looks like the temperature scale from the Venstar is not being parsed...

I need to see what data the thermostat is returning from the getapi() call...

Please go to the log page in a seperate browser then click on initialize, and post the log showing everything that happens after the initializing entry...

I edited my previous message with temperature changes
this is the log after initialization.

when I increase temp on the tile (1 step), doubled the value (from 149 to 298)

Download the Hubitat app