QSUSB API best practice

270 views
Skip to first unread message

Johann

unread,
Apr 19, 2016, 1:50:22 AM4/19/16
to Qwik-Switch
Hi,

I've written a QS driver for Home-Assistant, but have some questions on the API:

- What is the best way to retrieve the current state of a switch? Individual polling "/@000id=?" or just using "/&device?" and getting all devices back in one query? I'm getting the feeling that doing individual API calls results in queries being sent over the air for each API call, whereas a &device query simply returns the last received state of all. Although I update each switch individually I do not want to constantly poll on the air interface.

- The next step would be using button presses as triggers into Home-Assistant (although I'm still working on these use cases...Maybe a press to override some automation features, or emergency light on press,- I have some switching gear that is on a custom platform).
How would you recommend intercepting these? Constantly "/&listen" on the web interface, and opening a new connection each time a packet arrives, or rather wrap the output of the qsusb program and process as it prints on STDIN? Although the second option is not directly API related, you will probably drop less packets than a pull based mechanism where you have a certain amount of dead time after the arrival of a packet.

Btw, the qsusb application for Raspberry Pi is still reporting 1.741, even though it should be 1.9x according to your web page.

Thank you,
Johann

Terence Conradie

unread,
Apr 19, 2016, 1:56:09 AM4/19/16
to Qwik-Switch
Good morning Johann;

Thank you for posting!

 - Use "/&device?" as this queries the cache of last status packets sent from Rx devices every 15min.

 - Use /&listen with "long polling"

The V1.74 is correct, i will investigate the 1.9, thank you for bringing this to our attention .


Kind regards;

Chronos

unread,
Apr 20, 2016, 6:42:46 AM4/20/16
to Qwik-Switch
Hi terrence

I've been looking into using the buttons in a similar manner and depend on other factors, control devices.

However, I do not see any button presses while using &listen.

Is there a way to get button presses using the USB modem

Terence Conradie

unread,
Apr 20, 2016, 6:50:14 AM4/20/16
to Qwik-Switch
Good afternoon;

You would be required to add the TX's I.D's to the device list .


Kind regards;

Johann

unread,
May 11, 2016, 8:33:52 AM5/11/16
to Qwik-Switch
Hi Terence,

Thanks, that works well!

I see all button presses through &listen (scene/off/normal) without having to add them anywhere

Cheers,
Johann

Werner Fraser-Vorstman

unread,
May 18, 2016, 10:58:56 AM5/18/16
to Qwik-Switch on behalf of peter. wilite

I added the id and I started seeing the button presses for the specific transmitter. Could it be that the windows app differ slightly from the Linux version on the TX monitoring?

--
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/54eaffd7-3065-4e37-9097-5a3f11b0ccfd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

PollieKrismis

unread,
May 18, 2016, 10:59:26 AM5/18/16
to Qwik-Switch
Hi Johann,

Are you an iPhone user? If so, does Home-Assistant allow integration with Siri?

I've managed to get Siri integration to QSUSB going using a HomeKit HomeBridge (software only), but am not sure how long Apple will "allow" software only HomeBridges to exist.

Is your QS Driver something you are willing to share or are you planning to make it available via the Home-Assistant website? I'll want to have a look at it to compare it with the HomeBridge solution.

Thanks

Paul

Johann

unread,
May 19, 2016, 5:56:12 AM5/19/16
to Qwik-Switch
Hi Chronos,
Glad you got it up and running. Might be, I also have version 1.7x iso the 1.9x.

Cheers,
Johann

Johann

unread,
May 19, 2016, 5:56:12 AM5/19/16
to Qwik-Switch
Hi Paul,

I have not tried Siri integration, but it will probably need such a software bridge setup for HA as well. There is integration for Alexa /Echo in HA. I personally only use the iCloud tracker at the moment. Come home and my Qwikswitches starts switching...

The component for Qwikswitch should be in home-assistant 0.20 that should be released this weekend. Feedback welcome.

Regards,
Johann

Johann

unread,
May 19, 2016, 5:56:12 AM5/19/16
to Qwik-Switch

PollieKrismis

unread,
May 19, 2016, 11:42:56 PM5/19/16
to Qwik-Switch
Cool thanks Johann, I'll look out for it and try and set it up on the weekend in order to give you feedback. 

I'll have to upgrade my raspberry pi to a model 2 or 3 as I've run out of RAM with everything I'm trying to do on it :-/

PollieKrismis

unread,
May 23, 2016, 3:53:33 AM5/23/16
to Qwik-Switch
Hi Johann

First of all thanks for all the work and making it available to us!

I tried Home Assistant 0.20 but could not get it to work with my QSUSB. I posted my error log on their forum.

The only thing I could think of is that I use brackets "(" in my device names for items that have a similar name, but I doubt it.

The other thing is that I use QwikCords that measure consumption and they are not fully supported in QSUSB.

An example of how it returns with the &devices query is as follows. (Many of the fields are null)

{"id":"@123456","name":"Towel Rail (Guests)","type":"rel","val":"","time":"","rssi":""}

Looking forward to what it looks like in home assistant.

Regards

Paul




PollieKrismis

unread,
May 23, 2016, 3:53:33 AM5/23/16
to Qwik-Switch
Ps. And when it is in use...

{"id":"@123456","name":"QwikCord (On example)","type":"rel","val":"4733800000d50001","time":"1463946854","rssi":"64%"}

The value it returns is total consumption to date.

I'm still waiting for someone to tell me how to unpack it and convert it to kwh

Hope it helps...


Johann

unread,
May 23, 2016, 5:59:40 AM5/23/16
to Qwik-Switch
Hi Paul,

I only have relays and LED dimmers, so for relays it only recognizes "ON" and "OFF" in value, else it will force OFF for now.

Will look at the HA forum posts in more detail tonight (not sure why the name changed in your example? but it looks like off is empty string and for "ON" it shows usage). Makes it a bit challenging that both is type "rel" with such different behavior.

Might have to get one of these to play around a bit. I did not know it measures kWh, which is pretty neat!

Regards,
Johann

PollieKrismis

unread,
May 23, 2016, 7:00:36 AM5/23/16
to Qwik-Switch
Hi Johann,

Yes, I used two different QwikCords to show you the difference between ON/OFF.

You can gmail me directly at PollieXmas as it's a bit of a pain having to wait for messages to be "approved". I'm also willing to help debug it for you as I need to understand how it works if I'm going to do the same for my Paradox Alarm.

I've been asking them to support the QwikCords in QSUSB for about a year now, as it creates all sorts of ugly work arounds when trying to cater for them in your programs as normal relays.

Regards

Paul



Johann

unread,
May 23, 2016, 8:50:02 AM5/23/16
to Qwik-Switch
Great, will send you a PM and we'll get those QwikCords working :-)

timg...@gmail.com

unread,
Jun 24, 2017, 12:47:44 PM6/24/17
to Qwik-Switch
Hi Johann

We're looking at QS solutions and was wondering the status of your integration project?

Thanks

Tim

Johann

unread,
Jun 26, 2017, 1:14:11 AM6/26/17
to Qwik-Switch
Hi Tim, been using it for the last year, it works well - https://home-assistant.io/components/qwikswitch/

Keshav Gajanand Maharaj

unread,
Oct 3, 2022, 6:42:01 AM10/3/22
to QwikSwitch

Hi all, I am new to home assistant, and I am trying connect my usb as Wi-Fi bridge to home assistant, I read the api link, not sure what url to use?
Reply all
Reply to author
Forward
0 new messages