I am stuck trying to make it work in Chumby. I am using Flash Lite 3 and Actionscript 2 and I have hacked together a way to output HTTP commands, but it isn’t reliable. The Chumby forum recommended sending XML commands from Chumby to Vera, but I am having trouble sorting out the syntax (if hat is even possible). I read somwhere that Vera would convert JSON to XML and I have a method in AS2 that can send JSON or XML.
The typical getURL(http command to Vera) in AS2 doesn’t seem to work because Chumby doesn’t have a browser and supposedly that method tried to open one. Any help is appreciated, I am so close to having something working. I am basically just looking to trigger scenes at this point.
I would run WireShark and look at the commands you are sending out. Once you see it you will know what’s going on.
I have the scene trigger code … In the raw …posted on another thread about Labview Code.
Hope this helps.
Regards
Tim
You’ll also need to specify the [tt]&format=xml[/tt] parameter, unless the Chumby can directly handle JSON responses (which I’m guessing it can) as that would be less taxing on Vera (it’s the native format)
Shady - I was looking into this as well, but I’m brand new to Flash. Is there an IDE you’re using or are you just compiling the actionscript? Is your code shared anywhere?
Thank you for the suggestions, the code I posted doesn’t seem to work period (even with &format=xml). My widget is simple at the moment, just a few buttons with hard coded urls on each button to fire scenes.
I haven’t posted my code anywhere yet. I haven’t looked into making a widget config page yet either, but my goal is to make it so you can enter your Vera IP and scene numbers,etc.
My widget loads on Chumby fine and I can use the buttons, but the only way I have been able to send the command for the scene, was to use a movie player method passing the url. Horrible, but it worked (for one operation only per command).
I saw @Tim’s post from the LabView code and I don’t understand how it gets put together, the format or syntax of the string. Any further ideas will have me operating Scenes in no time, this shouldn’t be that hard. I haven’t touched Flash much since Flash 4, so a long time. I see the advantage using JSON over XML, but I am a bit lost between UPnP, HTTP, GET, POST, JSON, XML, etc. If I could get the widget to function (more than one button press) then I could concentrate on cleaning it up and adding functionality. Thank you for any further ideas.
I have attached ,swf file renamed as .txt, just remove the .txt extension and play. It just shows the simple button layout at 320x240 .
In order for me to get Labview to work I spent almost a week studying HTTP. The format of the strings is different than the MIOS examples because of the HTTP coding. I don’t know if my code is helpful but the text in my code was a copy of the commands sent out using the web interface to the Vera on a local network. I am still very new at all this but for me comparing the raw data I was sending out to the raw data that the web interface sends out showed me what to do to make the two match.
Good luck and hang in there!
Regards
Tim
Thank you Tim, because I have felt so close to a breakthrough I have put in a lot of late nights so far. It is just finding the right method in actionscript and the right command syntax for Vera. I can’t get Vera to output anything, so I am not sure WireShark give me anything to go on, but I have it installed and it will be a great tool, Thank you.
I assume you LabView code Takes the IP field, the Port field, and the Commands and scene number an appends them together to for a command string? What is the format of that string (is it just the http://… I have shown above)?
I have about 40 webpages open for almost a week, Vera Wiki, AS Code, Chumby examples, forums, and I have really learned a lot. I am hoping that I can wrangle this to the ground this weekend and have something working. Why can’t Chumby output an HTTP command, or is it that it is so easy that it isn’t documented anywhere? The code snippet I got from a Chumby forum admin didn’t seem to work either. I’ll keep at it, any more info about the LabView command strings may be helpful, thanks again.
I got this response from the Chumby forums, but I don’t see why it would be an issue because all I need is for Chumby to broadcast the URL on the network (this is why my loadMovie hack works, it accepts a URL (to a movie) but I put in Vera’s scene command and it works through Chumby, but only one time as it must crash the movieplayer or leave the “stream” open and it isn’t a movie obviously, its a command), Chumby forum response below:
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.
Hi Shady,
I would like a recomendation on electric shades for our boat when you get a chance…we are not stuck on the Lutron Shades.
In regards to your programing adventure…I had a lot of late nights too!
Since I am still a novice at all this I will just tell you a few of the problem I had and maybe it well help or not…it’s all good to know.
My first attempt to set scenes on Vera was by using the Microsoft Active X Browser and send it commands…and it does it just fine but there is no way I could figure out to handle the JSON return message. The Internet Explorer wants to handle them like a file and returns a message “do you want to save the file?”
I bypassed all the crap and went straight to TCPIP which is the mechanism that all these protocols are being transported on…HTTP, XML, JSON, Etc.
The code I have was formed by using Internet Explorer and entering the examples listed in MIOS Wiki…I simply entered the code and found the outgoing stream in WireShark. You can also see the response in Wireshark as well. The nice thing about dealing with the TCP/IP calls is it bypasses all the crap in the return message and makes it easy to watch for error messages.
HTTP coding adds all the stuff after the MIOS command and changes the header to the GET command…it also formats the strings with the right carriage returns and line feeds as well…It still is all text and easy to duplicate.
I hope that you can extract some help out of all that!
@shady, funnily enough, I’ve been writing an actionscript app (using FlashDevelop) for the 8" Infocast Insignia to interface with vera. So far, I have it pulling all the lights/dimmers and thermostats and letting me control them. Still putting pulling all the UI together into something coherent, but the basic functionality seems to be working.
The big stumbling block I found (and I suspect it’s related to your issue) is that my http GET requests to vera would only execute ONCE on the Infocast, while it worked fine on my PC. I finally tracked the issue down to the Chumby OS caching http requests based on the URL! So if the URL didn’t change (which it won’t if you’re sending the same command twice to Vera), then Chumby wouldn’t even relay the request to Vera! To get around this, I had to append a “&blah=NUM” to the URL (where NUM is something unique like a timestamp) to make it unique every time.
[quote=“TimAlls, post:10, topic:168005”]Hi Shady,
I would like a recomendation on electric shades for our boat when you get a chance…we are not stuck on the Lutron Shades.[/quote]
@Tim thank you, that experience sounded eerily familiar and will help for sure, I want to see what Wireshark picks up, even if just to better understand.
For shades, I’ll send you a PM, thanks again.
@Veezer that is exactly the problem and I just got a suggestion over at the Chumby forums here that goes along with yours:
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
I think I’ll try your method as it is something I can understand. What method/function are you using to send the message? As an experiment I was using the code under “Playing .FLV Files Using NetConnection” here: http://wiki.chumby.com/index.php/Chumby_Flash_Tutorials
– using this to send the URL – stream_ns.play(“http://…scene command here”);
Do you have anything better?
I am working on one for the 3.5" Infocast, which is limited to FL3 and AS2.
[quote=“shady, post:12, topic:168005”]Do you have anything better?
I am working on one for the 3.5" Infocast, which is limited to FL3 and AS2.[/quote]
I’m actually using xml.load. Here’s a snippet that seems to work for me, although an error from Vera doesn’t actually seem to trigger the fail code.
var d:Date = new Date();
var host = this;
this.xml.onLoad = function(success:Boolean) : Void {
if (success) {
host.updateUI();
trace("Toggle succeeded for light " + host.name);
}
else {
trace("Toggle failed for light " + host.name);
host.status = 1 - host.status;
host.updateUI();
}
}
this.xml.load("http://vera:3480/data_request?id=lu_action&output_format=xml&DeviceNum="+this.id+"&serviceId=urn:upnp-org:serviceId:SwitchPower1&action=SetTarget&newTargetValue=" + this.status+"&blah="+d.getTime());
@veezer Thank you for the snippet, but I was unable to get load() to work for me. I’ve got some more digging to do as to what I am doing wrong. I did get a functional widget working at least thanks to your suggestion of appending a unique value to each string and using a different method for sending the string.
Now I’ve got to make it user configurable so anyone can use it, so maybe I’ll send you a PM if you don’t mind because I have some questions about creating a config .swf.
Your widget sounds like the Full Monty, being much more like the Vera UI, while my little 3.5" Infocast doesn’t have the screen size for much and scrolling wouldn’t be that useful. I’ve still got SQ Remote near the bed, but this widget giving me quick access to 8 scenes on my alarm clock is pretty handy.
Got a Chumby One sitting here collecting dust, think it would be pretty sweet to use with Vera.
Have Homebuddy running on rooted Nook Color- but one tablet in the household isn’t sufficient it seems- at least nobody will be trying to grab my Chumby all the time ;D
I could create a specific app for you based on Vera’s IP address and the scene numbers you want to control (that offer is open to anyone willing to wait for me to do it, lol). Ideally I am going to make the app so it has the typical Chumby config page to enter in the ip address, button names and scene numbers for each of the 8 buttons. So far I have just been enjoying my use of the app and haven’t made it universal yet.
It sounds like @veezer is making a better app that pulls in all of the devices into the Chumby, but I have the smaller 3.5" screen and felt that 8 scene buttons would work better for me and be easier to get working for me.
My buttons currently toggle, on/off, so you shouldn’t need a separate button for on and for off, but you would want a separate scene in Vera for on and off.
I actually usedthe code here: Chumby Flash Tutorials - Chumby Wiki for playing a .flv movie and instead of using the movie’s URL i used Vera’s scene activation URL (ugly but it works).
I had access to Flash, but you can use FlashDevelop for free, here’s a simple run down I found with links: http://degood.org/chumby.pdf
Did you every get this to work? I have an Chumby Infocast 8 and 3.5 that I would like to use to control my vera2. I would just want a couple of scene buttons and maybe direct light control.
Is it possible that you could share you code, so that I could see if I was able to modify it to suit my needs? I started at the chumby wiki site but was not making much progress.
I am looking at the chumby app panel builder to see if that would work. Any suggestions?
Thanks.