I want to know how you did everything. I am new to ST and have much to learn however I was imagining using Pi to integrate ST with my Vantage system. I have been playing around creating a WebAPI to act as middle ware between Vantage and the outside world - (e.g. http://localhost/vst/api/Switch/82 sends a button press to VID 82). ST developement seems better suited for an HTTP Web API but again, I don’t know much about ST.
Right now, I just can’t wrap my head around how it will look logically on the ST side. What sort of device handlers - for a switch, a keypad, a load, a task? Like you I have many devices on Vantage and I am a bit of a programmer too and would love to be able to use ST with Vantage but I am struggling with where to begin. Can you suggest a good starting point for developing my first device handler? Do you have something I can use as reference?
There are three very helpful sources of information for people getting started writing smart apps and device type handlers.
First, there is developer documentation. Go to the first page of the community by clicking on community in the upper right of this page. Then click on “developer documentation” and you will find all the basic information for writing a smart app, including a web services Smartapp.
And finally, there is a developer section of this forum where you will find lots of people happy to help you with details of writing smart apps or device type handlers.
I see JDRoberts has some dev links to get you started. It’s really been so long now I forget what I even read, but I know it was a completely scattered, shotgun approach until I had my first device handler working for a switch Then iterations…
Regarding the Vantage, it sounds like you already see that not everything will have a direct mapping. I did the programming for my Vantage system, so some buttons directly map to a single load, others control scenes, some are dimmable while others are not (appliances), I have some sensors connected, etc. In the end I ended up making 5 different device types for SmartThings:
Vantage Switch - for on/off only control mapped to a button (which may control a single load, or a lighting scene)
Vantage Dimmer - for on/off and dimmer control of a specific vantage load
Vantage Sensor - for the floor sensors I have by stairwells and beds
Vantage Group - this is an odd one, just in that I have 5 special buttons programmed that basically show the status (and do control) a large group of lights – basement, main floor, upstairs, outdoors, and whole house. So if everything in the house is off except for one light upstairs, then the “upstairs” and “whole house” buttons would be “on”. Pressing either with turn off the light and both buttons to off. So it needed a little special behavior for ST for these.
Vantage Reload - this is also a special one that is basically for a ST button that will reload (send back to ST) the current state (on/off, dimmer level, etc) of all the defined vantage switches, dimmers, sensors, etc. ST has gotten much better, but back when I was making this things were pretty rocky and ST could easily get its view of my devices’ state wrong over time – as their servers were overloaded often. So this button would reset everything to the correct current state. Only tricky part is that the ST API has rate limiting and I have a lot of devices defined , so it accommodates that. Was a nice addition though, as now I just have ST run that button automaticallly at 3am so I know each day should be starting out right
I guess if I were you I would start out with a simple HTTP API to turn a switch on/off and then work to hook that to a custom ST switch device handler. You’ll learn a lot in that first pass. I’m not a Java/Groovy guy, but in the end it wasn’t that bad starting by copying some example code out there.
I’m not sure what Vantage system you have, but one other possible tip is that I did end up making some “virtual” buttons on the Vantage side also. Basically for things I wanted ST to do that I didn’t want a physical button on a keypad for on the Vantage side.
Well that got long… Enjoy, I still remember that winter project
Lucky you I’ve looked at doing the inFusion controller upgrade, but haven’t pulled the trigger. Partially because I now have remote control of everything and was having some fun messing with HomeKit. Maybe someday, but the API commands are quite different, which would require some real work on my end also. The older Q-Link API I used is much more terse and cryptic. I think you’ll have a much easier route there.
That will be helpful also, as with the older Q-link stuff I had to interface with buttons, loads, sensors etc via different IDs/types and with different calls, which made everything bigger and more complex. That lead to creating quite a few virtual keypads on the Vantage side to do what I wanted. Sounds like that’s improved.
I manually had my system do a one time dump/manifest of all button, load and sensor ID / location info initially, which I then parsed into a large file that loads all that catalog into some variable objects when my API starts up. So on startup, after that’s loaded, it goes through and asks Q-link for the current status on everything. It isn’t one call for every button, load, etc, but like one for each keypad (that gave me all the button status for that keypad), one for each load module (that gave me status of all 12(?) loads it handled), etc. At that point my API is “ready” to start and has the current state of everything which it goes and feeds to my SmartThings app. I’m betting InFusion will have better ways to dump a list of everything and the state info though. Looks like there might be a “STATUS ALL” command even.
The only other real trick was to try and keep SmartThing’s idea of the state inline with the actual Vantage state. Obviously if everything is triggered through SmartThings buttons and routines, that wouldn’t be too bad. But that’s never going to happen, since there are real keypad buttons in the house that everyone uses most of the time. So my API listens for button presses, load level changes, sensor changes, etc and feeds that back to my SmartThings app to keep it accurate.
[quote=“johnsev, post:2003, topic:42547”]…Any chance you would be willing to share your device handlers with me? I’ve tried looking at others but I struggle with how to apply them to my use case. I suspect yours will be the closest to my use case as possible.
[/quote]
I’ll DM you with a few files here, but to be honest I’m very hesitant, for several reasons. One is that I know there are some REAL hacks in there and there are better (more correct) ways of doing some of the things I did back then – I’m just too lazy to go through and re-work things now. So I don’t want you to go down the rabbit hole thinking it’s the right way. Hell I can barely remember what, why, and how I did some of the things at this point, and can see the effects of some late-night Bourbon infused sessions in the code. (for example I have some GETs that should have been PUTs, so you can’t even interpret the REST verbs literally ) So you’ve been warned!!
FWIW I actually used code from this project as my initial inspiration – as it had the two way communication (to SmartThings and from SmartThings to private IP API) that I was after:
Thank you. I understand your concern but not to worry. I generally know the difference between a sloppy code and good finished code. I don’t write very much good code but at least I know when I’m writing garbage. I’ve found that the difference between sloppy code and really good code is about 4x the time so when I get something working well enough, I leave it there. Most of the stuff I write is for less than 10 users.
I took a quick look at that link. From what I see, it appears that it requires a main app to tie everything together between devices, the remote system, and the communications between them. Is that right? I think the ST documents are not very good for someone wanting to undertake something like this.
It’s been a year - looking to do much the same over the xmas break. Did you make any progress? I’ve seen https://www.npmjs.com/package/vantage-infusion as a nice middle-layer for sniffing Vantage VIDs. Happy collaborate.
I have it all working in one direction - SmartThings can command my Vantage InFusion system. I wrote a Web API in VB.Net and it runs on my home laptop. Once I got it working, I didn’t do much more.
I started working on a service that listens to Vantage events but never finished.
I recently added a Google hone mini (at $29 I couldn’t resist) and can do voice control with SmartThings. The problem is that if SmartThings and Vantage are not synchronized, Google home doesn’t work right. If a light is off but SmartThings thinks it’s on, then telling google to turn it on does nothing. But if we tell google to turn it off then on it works.
Hey how are you? I noticed that you have done a ton of work on a Qlink system. I have a Qlink system and would like very much to keep it without upgrading. I’d like to jump and start integrating. All that said, would you please share all you have so I can learn from your work? I know it may not be the best or organized or whatever, but trust me I need as many examples as possible! If anyone has any Qlink integration or tips or anything please DM me.
I’m sure you have much better things to do but any help would be appreciated!
Well, to be honest it’s a pretty lengthy topic, and sample code alone won’t get you to the finish line I’m afraid.
Like to start, I assume you have the old Vantage Q-Link software and have used it to connect and explore/program your Vantage system a bit? As you’ll really need that to inventory the loads, switches, etc that you’re wanting to integrate. Also the “Help” doc in that software actually contains all the information on the Q-Link “V Command” protocol the system supports over its serial port to issue commands and read system status. And you’ll likely need to bring that serial port on your network with a serial to IP adaptor to make it easier to access.
That said, what I wrote is basically a very custom (and now very old) Node.js app that integrated my Q-link system and Honeywell alarm system with ST. While it works for me, I’m quite sure it’s not making the best/proper use of the SmartThings API and is quite old/raw code (no promises or async/await, etc) Literally thrown together while I was picking up Node long ago. So really unless you’re familiar with Node and JS, I wouldn’t recommend it. I’ve been meaning to re-write it in a more modern way, considering I still use it a lot. Just haven’t really had any time.
If for some reason this all still seems exciting to you, let me know and I’ll see what I can dig up code wise.
@johnsev you wouldn’t happen to have that smartthings.zip file I sent you via Dropbox still would you? Looks like I removed that and Dropbox doesn’t have it any longer. That was at least scrubbed of passwords, tokens, etc which I’d rather not do again. A long shot I know…
Oh no. I have InFusion controller and I have the programming software as I maintain my own system programming. I know all my VIDs, loads, tasks, etc.
I command every load right now from ST. I just don’t have the interface in the opposite direction.
I have already written a listener program that captures all the events from Vantage. Design Center comes with tools that show how it’s all done. So I can capture button presses, load changes, etc. And I know how to parse the returned data. So far it’s just hard coded to capture a few basic events. I have not written the piece that forwards an event to ST although my ST app and device handlers are setup to receive those messages.
I am very familiar with JS but mainly in browsers. Actually, a few years back, I wrote a VB.Net app with an embedded V8 JS runtime engine using Microsoft ClearScript. So I can handle JS I’m just not a Node guy. I am most familiar with .NET. The little listener program I wrote in VB.Net.
I think I can do it, I just haven’t had the time. It is more pressing now because IOS 11 just broke my Vantage mobile app and it won’t even open in IOS 11.
@johnsev sorry for the confusing message. My reply was actually for David, but was just curious if you may have still had the zip file I shared long ago. No worries though. Glad you hear you made progress there w/ your InFusion system.
Thanks a lot, yes I’m using the Qlink system and really don’t want to upgrade to the Infusion. I can tell you have put a ton of time into this! I’d love to get whatever you have and I complete understand it is old and all the disclaimers! Also if you have any suggestions or any other ways to control Qlink from iPhone or Android, please share whatever you can. Thanks!
I should also mention that I do have the IP enabler and have sent V-commands to it with an old APP that is no longer available, so I have a very basic understanding.
@sdDavidL I cleaned out some sensitive code and DM’d you with a zip file and some random notes. But honestly that’s as far as I can really take this, as I really don’t have time for another rabbit hole in my life
In the end it involves setting up and creating a SmartThings App, various SmartThings Device Types, manually creating a bunch of SmartThings devices with unique IDs, a bridge to the Vantage w/ API that can be called, and gluing everything together with configuration based on the specific switches, loads, etc you have.
It’s one thing to have SmartThings send commands to the Vantage bridge/API, but really you also have to contend with updating the state for Vantage devices in SmartThings both initially and when they are updated outside of SmartThings (e.g. someone hitting buttons on keypads, or Vantage automations, etc). Not to mention SmartThings isn’t exactly “perfect”, so sometimes it needs the states reloaded (which I do automatically every day at 3am).
So really it can get pretty complicated. Looking at the code, I don’t even remember portions I wrote Couple that with the fact that I wrote this long ago while learning Node, and am still not sure I did the SmartThings side the “right” way (never even saw Groovy before this) and that about sums it up!
A few years ago I bought a house as well that had a full Vantage Q-Link system running almost every load in the house (fans, fireplace, lights, etc.). I have come to the point where I do most of the programming and switching myself, and I recently installed a SmartThings hub.
@Moonshine any chance you would be willing to share your code here as well? I am a software architect so I am primarily looking for any jump start so I don’t have to reverse engineer the protocol myself. I promise I won’t harass you with questions
It looks like the last owner left an IP Enabler plugged into the system, so I am hoping to write a server that willc communicate to that or over serial. Anyways, should be fun.
I’ll DM you the notes and files I sent David. But be warned, while it may seem like a jump start, it will more likely be a frustrating rabbit hole.
It’s very a very old (I think back in the Node 4 days) and crude first attempt. I never followed through on re-factoring it, as I kept thinking I should probably jump to an InFusion controller if I’m going to put in the effort. (which has a different and better protocol) If I re-did it today, I feel like it would be close to a complete re-write
So take it for what it’s worth, and know the info I’m giving with it is incomplete. Even combined with my previous posts above, I’m sure there are items you’d have to deduce from the code to figure out (like how the ST device ID’s are formatted for the vantage devices). It hurts my head to think about it.
I’m a long time Vantage dealer (over 20 years), and am interested in integrating my Infusion systems with Smartthings as well as IFTTT.
Most of what you are saying here is way over my head.
That being said, if there is any way someone has come up with an easily integratible plug in, please let me know.
Conversely, if anyone needs help with Vantage prog, I am happy to assist.