Topic: My widget won't play in Chumby

Any help is appreciated.  I have completed the .swf file in 320x240 size for the Infocast 3.5".  It will play and function everywhere (browser, preview page, gom player, etc) except in the Chumby.

I used FL4 and AS3 and I am curious if there is some Chumby specific code that I need to add to the AS.  It is just 4 simple buttons that send 4 hard coded http commands to activate something on the network.

But Chumby doesn't play the widget it just skips by it or plays it so fast that you can't see it.  It is probably something simple like I need to loop my movie or something.

I am so close....any help would be huge....

Re: My widget won't play in Chumby

The Infocast 3.5" only supports FL3 and AS1/AS2.

Re: My widget won't play in Chumby

Thank you, it's one of those RTFM moments.  So now I have a widget that at least shows up on the Chumby, but the buttons don't seem to work.

Or maybe the buttons work, but the http command I am trying to send isn't working through Chumby (it does work everywhere but Chumby).

Here is the code that I have in each button (**** = IP Addr and Port):

on (release) {
    getURL("http://***.***.**.**:****/data_request?id=lu_action&serviceId=urn:micasaverde-com:serviceId:HomeAutomationGateway1&action=RunScene&SceneNum=3", "_self");
}

Any help is appreciated very much, I am really close now...

Re: My widget won't play in Chumby

getURL() opens a browser window, or replaces the current movie in the current browser window - there is no browser.

What are you trying to do?

Re: My widget won't play in Chumby

Thank you Duane,

I thought I could get around the launching of a browser window, as it doesn't seem to launch a browser when I test on my PC.

I use a Vera home automation gateway from MiCasaVerde, and what Vera does it make all of your devices available via UPnP so I can send HTTP commands like the one shown to activate a scene (turning on lights, locking doors, setting temps, etc).

I thought I could have a widget that just sends out those commands with simple buttons, and maybe building off of that for more functionality.

Is there a better method to use to have Chumby trigger these events in Vera using HTTP?

Here is more on the commands:
http://wiki.micasaverde.com/index.php/Luup_Requests
http://wiki.micasaverde.com/index.php/UI_Notes

Thank you for the help, I feel like once I can get over the hurdle of getting something simple working that I can take it from there and build off of it...(there are a good number of people who own a Vera and would add a Chumby if a widget like this exisits)

Re: My widget won't play in Chumby

Use the XML object - the resulting response doesn't even have to be XML if you use the onData handler instead of the onLoad handler.

Re: My widget won't play in Chumby

Duane, thank you for the help.  I may need a little more direction if you can give it.  After so many hours I am still stuck.  I am not sure of the syntax for sending XML to Vera to activate devices.  In their wiki it only specifies the http and upnp commands.  Any hints?

I was able to hack it into working using video player to send the http command, but it freezes after one operation. tongue

Re: My widget won't play in Chumby

For instance:

var x:XML = new XML();
x.onLoad = function(success) {
   trace(this);
}
x.load("http://ipaddress:3480/data_request?id=user_data&output_format=xml");

Re: My widget won't play in Chumby

Thank you for the snippet, Duane

It looks like I was on the right track in delaring the XML variable, but didn't get the rest quite right.  I'll give it a go and report back.

This makes sense to me, seeing it as you wrote it.

Re: My widget won't play in Chumby

Duane, I hate to be bugging you, but that code didn't work.  Am I using it correctly, I have the code in an on (release) method and that code is in each button's instance.  I even tried adding &format=xml to the string to see if that worked.  There seem to be a good number of posts here about people doing somthing similar, but then no examples or snippets.  Is it just so easy that it isn't worth documenting, ha ha? 

Seems like I just need to find the right method and the right format of a command string that Chumby likes?

Thanks again for any insight...

Re: My widget won't play in Chumby

Well, assuming you substituted the IP in URL correctly, the problem *might* be due to a crossdomain issue.

Flash (not just Flash on chumby, but all versions of Flash, Silverlight, and even Javascript), enforce a crossdomain security policy.  In general, an application served from one domain (chumby widgets are served from *.chumby.com) cannot access XML data from another domain without that domain granting it explicit permission to do so.  This is done by have the other domain serve up a "crossdomain.xml" file, that provides information about the level of permissions it wishes to grant.

You should be able to see if this is the case by looking at the console log when running your movie.  You can also verify this by attempt to run your movie within a browser window on your desktop served from some external server.

If that is not the problem, then providing a console log of your widget in action would probably be helpful to diagnose the problem.

Re: My widget won't play in Chumby

Thank once more Duane.  I am curious though, if I can successfully get Chumby to send a command using the code found under "Playing .FLV Files Using NetConnection" (I know it is bad code that seems to work for only one operation as it seems to leave the "stream" open) here:

http://wiki.chumby.com/index.php/Chumby_Flash_Tutorials

then isn't my Vera just reacting to commands it hears on the network and all Chumby has to do is broadcast it?

I realize that I will eventually need to have Chumby process the return message from the Vera commands, to provide confirmation of scene execution, so I don't want to cobble something together half-ass.  Does this semi-working snippet of code from Chumby Flash Tutorials prove that I wouldn't need a crossdomain.xml file?  Just curious, thanks...

Re: My widget won't play in Chumby

I don't know without getting a closer look at your code and/or a console log.  Obviously, the device is capable of fetching data over HTTP from other things, since that's pretty much how every widget works.

Also, one thing that may affect it is HTTP caching - without an explicit cache header in the response, the Chumby Flash Player will cache a response to the same URL for an hour or so Usually that's addressed by having the server set a proper cache-control header, or by using a "cache-buster" technique, typically adding some random or time-related parameter to the fetch, since the cache is keyed by the URL.

14 (edited by Shady 2011-04-01 15:28:00)

Re: My widget won't play in Chumby

Duane you have been great, thanks.

I think a "cache-buster" technique is in order to get this thing on the road.  Someone over on the Vera forums is doing something similar for the Infocast 8" I just found out.

Do you think this method I was using is the only method that will accomplish this, if so I'll continue to use it?
stream_ns.play("http://...vera scene command here with timestamp appended");

EDIT:  Duh, I guess what you already posted, someone on the Vera forums posted basically the snippet you had posted earlier and said it was working through their Infocast 8", I'll make that work.