Vera + Puck would = :) mbairhead

So is their any word on who (if anyone) is working on getting Vera and the Puck together? If so, how’s it coming?

MiCasaVerde are working on this… I can not speak for them on when this will be available

Mat

Wow…ask and ye shall receive. Thanks guessed, I’ll try this out later today.

[quote=“guessed”]d) The code hasn’t been tested in a while, and @strangely reports a few kinks in using it lately… I’d love to hear more details
e) The code hasn’t been updated to the latest SQBlaster API’s, and uses a legacy throwback API that might be causing (d)[/quote]

Haven’t really looked into this but despite the blaster being able to receive the Vera commands pronto codes (I can see in the syslog), only very rarely does one register on the two devices I’m trying to blast to. If I get some time I’ll perhaps try to capture what it sends with the old USB-UIRT on my PC.

@mbairhead, it’ll be interesting to see your mileage with it?
Also if you had another device already like a USB-UIRT or a GC100 etc then you can just re-assign the IODevice number that the Puck represents (obviously have to add it first) to your old plugin in the IODevice field and save.

Apologies if I am being dense, but I think I need a little help to utilize this plugin. I installed it as instructed, which went well. I then added a couple of devices that were actually found just fine in the internal database, such as my Denon Receiver (which uses D_DENONAVR889.xml.lzo) and my Sharp Aquos TV (D_Aquos.xml.lzo). When adding the devices I was able to send Test codes to them via the Test buttons next to the actions, and control worked just fine. However, now that I have gone ahead and added them, I see the new devices (called _TV and _Receiver) showing up in my devices list, but am unsure how to actually control them.

The reading I’ve done referring to the use of manually programmed pronto codes seems to not apply to me since both of these devices were already defined, correct? I would have thought that the actions which I was able to test during the device setup, would then be available under the device once added, and could therefore be added to scenes, etc.

Thanks again!

Ok, so you have two Plugin files ([tt]D_DENONAVR889.xml[/tt] and [tt]D_Acquos.xml[/tt]) that have been “auto” built for you by Vera, based upon it’s IR Database.

In turn, Vera has used these Plugin files to build Vera Devices, specifically [tt]_TV[/tt] and [tt]Receiver[/tt]. These Device stubs are meant to represent the physical “TV” and “Receiver”. The "" is just there to remind you to rename them, and place them into Rooms that make sense.

It’s this Physical Device that has a setting to “know” which IR Device it needs to use. If you have the Puck, and the SQBlaster Plugin, then you’d set the TV and Receiver devices to use the SQBlaster as the “IR” Transmitter.

Now you have the Device stubs in Vera, and you’ve let Vera know to use the SQBlaster for their IR Control, you can use “Advanced” Scenes (the Advanced Tab) to perform IR Actions against those devices.

The primary use-case for doing all this “dance” is to do things like “Power Off” from Vera, as a part of a larger “Goodnight” type scene where various devices around the house are shutdown. Obviously, the Advanced Scenes in MiOS lets you do any of the IR actions that the specific Plugin exposes (“ChannelUp”, “ChannelDown”, “VolumeUp”, etc, etc) but it’s far more likely that you’d do that directly between SQRemote and SQBlaster.

That said, you could use it to turn on TV’s (etc) whilst you’re on vacation, to make the house look more lived in.

and yes, there’s a reason that it’s being more tightly integrated… to avoid all these discrete setup steps :wink:

Got it - thank you @guessed!

The bit I was missing was going back and setting the recently created devies to be controlled via the IR transmitter, and then adding the control via the Advanced tab in my scenes. The use case you suggest is exactly what I want to do (well, that and a Power on and set input for an audio scene) so this should do nicely. I’ve looked at the process again and it makes sense to me now. I’ll give it a test when I get home.

Thank you again for your help, and the work that you’ve put into this.

You’re welcome. That was the easiest of Plugins to write, since it really just proxy’s over to SQBlaster… The real work was done in the Puck development.

The “more integrated” one is looking to use mDNS to find the Puck, the same way that SQRemote does. That alone will be a ton of value (I played for a while to make an mDNS-compatible Lua Library, and it was tough going)

Thanks so much @guessed… I needed this for remote control outside of my wifi network.

And, using snippets of your code, I created a Logitech PS3 adapter device that has discrete power codes that first ping the PS3 to check power status before turning it on/off. Since the Playstation button is part of both the on and off sequences, if the PS3 is off and you hit “power off” using the sqblaster directly from sqremote, it turns the PS3 back on… finally, I have solved this problem.

@woodsby, now that’s a creative usage of the IR “plugins”. Hadn’t considered that one. I have my Logitech Revue now, so it’ll be interesting to see how it can be controlled in these setups as well.

