- Sign up for a free API key at Weather Underground, the developer plan is free with up to 500 requests per day, enough for an updates every 2.88 minutes.
- Look up your location’s latitude and longitude here
- Install the appropriate bindings
- sudo apt-get install openhab-addon-binding-weather openhab-addon-binding-astro
- openhab.cfg file modifications
- ################################# Astro Binding #######################################
#
# The latitude
astro:latitude=DecimalDegrees# The longitude
astro:longitude=DecimalDegrees# Refresh interval for azimuth and elevation calculation in seconds
# (optional, defaults to disabled)
#astro:interval=################################### Weather Binding ###################################
#
# The apikey for the different weather providers, at least one must be specified
# Note: Hamweather requires two apikeys: client_id=apikey, client_secret=apikey2
#weather:apikey.ForecastIo=
#weather:apikey.OpenWeatherMap=
#weather:apikey.WorldWeatherOnline=
weather:apikey.Wunderground=KEYHERE
#weather:apikey.Hamweather=
#weather:apikey2.Hamweather=# location configuration, you can specify multiple locations
weather:location.home.latitude=40.0782435
weather:location.home.longitude=-83.100537
weather:location.home.provider=Wunderground
weather:location.home.language=EN
weather:location.home.updateInterval=5Copy and paste contents from below files into ‘/etc/openhab/configurations/rules/weather.rules’ and ‘/etc/openhab/configurations/items/weather.items’
- weather.rules
- Weather.items
- Sitemap addition:
Frame label=”Weather” {Group item=gWeatherCurrent icon=”temperature-max” label=”Current Forecast”
Group item=gWeatherFuture icon=”sun_clouds” label=”Future Forecast”
Group item=gSun icon=”sun_clouds” label=”Sunrise/Sunset”
}
The switch “sunUp” will be used in future rules to pair with activation of lights by motion detectors so they don’t go on if they aren’t necessary.