Premise [download] Module: Weather Underground Personal Weather Station

Motorola Premise

123

Senior Member
index.php
File Name: Module: Weather Underground Personal Weather Station
File Submitter: 123
File Submitted: 27 Oct 2009
File Updated: 27 Oct 2009
File Category: Premise
Author: 123
Contact: PM me
Version: 1.1

Weather Underground Personal Weather Station

Weather Underground's Personal Weather Station is a service that collects weather data from personal weather stations (PWS) located around the world. If you live in North America, it is likely that someone in your community is contributing weather data to Weather Underground. A station's raw, and formatted, weather data are accessible to the public via an XML feed.

WundergroundPWS is a Module that collects data from a selected PWS. The data is stored in properties that can be used for other purposes within Premise. The Module displays the weather "Details" in Premise Browser along with historical "Day", "Week", and "Month" charts generated by Weather Underground. It also has a real-time "Now" view that displays a live summary using Weather Underground's Rapidfire Flash widget.

The Module supports Metric/Imperial units (for Temperature, HeatIndex, WindChill, WindSpeed, and BarometricPressure) and will automatically use the appropriate measurement system based on Premise's LocaleSettings. If no weather data exists for a given property, the Module will display "N/A" in Premise Browser.

Installation
Import the Module.
Using Builder's main menu, click File > Import, select WundergroundPWS_V1-1.xdo and click OK.

Add a WeatherOffice object to Premise Home.
  • In Builder's Shortcut bar, click Home.
  • In the Explorer window, right-click Home and select New > HVAC > WeatherStation
  • In the Properties window, locate the Station property.
  • Select the desired Station (see below for adding more Stations to the list).
  • The Status field will display "Acquiring weather data ..." followed by "Idle".
  • By default, the weather data will be updated every 20 minutes.
  • To force an update, click the Update field.
Customization
How to add more Stations.
The following example adds a new entry for a PWS in Denver whose Station ID is: KCODENVE24.
  • In Builder's Shortcut bar, click Modules.
  • Navigate to Modules > WundergroundPWS > Classes > Stations
  • Either modify an existing entry or create a new one. To create a new one: right-click Stations and select New > Enum.
  • Name the new Enum "Denver".
  • In the Properties window, locate the Description property and enter the station's Station ID: "KCODENVE24".
  • Count the number of existing Enum entries and subtract one. If you've just entered the fifth Enum, the calculated value is four.
  • Locate the Enum's Value property and assign it the value calculated in the previous step (4).
How to change the polling period.
The Module contains a Timer designed to update the weather data every 20 minutes. Here's how to change the time period:
  • In Builder's Shortcut bar, click Modules.
  • Navigate to Modules > Default > Timers
  • Locate a timer whose name is similar to this: WeatherStation_Update_IDEB7D2E613A15465C90AADC67D81FE9B6. The object identifier code will be different and the name "WeatherStation" may differ if you've renamed the WeatherStation object.
  • In the Properties window, locate the Interval property and change it from 20 to whatever you prefer.
How to adjust the chart view's display area.
The Module supports Premise Browser's default 800x600 screensize. However, it can be easily modified to support larger screensizes.
  • In Builder's Shortcut bar, click Home.
  • Locate the WeatherStation object and click it.
  • In the Properties window, locate the ScreenHeight property (in the Appearance section).
  • The default value is 460 (pixels). Change this to 560 if Premise Browser is operating in 1024x768 mode.
How to adjust the chart's width.
In Builder's Shortcut bar, click Home.
  • Locate the WeatherStation object and click it.
  • In the Properties window, locate the ChartWidth property (in the Appearance section).
  • The default value is 500 (pixels). Change this to 650 if Premise Browser is operating in 1024x768 mode.
How to add/remove charts.
The Day, Week, and Month chart views are generated by Weather Underground. By default, several parameters are charted (Temperature, Barometric Pressure, Wind Speed, etc) but this can be tailored as follows:
  • In Builder's Shortcut bar, click Home.
  • Locate the WeatherStation object and click it.
  • In the Properties window, locate the WindDirectionChart property (in the Appearance section) and enable it.
  • You may enable/disable other charts as per your requirements.
How to change the appearance of the Details view.
Font
  • In Builder's Shortcut bar, click Modules.
  • Navigate to Modules > Plugins > Selectors > WeatherStation > WeatherStationPlugin
  • In the Properties window, locate the Color, FontFamily, FontSize, and FontWeight properties. Adjust these to alter the displayed text's appearance.
Layout
  • Navigate to Modules > WundergroundPWS > Classes > WeatherStation > DisplayDetails
  • The DisplayDetails function generates the HTML code that composes the Details page.
Notes
If the station does not have data for a given weather property, the Module will set the property to a "non-normal" value. For example, if there is no data for "WindSpeed", the Module will set its value to "-1". If there is no "WindChill" data, its value will be set to -274F (-170C). It does not set the values to zero because zero is a valid reading for WindSpeed and WindChill. If you live in Florida and see "HeatIndex" is -274F, that just means the data was unavailable. Keep this in mind if you create PropertyChange scripts!

Click here to download this file
 
Back
Top