Help needed to control non-SmartThings devices (QwikSwitch devices)


(Hendre) #1

I make use of a system called Qwikswitch at my holiday home. Is it a system I installed before SmartThings and is intended to provide for aftermarket installation of light switches by simply sticking the (radio) switches to a wall. Devices can be remotely controlled via a hub (which connects to the internet via GSM) for which an API is available. An online webpage for the API (similar to that for the Philips Hue Bridge) is avaialbe here. (Hope I use the correct terminology.)
Commands typically look like this:
https://qwikswitch.com/api/v1/control/:API_KEY/?device=:DEVICE&setlevel=:LEVEL
https://qwikswitch.com/api/v1/state/:API_KEY/

I don’t have a programming background, but through trial and error and with a “monkey-see-monkey-do” approach, I managed to set up a piston to turn devices on/off by way of GET requests.
It is, however, a very basic solution and my rudimentary solution does not tell me what the status of a light or a switch is.
How difficult would it be to write an app to link the Qwikswitch hub to Smartthings to control devices and to get the status of the devices? Is such an app the only solution or is there some other way to accomplish this?
Other relevant info:

  • Devices can be switch by way of GET requests over the internet
  • There is no direct access (over network) to the Qwikswitch hub that I know of – only access is via the internet
  • The requirement is to turn devices on or off and to get an indication of the status of devices (on/off).
  • Devices are primarily switched via wall switches (consisting of a button sending a radio signal directly to a relay (switch). The Qwikswitch hub always knows what the status of a relay is.)
  • A possible complication is that the API (from my limited understanding) only has a command to get the status of all devices, and not of a single specified device. The history of a device is however also available, which could possible be used to determine the status of a device?
  • There is no IFTTT integration for Qwikswitch.

I’ll appreciate any input or suggestions from the programmers among us.

Edit: I should maybe add that QwikSwitch has a USB-hub which could also control the devices. The commands (available here) are similar to those for the GSM hub to which I referred to above, so I don’t suppose the USB-hub will be an easier solution. The disadvantage of the USB hub (for my purposes), is that I’ll have to add a either a Windows PC or a R-Pi to the setup, which is not ideal, since being located at my holiday home, I want to limit the always-on devices to the minimum (and I already have the Qwikswitch GSM-hub running all the time.)


#2

You can use webcore to post a Get request to control the lights. What I would recommend you do is to create simulated devices and then use Webcore to either update their status every so often or initiate the change if they are changed in ST. The only problem with that implementation is that there will be a delay when they are updated locally before they get an update in ST. You can go over to the WebCore community to see how to write Pistons to launch the GET requests.


(Hendre) #3

Thanks for the input @Ryan780. I already have such a setup (with pistons and virtual switches). The issue is getting the Virtual Switch to report the state of the actual switch. But I’ll ask over at the webCoRE forum - maybe there is a solution.
I had hoped that there is an easier way of perhaps adapting something like the Hue Connect app.


#4

There’s a command listed right in the documentation you posted. There’s a command to return the status of all the devices. Then you can parse those into the virtual switch statuses. I’ll put an example together for you later today.


#5

Take a look at the attached. You’ll see setting the variable you defined to the arg from the other system however you could use that to set device status as well.


(Hendre) #6

Thank you Ryan, much appreciated. Having no programming background, I don’t understand anything of what you’re explaining, but I’ll play around to see how far I get - sometimes I manage to figure these things out.
Again, thanks very much for your time.


(Hendre) #7

Since this discussion turned into a webCoRE discussion, I thought it would be better if we continue the discussion on that forum as far as a possible webCoRE solution to my problem, is concerned. I have therefore created a new thread on the webCoRE forum.

Any further suggestions regarding what I’m trying to accomplish, would be appreciated.


#8

That was just a placeholder with what the other device will send back to smartthings in the json message. I don’t know what your devices are names so i wasn’t able to give you a working example.


(Hendre) #9

Should the name be the name of the Virtual Switch or the device ID as reported by the response.


#10

It’s whatever is going to be reported to ST. Maybe you should read a little about how webcore works and then try something this complicated. It’s not going to be easy. And it’s either going to work or not. There really won’t be a grey zone.