Author Topic: Luup Plugin: SQBlaster interface  (Read 32129 times)

Offline guessed

  • Master Member
  • *******
  • Posts: 5294
  • Karma: +90/-22
  • Release compat is not a bolted-on afterthought
Luup Plugin: SQBlaster interface
« on: January 09, 2011, 09:16:20 pm »
I've uploaded 2x XSLT files to code.mios.com that can be used (with a freestanding XSLT Tool) to "transform" an XML Device file, from SQRemote's backup, into the requisite I_xxx.xml and D_xxx.xml files for MiOS to talk directly to the Puck.

They're prototypes right now, and currently untested.
    http://code.mios.com/trac/mios_sqblaster/browser/trunk/xslt/SQBlaster_I.xsl
    http://code.mios.com/trac/mios_sqblaster/browser/trunk/xslt/SQBlaster_D.xsl

If you feed the SQBlaster device files (xxxxxxxxx.xml) through an XSLT processor with SQBlaster_I.xsl, it'll emit the I_xxx.xml file for the Mios Device Implementation file.

If you feed this new Implementation file (I_xxx.xml) through an XSLT processor with SQBlaster_D.xsl, it'll emit the D_xxx.xml file for the MiOS Device Descriptor file.


Again, it's not been tested yet, and the IR "mapping" isn't complete just yet, but it's a start.  If anyone has good Javascript skills the XML/XSLT Processing could be done "in browser" to avoid the extra step of having the command line XSLT Processor ;)
« Last Edit: May 12, 2012, 10:15:56 pm by guessed »

Offline strangely

  • Beta Testers
  • Master Member
  • *****
  • Posts: 3722
  • Karma: +33/-2
  • Vera 1,3 & V light
Luup Plugin: SQBlaster interface
« Reply #1 on: January 10, 2011, 01:22:45 am »
Any idea if the below would work for the translation?

http://www.shell-tools.net/index.php?op=xslt

Or is it too basic in that the output format can't be specified?
I just ran it with one of the two code sets I have in my backup (not sure which one is which to be honest) but for the most part the output for an implementation xml seemed very close to what I'd expect.

Out of interest, what are you using on the Mac to transform?
« Last Edit: January 10, 2011, 02:46:38 am by strangely »
Kwickset locks, HA01C, HA14C, HA02C, HA03C, HA05C, HA04C, HA07C, HA09C, Aeon HEM, GE 45604, 45606, 45609, ZDP100, VRF01-1LZ, WDTC-20, HA18WD, WDHA-12R, HRDS1, HM-TS001, AC1-ZW, TV-IP110, BL-C210A, LUUP control- EtherRain8, DSC Alarm, HDMI matrix, HR24-200, Panasonic TV, SQblaster

Offline guessed

  • Master Member
  • *******
  • Posts: 5294
  • Karma: +90/-22
  • Release compat is not a bolted-on afterthought
Luup Plugin: SQBlaster interface
« Reply #2 on: January 10, 2011, 11:24:56 am »
Yes, that URL works just fine.  I use fairly minimal spec XSLT, so I imagine there are a few of those around.  There's one on the W3C site, but it only takes URL's as input (not pasted text) so this one is better.

On the Mac, I'm trialing a very expensive Development tool that's specifically targetted at XML/XSLT and Debugging.  It's not something the average person would likely buy if it's only going to be used for this purpose.

Offline guessed

  • Master Member
  • *******
  • Posts: 5294
  • Karma: +90/-22
  • Release compat is not a bolted-on afterthought
Luup Plugin: SQBlaster interface
« Reply #3 on: January 20, 2011, 12:15:37 am »
I've uploaded 2x XSLT files to code.mios.com that can be used (with a freestanding XSLT Tool) to "transform" an XML Device file, from SQRemote's backup, into the requisite I_xxx.xml and D_xxx.xml files for MiOS to talk directly to the Puck.

They're prototypes right now, and currently untested.
    http://code.mios.com/trac/mios_sqblaster/browser/trunk/SQBlaster_I.xsl
    http://code.mios.com/trac/mios_sqblaster/browser/trunk/SQBlaster_D.xsl

If you feed the SQBlaster device files (xxxxxxxxx.xml) through an XSLT processor with SQBlaster_I.xsl, it'll emit the I_xxx.xml file for the Mios Device Implementation file.

If you feed this new Implementation file (I_xxx.xml) through an XSLT processor with SQBlaster_D.xsl, it'll emit the D_xxx.xml file for the MiOS Device Descriptor file.


Again, it's not been tested yet, and the IR "mapping" isn't complete just yet, but it's a start.  If anyone has good Javascript skills the XML/XSLT Processing could be done "in browser" to avoid the extra step of having the command line XSLT Processor ;)
I pushed newer versions of these XSLT files over the weekend, with the following improvements:

a) Broader mapping of SQRemote "codes" to MiOS IR-Device Actions
b) Use SQKeyCode as the Primary "mapping" vehicle instead of the Text-based Description (which varies too much across devices)
c) Generate correct output for UEI-based SQBlaster codes, as these weren't handled correctly

