System.Taffybar.Weather
Contents
Description
This module defines a simple textual weather widget that polls NOAA for weather data. To find your weather station, you can use
http://lwf.ncdc.noaa.gov/oa/climate/stationlocator.html
For example, Madison, WI is KMSN.
NOAA provides several pieces of information in each request; you
can control which pieces end up in your weather widget by providing
a _template_ that is filled in with the current information. The
template is just a String with variables between dollar signs.
The variables will be substituted with real data by the widget.
Available variables:
stationPlace- The name of the weather station
stationState- The state that the weather station is in
year- The year the report was generated
month- The month the report was generated
day- The day the report was generated
hour- The hour the report was generated
wind- The direction and strength of the wind
visibility- Description of current visibility conditions
skyCondition- ?
tempC- The temperature in Celcius
tempF- The temperature in Farenheit
dewPoint- The current dew point
humidity- The current relative humidity
pressure- The current pressure
As an example, a template like
"$tempF$ F"
would yield a widget displaying the temperature in Farenheit with a small label after it.
Implementation Note: the weather data parsing code is taken from xmobar. This version of the code makes direct HTTP requests instead of invoking a separate cURL process.
- data WeatherConfig = WeatherConfig {
- weatherStation :: String
- weatherTemplate :: String
- weatherFormatter :: WeatherFormatter
- data WeatherInfo = WI {}
- weatherNew :: WeatherConfig -> Double -> IO Widget
- defaultWeatherConfig :: String -> WeatherConfig
Types
data WeatherConfig
Constructors
| WeatherConfig | |
Fields
| |
Constructor
Arguments
| :: WeatherConfig | Configuration to render |
| -> Double | Polling period in _minutes_ |
| -> IO Widget |
Create a periodically-updating weather widget that polls NOAA.
defaultWeatherConfig :: String -> WeatherConfig
A sensible default configuration for the weather widget that just renders the temperature.