Topic: Environmental Variables

Does "this['_chumby_profile_id']" refer to the id of the Widget mix, or some other form of profile?
In addition, how is the profile stored? An XML file, or some other form? Can it be accessed from a widget? Does it have an address like "http://www.chumby.com/profiles/ABCDEF12 … EF12345678"? Is there a way to get all of a users Widget Mixes?

Also, how permanent are these?
If I set this['myVar'] = 3, will it survive rebooting? Can it be accessed from a different widget? And does it require the control panel to be running in the background? (When I test locally, I use SCP/SSH to run my widgets ignoring it)

Thanks, and sorry for all the questions smile

Re: Environmental Variables

I did some hunting for myself, and I figured some stuff out:
Profile = Channels = Widget Mixes or whatever you call it.
They can be accessed as XML:
http://www.chumby.com/xml/profiles/PROFILE_ID

From this, I get even more questions.
What is "skin"? Something to be used in the future?
(Here's the line for the deprived:

<skin name="Standard" href="/xml/skins/00000000-0000-0000-0000-000000000001" id="00000000-0000-0000-0000-000000000001"/>

)

Re: Environmental Variables

There is currently no chumby-facing interface to fetch all of a user's profiles/channels.

"Skin" is something reserved for the future - there is currently no functionality there.

Setting a variable in your movie does not survive that widget being swapped out.  To store stuff permanently, you need to upload a modified "widget instance", which is the association of configuration settings with the widget.  The method for doing this is very similar to the method used by the configuration widgets.

Re: Environmental Variables

okay, do tell! How do we do this 'association of configuration settings' thing for our own widgets? I want a widget that can connect to my own data, but not let anyone else connect to it. They will have to have their own data.

Re: Environmental Variables

Well, this is something that's done automatically by our systems.  What the chumby plays is a "widget instance", which consists of the actual widget movie, and an optional set of custom parameters that are passed to the movie.

In order for the user to set up the parameters for a widget instance, the author must create a widget configuration movie.  You can see an example of this with the NOAA Weather widget - you'll notice that when you add this widget to your channel, you see a "customize" link, which opens this configuration movie.  This movie allows the user to input some data (in this case, zipcode), then saves it to our servers.  When the widget is played on the chumby, this extra data is passed along to the widget.

For an example of how to create such a widget, see Sample Banner Widget on the wiki.

6 (edited by kayakbabe 2007-07-10 11:00:32)

Re: Environmental Variables

okay I get that part. I looked the widget over and that seems easy enough. But it seems a bit insecure as the 'username/password' would be stored on chumby.com. anyone with the knowledge of that username/password can access the data via the chumby widget.. Is there a way for the chumby to pass it's id along?

Say I want to put a php file on my website that generates specific xml data that I want the flash widget on my chumby to use in order to create an ambient information display.

I want to authenticate MY chumby so only my chumby or other's whose id's I allow can be validated can obtain the data. I would have to enter the 'allowed' chumby id's into my php script in order to authenticate them.

Can the chumby id be passed on to the data source?

Re: Environmental Variables

In the production units, we've limited the amount of information about the user that's passed to the widget, for obvious security reasons.

What the widget now gets is the "instance id" of the widget being played, which is the specific incarnation of that particular widget in that particular channel for that particular user.

It also gets the name of the chumby as assigned by the user when they registered the chumby to their account.

These are in the variables "_chumby_widget_instance_id" and "_chumby_chumby_name" on the main timeline of the widget when it's launched. you can certainly pass them along to an outside service, with the caveat that the user can rename their chumby, and the widget_instances survivec only as long as the user includes it in their channel.  Note that two copies of the same widget added to the same channel have different instance ids, since they can have different parameters.

Alpha chumbys get a bit more information, but that's being deprecated.

8 (edited by kayakbabe 2007-09-18 13:12:23)

Re: Environmental Variables

I've still been thinking about this... I've read all about how the chumby can run things off a usb port...
can flash applets on the usb port connect directly to a website? Or do they have to go through chumby.com..
ie... I could provide a 'key' actionscript or xml file on a usb flashdrive... that would help ensure the chumby displaying my private store data is an allowed chumby...

If the flash on my usb drive doesn't have to go through chumby.com then I could use a crossdomain.xml file that only allows my own domains and ip addresses to access my servers. And I don't have to risk opening it up to chumby.com and all the people that will be users on there. And possible reused widget id's.... that could occur.

Re: Environmental Variables

A Flash movie running from a USB dongle has very high privileges - it can access external servers as well as local files.  If your "key file" is local, then you could read it from such a movie.