= Introduction = [[Image(WeatherUndergroundUI4.png, align=right, 30%)]] [[Image(WeatherUndergroundUI5.png, align=right, 30%)]] The Weather plugin is a [http://wiki.micasaverde.com/index.php/Luup_Plugins Luup component] that captures, displays, and periodically updates Temperature and Humidity data based upon Vera's current [http://wiki.micasaverde.com/index.php/Location Location]. = How does it work = Each user must register with [http://www.wunderground.com/?apiref=557bfbc30f6714b8 Weather Underground] to obtain a key. The plugin, when configured with the key, uses the Latitude / Longitude values configured in Vera's [http://wiki.micasaverde.com/index.php/Location Location] settings, and data provided by the Weather Underground (WUI) data feed, to retrieve: * Temperature - The Current temperature * Low Temperature - The ''estimated'' low temperature * High Temperature - The ''estimated'' high temperature * Humidity - The ''estimated'' humidity Each of these values is presented as a Child Device of the Weather plugin, implementing the respective [http://wiki.micasaverde.com/index.php/Luup_UPNP_Files UPnP Service]. They're all set to be visually ''grouped'' in the UI/Presentation. Behind the scenes, the plugin uses Vera's ''Latitude'' and ''Longitude'' values, derived from the User-specified [http://wiki.micasaverde.com/index.php/Location Location] settings, to help form a URL to the Weather Underground (WUI) API. The user also has the option of explicitly specifying a location string within the Plugin itself. The URL calls to WUI look like: (https) api.wunderground.com/api/__''key''__/conditions/forecast/alerts/q/__''lat''__,__''long''__.xml ''OR'' (https) api.wunderground.com/api/__''key''__/conditions/forecast/alerts/q/__''location''__.xml The plugin selects elements from the XML output, and translates them into values that are set upon the respective Child Devices. The Weather plugin retrieves the Weather data at startup and, by default, every 30 minutes after that. = Installation = * For UI4/UI5 Installation, please follow the [wiki:Installation-UI4 UI4/UI5 Installation procedure] = Scene Scripting = The Weather Plugin exposes a number of Variables: * `Condition` (String) something representing the current Weather state (subject to language translation).[[br]] * `ConditionGroup` (String) an aggregation of weather Condititions to make scripting simpler (not subject to language translation) * `WindCondition` (String) a value like "`W at 2 mph`". * `WindSpeed` (Number) a value like "`2`" extracted from the `WindCondition`, specified in Local units (either kph or mph depending upon the setting of `Metric`) * `WindDirection` (String) a value like "`West`, `NW`, `North`, etc" * `Period` (Number) the number of seconds to delay before automatically polling the Weather feed. If blank, the default is 1800 seconds (30 minutes). This value cannot be < 10 or > 3600. * `LocationUsed` (String) a "''lat'',''long''" value representing the Location actually used by the Weather service, since it may be different from that requested. These variables can be accessed in Luup scenes. == Examples == To prevent a scene from firing when the weather is poor: {{{ #!div style="font-size: 80%" {{{#!lua local t = luup.variable_get("urn:upnp-micasaverde-com:serviceId:Weather1", "ConditionGroup", 104) if ( (t == "sleet") or (t == "tstorms") or (t == "rain") or (t == "snow") or (t == "flurries") then return true else return false end }}} }}} Further examples can be found in the Discussion area referenced below. The condition phrases are listed on the WUI site: * `Condition` - [http://www.wunderground.com/weather/api/d/docs?d=resources/phrase-glossary#current_condition_phrases Current Condition Phrases] * `ConditionGroup` - [http://www.wunderground.com/weather/api/d/docs?d=resources/phrase-glossary#forecast_description_phrases Forecast Condition Phrases] = Discussion = The Weather plugin is discussed in this forum thread, along with a lot of it's development history: http://forum.micasaverde.com/index.php?topic=1435.0 Feel free to ask questions on that thread, as well as make any suggestions & contributions to the future development of the Weather plugin's functionality.