I am going to do the same for my TV to avoid the 14 second delay before setting the input if the TV is already on. I was going to bug Mat again for the API, but your plugin gave me all I need.

I wonder if there is a way to make use of the repeat and delay functionality in your plugin. I’d rather the community work on this than MCV, quite honestly - to avoid distracting them from their priorities.

I’m not 100% on what you’re looking for here. In the current MiOS API’s, there’s very little scope to handle real IR - the stuff where you get to pressDown, hold, and Release - with corresponding auto-repeat based upon the cycle used.

Are you looking to extend this somehow?

The SQBlaster supports that notion, but I have to dumb it down for the MiOS IR routines. Hopefully this is something they fix more systematically with their more integrated model.

I noticed in your code, you have repeat=0 in the sqblaster http call. So if I want to run a scene to control a device that needs to have a button press repeat twice (using sqblaster’s repeat functionality to simulate a button hold), do you think there is a way to do this with the sqblaster plugin? Also, for delays I had to use os.execute(sleep 2) between IR codes. This of course, doesn’t allow fractions of seconds. I am wondering if this is something that can also be handled by the sqblaster plugin. What I envision is being able to create macros in the scene advanced tab, rather than hardcoded into the av device plugin. But, I haven’t seen the API for the blaster yet, so I don’t know.

I too had to do quite a bit of fiddling with delays and repeats to get a couple of simple IR commands working, but am happy to report that it is working.

I’m happy to be able to shut off my AV gear as a part of my All Off/Good Night scenes from Vera now, as well as being able to turn on and set the correct input on my AV Receiver as a part of my scenes that utilize my poor man’s (iTunes based) whole house audio config. As @guessed as mentioned, more advanced control than these uses will likely be much easier once the official SQ Blaster plugin is available.

Thanks again for the help!

Can you lads publish examples of the specific tweaks you’re doing? I want to see them, concretely.

I don’t want to exec(sleep) as that would be bad (blocking call), but can achieve it in more elegant manners as required.

It’s likely to do what you’re looking for that a few API calls will need to be added, then you’d have to do “odd” things in the scene to call these API’s to set-or-reset delays prior to making the associated IR callout.

… mostly because these aren’t “parameters” within the existing MiOS IR Framework. Having examples might help us to help-them, to “evolve” these API’s tho…

My imp file functions and actionlist:

<functions>
	function PS3Startup(lul_device)
		socket = require("socket")
		http = require("socket.http")
		local IRDevNum = luup.variable_get("urn:micasaverde-com:serviceId:HaDevice1","IODevice",lul_device)
		if (IRDevNum == nil) then
			luup.log("No IR Blaster selected for PS3 control")
			luup.variable_set("urn:micasaverde-com:serviceId:HaDevice1","IODevice","1",lul_device)
		end
		IRDevIP = luup.devices[tonumber(IRDevNum)].ip
		PS3IP = luup.devices[lul_device].ip
        if (IRDevIP == nil or IRDevIP == "") then
            luup.log("IP Address is required in IR Device Advanced settings")
        else
			if (PS3IP == nil or PS3IP == "") then
				luup.log("IP Address is required in PS3 Device Advanced settings")
			else
				luup.log("PS3 IP Address is " .. PS3IP .. "; IR IP Address is " .. IRDevIP .. ".")
			end
		end
	end
	function SendCode(IRCode,IRRepeat)
		local startTime = socket.gettime()
		response, status = http.request("http://" .. IRDevIP .. "/docmnd.xml","&lt;docommand repeat= \"" .. IRRepeat .. "\" ir_data=\"" .. IRCode .. "\"/&gt;")
		local endTime = socket.gettime()
		if (response == nil) then
			luup.log("Web request returned no response ProntoCode=" .. IRCode .. " in " .. math.floor((endTime - startTime) * 1000) .. "ms", 1)
		end
	end
	function CheckPowerStatus()
		local PingStatus
		PingStatus = os.execute("ping -c 1 -W 1 " .. PS3IP)
		if (PingStatus == 0) then
			luup.log("PS3 is on")
			return 1
		else
			luup.log("PS3 is off")
			return 0
		end
	end