If you try it, let me know feedback/comments.  Folk should be able to use the URL that @strangely posted to generate starter I_xxxx.xml and D_xxxx.xml files if they don't otherwise have a tool to kickoff the transform.


Many thanks to @SquareConnectJohn for a prelim of the SQBlaster API doco.  It made is easier to expand the mappings and gave me a clearer understanding of the SQBlaster XML Device file elements/structure (etc).

Offline shuyu2k

  • Newbie
  • *
  • Posts: 3
  • Karma: +0/-0
Luup Plugin: SQBlaster interface
« Reply #4 on: February 16, 2011, 05:48:04 pm »
Hi, guessed,
I am very interested in your plugin for Sqblaster in vera. But I don't have any experience with programing in vera. Can you provide an example for me?
I attached a saved configuration file download from box.net. I have tested this configuration in SQ Remote on Ipad and confirmed it's working.
Would you please transfer this file to a plugin that can be used in vera?
I have already installed the plugin from: http://code.mios.com/trac/mios_sqblaster
I am hoping that once I install your newly developed plugin, I can create a scene in vera to "Turn on" my TV at 7am in the morning?
Thank you very much.

Offline guessed

  • Master Member
  • *******
  • Posts: 5294
  • Karma: +90/-22
  • Release compat is not a bolted-on afterthought
Luup Plugin: SQBlaster interface
« Reply #5 on: February 17, 2011, 04:09:48 am »
Sorry for the delay, turns out that the hosted site I've been using to do this XSLT transformation has been down all day (it's the one @strangely lists above).

Anyhow, it encouraged me to write a pure-Lua version of it so, longer term, I won't need to use anything other than Vera to execute the Conversion process.

The [converted] IR Device Plugin files for the Zenith are (attached) and are in addition to the SQBlaster IR Transmitter Plugin files you probably already have loaded and setup.

I've modified the Wiki instructions to show both what the SQBlaster plugin does, as well as the requirement to generate the IR Device files

Unfortunately I'm running a version of the Beta (1.1.1183) that doesn't let me associate the Zenith with my SQBlaster, but you shouldn't have that problem unless you've moved to the Beta.

If you have, let me know, as it's still possible to fix, just takes a little longer to describe the work-around.

I've attached some screenshots showing the Setup Process (etc), these are all out of sequence, but I'm sure you'll work it out.
« Last Edit: February 17, 2011, 04:15:32 am by guessed »

Offline guessed

  • Master Member
  • *******
  • Posts: 5294
  • Karma: +90/-22
  • Release compat is not a bolted-on afterthought
Luup Plugin: SQBlaster interface
« Reply #6 on: February 17, 2011, 04:11:47 am »
... and the most important one, the "Install" setup I used to get the Zenith TV device created, after uploading the generated/derived D_SQdevxxxx.xml and I_SQdevxxxx.xml files.



This screenshot is of the Advanced Scenes Tab, showing the pull down for IR Actions that can be executed against the Zenith TV.
« Last Edit: February 17, 2011, 04:13:54 am by guessed »

Offline shuyu2k

  • Newbie
  • *
  • Posts: 3
  • Karma: +0/-0
Luup Plugin: SQBlaster interface
« Reply #7 on: February 17, 2011, 12:39:27 pm »
Hi, guessed,
Thank you for your work. I have successfully setup the IR Transmitter and the Zenith TV device in Vera. Now I CAN see all commands in advance tab when creating new scenes. So I assume it should work.
Unfortunately, it didn't. Maybe it is because of my firmware version? Currently I am running at 1.1.1186.
Do I need to reset the firmware to an older version?

Offline guessed

  • Master Member
  • *******
  • Posts: 5294
  • Karma: +90/-22
  • Release compat is not a bolted-on afterthought
Luup Plugin: SQBlaster interface
« Reply #8 on: February 17, 2011, 03:43:00 pm »
Hi, guessed,
Thank you for your work. I have successfully setup the IR Transmitter and the Zenith TV device in Vera. Now I CAN see all commands in advance tab when creating new scenes. So I assume it should work.
Unfortunately, it didn't. Maybe it is because of my firmware version? Currently I am running at 1.1.1186.
Do I need to reset the firmware to an older version?

Yeap, you're on a Beta release.

A problem was intro'd into the Beta's where the normal UI "mechanism" for associating an IR Device, with the IR Transmitter  that it should use, it missing.  They've since added it back, but we don't yet have access to that version.

It's normally a Drop-down menu, present in the Device's editing dialog that lets you do this, and the drop down shows "all" the IR Transmitter devices you have installed into your system.

If you're on a Beta release, as you are, then this association needs to be setup manually before the "Device" can start sending stuff (since, in any system, there might be more than one IR Transmitter device, like I have)


Anyhow, here are the manual steps you need to perform to work-around the Beta bug:

a) Find the "Device #" of the IR Transmitter device in your system
In the example screenshot (UI4_1.png) mine shows as "90" in the Device dialog.  In the examples below, I'll use the value "90", but you should change this to the value from your system.

