Your Universal Remote Control Center
RemoteCentral.com
Philips Pronto Professional Forum - View Post
Previous section Next section Up level
Up level
The following page was printed from RemoteCentral.com:

Login:
Pass:
 
 

Topic:
Fixed: How to get today's weather info to display on the 'Home' page
This thread has 13 replies. Displaying all posts.
Post 1 made on Saturday April 17, 2010 at 12:05
ScottGrimes
Long Time Member
Joined:
Posts:
April 2007
78

I've been trying to get Paul Spee's weather module to display today's weather info on my Home screen. I am a complete newbie when it comes to ProntoScript, but I have learned a few tricks, albiet quite basic. With the help of individuals from this forum it is now functioning properly. Thanks guys.

I've modeled my Home/Splash screen after the HTC Hero phone. The clock is working beautifully and I have the graphics pretty much complete. You can go to the full 5-day forecast (located in a different activity) by pressing on the weather icon area.

My Home/Splash Screen
My Splash Page

Note: I've remove some comments and the copyright info here to shorten the post.

Note: I've edited the scipts below to reflect the current working version. The OnWake() function is working now. This function will refresh the weather data whenever the remote wakes up. There may be a more elegant way to write this... but it works. Also, you may have noticed I am starting to make some new weather icons.

Home - Activity Level Script
var socket;
var xmlData; // Stores xml data received from xml.weather.com
var CityCode = CF.widget("City1Code", "PARAMETERS", "LOCAL_WEATHER").label;

function onConnect()
{

  if (socket && socket.connected == false) {
    // Not sure why onConnect() is called when socket is not connected
    return;
  }

  var request = "GET /weather/local/";
  request += CityCode;
  request += "?cc=*&dayf=1";
  request += "&unit=" +  CF.widget("Unit", "PARAMETERS", "LOCAL_WEATHER").label;
  request += "&prod=bd_select";
  request += "&par=yahoowidgetxml HTTP/1.0 \r\n"

  // Write request to get weather forecast
  socket.write(request);
  socket.write("HOST:xml.weather.com \r\n");
  socket.write("\r\n");
  socket.write("\r\n");

};

// This function is called when the xml data has been received
function onData()
{
  xmlData += socket.read(5000,1000);
};

// This function is called when the socket is closed
function onClose()
{
  var ut;

  // Trim the XML tag off if it was included.
  if (xmlData.indexOf("<!--l"))  <-->       xmlData = xmlData.substring(xmlData.indexOf("?>")+2);

  var weather = new XML(xmlData);

  // Get units
  ut = weather.head.ut;

  // Display location
  CF.widget("CityName").label = weather.loc.dnam;

  // Display text
  CF.widget("Text").label = weather.cc.t;

  // Display current temperature
  CF.widget("Temp").label = weather.cc.tmp + "°"; // + weather.head.ut; (remove '; //' and this text if you wish to display C or F units)

  // Update weather
    var hi = weather.dayf.day[0].hi;
    var low = weather.dayf.day[0].low;
    var icon = ""+weather.dayf.day[0].part[0].icon; // Force it to be a string

    // Update high temperature; if not available, omit temperature unit
    CF.widget("tp00").label = hi + "°"; // + weather.head.ut;
    if (hi == "N/A")
    {
      CF.widget("tp00").label = hi;
      icon = ""+weather.dayf.day[0].part[1].icon;
    }

    // Update low temperature
    CF.widget("tp01").label = low + "°"; // + weather.head.ut; (remove '; //' and this text if you wish to display C or F units)

    // Set icon
    var w = CF.widget("tp02");
    w.stretchImage = true;
    w.setImage(CF.widget(icon, "GALLERY", "LOCAL_WEATHER").getImage());
    w.label = "";

  // Note that the socket is killed after it has been closed and
  // will need to be recreated.
  socket = null;
};

function onIOError(e)
{
  System.print(e);
};

function connectWeather(City)
{
  CityCode = CF.widget("City" + City + "Code", "PARAMETERS", "LOCAL_WEATHER").label;

  if(socket == null) // socket was cleared by onClose()
  {
    // create new asynchronous TCP socket
    socket = new TCPSocket(false);

    // setup socket functions
    socket.onConnect = onConnect;
    socket.onData = onData;
    socket.onClose = onClose;
    socket.onIOError = onIOError;

    xmlData = "";

    socket.connect('xml.weather.com', 80, 3000);
  }
}


