--
You received this message because you are subscribed to the Google Groups "Qwik-Switch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to qwikswitch+...@googlegroups.com.
To post to this group, send email to qwiks...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/qwikswitch/bc9b5301-5473-4171-a5fd-24fb449d1a6e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Here are the steps I followed... There might be gaps/mistakes though as some of it is from memory...
Follow instructions here to setup your pi and load node.js…
https://github.com/nfarina/homebridge/wiki/Running-HomeBridge-on-a-Raspberry-Pi
If you are not going to use a pi then follow the steps here to install the home bridge as it also has some instructions for linux…
https://github.com/nfarina/homebridge
The home bridge needs accessories to be useful so I used the first plugin that looked if it could work…
https://www.npmjs.com/package/homebridge-http
I altered the sample (http) config file to look like this…
"description": "HomeBridge QwikSwitch Status Control",
"accessories": [ {
"accessory": "QwikSwitch",
"name": “Garage Light",
"switchHandling": “yes”,
"http_method": "GET",
"on_url": "http://myip:myport/myrelayid=100",
"off_url": "http://myip:myport/myrelayid=0",
"status_url": "http://myip:myport/myrelayid=?",
"service": "Light",
"brightnessHandling": "no",
"brightness_url": "http://myip:myport/myrelayid=%b",
"brightnesslvl_url": "http://myip:myport/myrelayid=?"
}
]
Make a copy of everything between the square brackets for each QwikSwitch relay/dimmer you want to control. (Place a comma between each accessory/curly brackets.)
If you leave the accessory as “http” i.s.o. “QwikSwitch” you do not need to alter /usr/local/lib/node_modules/homebridge-http/index.js as follows.
homebridge.registerAccessory("homebridge-http", "QwikSwitch", HttpAccessory)
When you (re)start HomeBridge you should see your accessories listed.
pi@raspberrypi ~/.homebridge $ homebridge
*** WARNING *** The program 'node' uses the Apple Bonjour compatibility layer of Avahi.
*** WARNING *** Please fix your application to use the native API of Avahi!
*** WARNING *** For more information see <http://0pointer.de/avahi-compat?s=libdns_sd&e=node>
*** WARNING *** The program 'node' called 'DNSServiceRegister()' which is not supported (or only supported partially) in the Apple Bonjour compatibility layer of Avahi.
*** WARNING *** Please fix your application to use the native API of Avahi!
*** WARNING *** For more information see <http://0pointer.de/avahi-compat?s=libdns_sd&e=node&f=DNSServiceRegister>
[5/12/2016, 7:31:06 AM] Loaded plugin: homebridge-http
[5/12/2016, 7:31:06 AM] Registering accessory 'homebridge-http.QwikSwitch'
[5/12/2016, 7:31:07 AM] ---
[5/12/2016, 7:31:07 AM] Loaded config.json with 1 accessories and 0 platforms.
[5/12/2016, 7:31:07 AM] ---
[5/12/2016, 7:31:07 AM] Loading 1 accessories...
[5/12/2016, 7:31:07 AM] [Garage Light] Initializing QwikSwitch accessory...
For the HomeKit phone app I used Ezzi Home, but I guess you can use anyone that you prefer.
On Ezzi Home I added my house, then added a room (Garage) and added the Garage Light to the room. You can then use the app to manually switch the (garage) light on/off, but it does not report the status correctly. There are also some funnies when added accessories to scenes, but this can be user error too ;-)
Based on the example you can then ask Siri to switch/turn on/off the garage light.
If you know what you are doing, you can probably have this up and running in a few hours.
The funnies I have traced to the fact that the http plugin javascript expects a simple 0/1 back when it queries the state of the light. I plan to test this theory by parsing the json, that QSUSB returns. Once I understand everything a little better and I can make it work properly and specifically for QwikSwitch, I want to ask how I can get it published on npm. That should make it easier for others to implement.
Also as you can see the mapping from the qsusb devices file to the accessory file is pretty easy so can possibly be scripted to keep the HomeBridge in sync with QSUSB.
Let me know if it works for you.