b) Open the Device Dialog for your IR Device in your system (the ZenithTV in your case) and create a Variable called "IODevice".
The specifics of the Variable are as follows:

Quote
    New service:    urn:micasaverde-com:serviceId:HaDevice1
    New variable:   IODevice
    New value:    90

These values are case-sensitive, and should be entered exactly as above, then click the (Add >) Button

c) Click (Save)

d) Validate the values in the Dialog.
If you go back into your Zenith TV dialog, after Vera restarts completely, you should see something like the attached screenshot (UI4_3.png)

At this point the IR Device (Zenith TV) should be setup to send it's codes via your IR Transmitter (SQBlaster Plugin)



again, this work-around shouldn't be needed going forward.

Offline IamLegend

  • Newbie
  • *
  • Posts: 18
  • Karma: +0/-0
Luup Plugin: SQBlaster interface
« Reply #9 on: February 18, 2011, 01:45:42 am »
I successfully installed the IR Blaster plugin onto my MIOS system.

I took my device file from my backup of my SQ Remote and used the I_XSL file against it and used the D_XSL file against the resulting file as instructed.

I upload the two xml files to my MIOS system.

I tried to create a device but things just aren't working at this point.

I've attached both my device and implementation files.

I would appreciate any help.

Thanks.


Offline shuyu2k

  • Newbie
  • *
  • Posts: 3
  • Karma: +0/-0
Luup Plugin: SQBlaster interface
« Reply #10 on: February 18, 2011, 10:51:09 am »
guessed, it worked! Thank you very much!

Offline guessed

  • Master Member
  • *******
  • Posts: 5294
  • Karma: +90/-22
  • Release compat is not a bolted-on afterthought
Luup Plugin: SQBlaster interface
« Reply #11 on: February 18, 2011, 11:18:53 am »
guessed, it worked! Thank you very much!

You're welcome.  Looking forward to making it all easier for folks, esp once I productionize the Pure-Lua version I've got going.

Offline guessed

  • Master Member
  • *******
  • Posts: 5294
  • Karma: +90/-22
  • Release compat is not a bolted-on afterthought
Luup Plugin: SQBlaster interface
« Reply #12 on: February 18, 2011, 11:34:01 am »
I tried to create a device but things just aren't working at this point.

I've attached both my device and implementation files.

I would appreciate any help.

Thanks.


If you're on 1.1.1183 it's not going to work at all, since all IR is broken at the MiOS Level
If you're on 1.1.1186 it should work, but you need to manually Associate the IR Device (Samsung TV) with the IR Transmitter (SQBlaster Plugin)
If you're on another MiOS Version, please let me know.

Can you elaborate on this:
Quote
I tried to create a device but things just aren't working at this point.

Specifically:

a) Did the IR Device creation, in MiOS, Work?
b) Do you get any Startup errors for any of your Devices?
c) Did you attach your Samsung IR Device to the SQBlaster IR Transmitter Device?
d) Does the IR Transmitter (SQBlaster) Device show as "Up" in it's Dashboard presentation like this image shows:
     http://code.mios.com/trac/mios_sqblaster/attachment/wiki/WikiStart/SQBlasterDevice-UI4.png
e) Can you see the IR Device in the Scene Advanced mode (like the pictures above)?

If all of the above are working, then please outline the specifics of the problem being experienced.  Feel free to also PM me with the location where I can download your LuaUPnP.log file so I can see what's really going on.


Looking at the generated D_SamsungTV.xml, it looks like my XSLT isn't gen'ing it quite correctly.  That shouldn't stop actual IR commands from working, but may cause other problems.  Please attach the original devxxxxxxxxx.xml that was used to build this file as I need to see why the XSLT didn't transform it correctly from the original content.

Basically it appears to be missing the Service Description block.

Offline IamLegend

  • Newbie
  • *
  • Posts: 18
  • Karma: +0/-0
Luup Plugin: SQBlaster interface
« Reply #13 on: February 18, 2011, 09:22:34 pm »
guessed,

I got it all working.  I had to edit the xsl file because it was looking for a '.' in the device string but it needed to look for ':' instead.

Anyway, thanks for your xsl files and directions.

Offline guessed

  • Master Member
  • *******
  • Posts: 5294
  • Karma: +90/-22
  • Release compat is not a bolted-on afterthought
Luup Plugin: SQBlaster interface
« Reply #14 on: February 18, 2011, 10:33:51 pm »
guessed,

I got it all working.  I had to edit the xsl file because it was looking for a '.' in the device string but it needed to look for ':' instead.

Anyway, thanks for your xsl files and directions.

Sorry about that.  Looks like I checked in 1/2 of the fix prior (did the SQBlaster_I.xsl before but didn't check in the SQBlaster_D.xsl).

In the process, I noticed that the SQBlaster_D.xsl was missing the TogglePower implementation, so I went ahead and added that in.  If TogglePower "OnOff" is important to you you'll want to regenerate your D_Samsung.xml using the newer SQBlaster_D.xsl.