</functions>
<startup>PS3Startup</startup>
<actionList>
	<action>
		<serviceId>urn:micasaverde-com:serviceId:DiscretePower1</serviceId>
		<name>Off</name>
		<run>
			local PS3Status
			PS3Status = CheckPowerStatus()
			if (PS3Status == 1) then
				SendCode("P8bc4 e625 72b1 b3b1 7a69 46f1 da28 651f 2d47 d68f e61c 2274 001f d848 efce e679 b426 e8ff 85a7 cfba 233c cf99 1090 a06a 1fff 2a6c f7da 5c7e d1ba 155e 93d9 3bde f468 2237 73a9 4c55 6771 bf7b d9da 0193 aec3 cc87 e70c 9f58 b1cf a943 30e8 5213 d68e af8c 548c c6e0 4f81 b918 aa97 a392  ","3")
				os.execute("sleep 1")
				SendCode("P8bc4 e625 72b1 b3b1 7a69 46f1 da28 651f 2d47 d68f e61c 2274 001f d848 efce e679 b426 e8ff 85a7 cfba 233c cf99 1090 a06a 1fff 2a6c f7da 5c7e d1ba 155e 93d9 3bde f468 2237 73a9 4c55 6771 bf7b d9da 0193 aec3 cc87 e70c 9f58 b1cf a943 30e8 5213 d68e af8c 548c c6e0 4f81 b918 aa97 a392  ","10")
				os.execute("sleep 2")
				SendCode("Pd47d 909f c488 f243 2c6f 982e 882f 468b 5525 617e b0ca 87b0 4672 f738 3fd6 7621 0e9a dacf 8561 5329 37d5 7f26 e456 386f ddc2 3435 2c62 0ea6 9d25 d28d fb81 7e73 c52a 4b93 03f0 8ea6 91b5 d48d a146 d96a 4123 c470 fa84 1213 af63 27ed c747 8676 31bf 56f2 d616 f626 a09e c4f7 348b 32bc  ","0")
				os.execute("sleep 2")
				SendCode("Pd47d 909f c488 f243 2c6f 982e 882f 468b 5525 617e b0ca 87b0 4672 f738 3fd6 7621 0e9a dacf 8561 5329 37d5 7f26 e456 386f ddc2 3435 2c62 0ea6 9d25 d28d fb81 7e73 c52a 4b93 03f0 8ea6 91b5 d48d a146 d96a 4123 c470 fa84 1213 af63 27ed c747 8676 31bf 56f2 d616 f626 a09e c4f7 348b 32bc  ","0")
			end
		</run>
	</action>
	<action>
		<serviceId>urn:micasaverde-com:serviceId:DiscretePower1</serviceId>
		<name>On</name>
		<run>
			local PS3Status
			PS3Status = CheckPowerStatus()
			if (PS3Status == 0) then
				SendCode("P8bc4 e625 72b1 b3b1 7a69 46f1 da28 651f 2d47 d68f e61c 2274 001f d848 efce e679 b426 e8ff 85a7 cfba 233c cf99 1090 a06a 1fff 2a6c f7da 5c7e d1ba 155e 93d9 3bde f468 2237 73a9 4c55 6771 bf7b d9da 0193 aec3 cc87 e70c 9f58 b1cf a943 30e8 5213 d68e af8c 548c c6e0 4f81 b918 aa97 a392  ","0")
			end
		</run>
	</action>

@guessed… one more note… I thought about call_delay instead of os.execute(“sleep #”), but as far as I know, call_delay doesn’t allow you to pass more than one argument to the function it is calling… and i need to pass both the pronto code and the repeat variables.

wow. Nice work woodsby. I bet there are several other PS3 owners out there who will be your new biggest fans.

My fiddling was much more pedestrian than that, but I can share if it’ll help guessed. I simply had problems getting my Denon AV receiver and Sharp Aquos TV to receive the commands issued in the advanced tab of my scenes. I knew the IR codes were correct because I was able to test them (as mentioned before) when selecting devices, but once the devices were created I couldn’t get them to work. It was simply a matter of delay and repeat experimentation, which I believe must be done manually.

As such here is an example of my Play iTunes on the Stereo’s advanced tab. The Denon AV receiver is using the AVR2309CI template since it had the best available selection of commands, though mine is a different model number.

Denon AV: On
Delay 1s
Denon AV: On
Denon AV: On
Delay 8s
Denon AV: Input1
Delay 1s
Denon AV: Input1
Denon AV: Input1
Delay 1s

I tried several combinations of using only a single repeat, or only a single delay with mixed success. As strange as the above sequence seems, it is what works for me reliably.

I used the same approach with my TV, though it seemed to be less finicky.

Very crude, and should be cleaned up, but it was a quick first attempt and it works fine. I actually don’t have a scene calling this yet. I just have my on and off buttons and macros in sqremote calling this.

Gents…

  1. The draft API is almost complete… please feel free to bug John!

  2. This is really interesting stuff…

  3. You can take the hex codes straight out of the device definitions we store up in box.net and I would imagine easily add them to the Vera IR xml files… Alternatively, I am open to anyone who wants to build a web service around our database to connect and see what we can do.

  4. I am open to ways to make the discovery ‘Lua friendly’ if anyone has suggestions

A community based solution would certainly get a good plug in quicker, it seems…