Home - Page Level Script
System.setGlobal('currentActivity', 'SPLASH');

function wifiConnected()
{
    if (System.getNetlinkStatus() == "wifi-disconnected")
    {
        Activity.scheduleAfter(1000, wifiConnected);
    }
    else
    {
        setClock();
        setDate();
        connectWeather(1);
        CF.activity().label = "standby mode...";
    }
}

onWake = function()
{
    Activity.scheduleAfter(1000, wifiConnected);
}

function setClock()
{
    currentTime = GUI.getDisplayTime().split(':');
    currentMinutesAndMeridiem = currentTime[1].split('');
    CF.widget('hour').label = currentTime[0];
    CF.widget('minutes').label = currentMinutesAndMeridiem[0] + currentMinutesAndMeridiem[1];
    CF.widget('meridiem').label = (currentMinutesAndMeridiem[2] + currentMinutesAndMeridiem[3]).toUpperCase();
    scheduleAfter(1000, setClock);
}

function setDate()
{
    currentDate = GUI.getDisplayDate().split(" ");
    CF.widget('date').label = currentDate[0] + ", " + currentDate[1] + " " + currentDate[2];
    scheduleAfter(1000, setDate);
}

wifiConnected();

Last edited by ScottGrimes on April 29, 2010 09:14.
Scott Grimes
Liquid Designs
[email protected]
OP | Post 2 made on Tuesday April 20, 2010 at 15:27
ScottGrimes
Long Time Member
Joined:
Posts:
April 2007
78
Thanks Hilko for helping me out. It works now. I also made some adjustments to it so that I can switch between Celcius and Farenheit on the fly (5 day forecast area only... so far). A couple more tweaks and I think I will be satisfied with the results.

Scott

Last edited by ScottGrimes on April 29, 2010 09:09.
Scott Grimes
Liquid Designs
[email protected]
Post 3 made on Tuesday April 20, 2010 at 16:49
sWORDs
Long Time Member
Joined:
Posts:
November 2006
373
On April 20, 2010 at 15:27, ScottGrimes said...
Thanks Hilko for helping me out. It works now. I also made some adjustments to it so that I can switch between Celcius and Farenheit on the fly. A couple more tweaks and I think I will be satisfied with the results.

Scott

Scott,

no problem. If you need more help just ask.
Post 4 made on Tuesday April 20, 2010 at 19:37
Lyndel McGee
RC Moderator
Joined:
Posts:
August 2001
12,999
Scott,

VERY NICE JOB!!!

When the time flips, is the display animated?
Lyndel McGee
Philips Pronto Addict/Beta Tester
Post 5 made on Wednesday April 21, 2010 at 10:11
pjjameso
Long Time Member
Joined:
Posts:
April 2008
73
Any chance you would be willing to post the module so we can give it a try? Looks very nice.
Paul
OP | Post 6 made on Wednesday April 21, 2010 at 12:08
ScottGrimes
Long Time Member
Joined:
Posts:
April 2007
78
On April 20, 2010 at 19:37, Lyndel McGee said...
Scott,

VERY NICE JOB!!!

When the time flips, is the display animated?

No animation so far... just getting my feet wet with ProntoScript. I've been completely overhauling my interface in an attempt to make it easier for my wife to use. Still lots of work to do, but so far, so good.

The animation for the 'Making system adjustments' and 'Shutting the system down' sections turned out quite nicely. There is both a blue ball that travels from the remote icon to the screen as well as a fuzzy white pulse that travels along the progress bar as commands are being sent - similar to the VISTA progress bar effect. However, no ProntoScript was required... mostly because I currently don't know the language that well yet. I merely created a new sending icon with a total of 8 segments and each segment contains two different graphical elements. After that, it required some creative layering/graphic ordering to create the desired effect as I did not want the pulse to travel beyond the color segment of the progress bar.
 
Hope you like it.

Some more pics...

Activity Page

Making Adjustments

Satellite TV

Shutting Down
Scott Grimes
Liquid Designs
[email protected]
Post 7 made on Wednesday April 21, 2010 at 16:02
Lyndel McGee
RC Moderator
Joined:
Posts:
August 2001
12,999
That is freakin awesome. Would love to have some images/UI like that on my remote here. As I beta test and am SW engineer in my day job, I'm a bit challenged for time to do the UI stuff. I've dabbled with PaintShop and Photoshop for years but find lately that I've not the time. :-(
Lyndel McGee
Philips Pronto Addict/Beta Tester
OP | Post 8 made on Thursday April 22, 2010 at 08:41
ScottGrimes
Long Time Member
Joined:
Posts:
April 2007
78
Hey Lyndel,

I know you've given lots of help to everyone here at Remote Central. I've learned quite a bit here myself. So, when I have finished this configuration, I can send you a copy of it. If you like, I can send you the Photoshop files as well. I will probably be using this configuration for any potential clients (new baby in our lives... so needs some extra cash), so I probably won't be uploading the file to Remote Central any time soon.

Scott
Scott Grimes
Liquid Designs
[email protected]
Post 9 made on Thursday April 22, 2010 at 09:08
BluPhenix
Long Time Member
Joined:
Posts:
December 2008
371
Awesome layout.

I understand why you don't want to post it here. IT's a lot of work and you're right. But ... you could sell it for a reasonable price, I think a lot of people would be willing to pay for such a nice and clean design.
OP | Post 10 made on Thursday April 22, 2010 at 12:01
ScottGrimes
Long Time Member
Joined:
Posts:
April 2007
78
On April 22, 2010 at 09:08, BluPhenix said...
Awesome layout.

I understand why you don't want to post it here. IT's a lot of work and you're right. But ... you could sell it for a reasonable price, I think a lot of people would be willing to pay for such a nice and clean design.

I was thinking of doing just that. Just need to figure what a fair price would be. Also, what should be included in the package.

Potential Packages
1) Complete UI Template only.

2) Complete UI Template as well as the PNG files. There would be some Photoshop files for buttons etc so that individuals could make any necessary changes to the icons to suit their configuration.

3) Complete UI Template as well as all Photoshop files.

The price would vary on the package. Or more likely, I would offer option 2 as the only available package. If someone wanted option 3, the price would be negotiated but obviously higher than option 2.

I would welcome any and all ideas or thoughts.
Scott Grimes
Liquid Designs
[email protected]
Post 11 made on Thursday April 22, 2010 at 18:13
Lyndel McGee
RC Moderator
Joined:
Posts:
August 2001
12,999
Scott,

You and Dave Sereno @ Only One Remote in Atlanta should talk. And, yes, I'd love a private copy. Don't know if you've noticed but the only things I've uploaded are CCFs with codes, a couple of ported ProntoScript games, and a program or two here and there. Your stuff would never leave my domain. :-)
Lyndel McGee
Philips Pronto Addict/Beta Tester
Post 12 made on Monday April 26, 2010 at 03:02
cyber3d
Long Time Member
Joined:
Posts:
April 2010
12
Scott, I hope you do eventually sell a package. I'd love to buy it for my TSU9600!
Post 13 made on Wednesday April 28, 2010 at 11:33
nellie7979
Long Time Member
Joined:
Posts:
July 2008
75
On April 20, 2010 at 15:27, ScottGrimes said...
I've been completely overhauling my interface in an attempt to make it easier for my wife to use.

Amen, brother. I can't seem to program an interface that satisfies both my wife and myself.

Add me to the list of people that would be interested in buying the xcf from you. I'd like to see a video of the interface in action.
Post 14 made on Wednesday April 28, 2010 at 15:22
gopronto
Senior Member
Joined:
Posts:
April 2008
1,453
I think its safe to say "His" and "Hers" page is the only way to go......

I wonder if Philips can do a Male/female detector on the next one :)

I think we all have this issue .

I get comments like " why carnt it tell me why the music serer is stopped" so now i have feed back that if there is a power cut and the message " Music Server is Stopped" it now pops up a message " Please turn the music server on", at least i dant have to say which switch it is :)

Scott count me in for one of your xcf's they look awesome
Pronto still one of the best Wi-Fi Remotes,
www.ikonavs.co.nz and [Link: axiumcontrol.com] Axium Control


Jump to


Protected Feature Before you can reply to a message...
You must first register for a Remote Central user account - it's fast and free! Or, if you already have an account, please login now.

Please read the following: Unsolicited commercial advertisements are absolutely not permitted on this forum. Other private buy & sell messages should be posted to our Marketplace. For information on how to advertise your service or product click here. Remote Central reserves the right to remove or modify any post that is deemed inappropriate.

Hosting Services by ipHouse