This is a basic capability template.
A professional, voice-first weather application for OpenHome that provides real-time weather data, forecasts, and intelligent recommendations.
- Overview
- Features
- Installation
- Configuration
- Usage Guide
- Voice Commands
- API Requirements
- Technical Details
- Development
- Troubleshooting
- License
Weather Master is a comprehensive weather ability designed specifically for voice interaction on OpenHome devices. Unlike simple weather queries that the base LLM can handle, this ability provides:
- Real-time API data from WeatherAPI.com
- Persistent user preferences across sessions
- Multi-day and hourly forecasts
- Smart, context-aware recommendations
- Favorite locations management
- Customizable temperature units
โ Smart Recommendations
- Rain alerts with umbrella reminders
- Temperature-based clothing suggestions
- UV index warnings with sunscreen reminders
- Wind and visibility alerts
- Context-aware advice based on conditions
โ Sunrise/Sunset Times
- Daily sun times for any location
- 12-hour format for natural voice playback
- Available for home and other cities
โ Temperature Unit Preference
- Celsius or Fahrenheit
- Persistent across sessions
- Automatic conversion for all temperatures
โ 3-Day Forecast
- Today, tomorrow, and day after tomorrow
- High/low temperatures
- Weather conditions for each day
- Voice-optimized brief format
โ Favorite Locations
- Save up to 5 favorite cities
- Quick weather check for all favorites
- Add/remove/list management
- Persistent storage
โ Hourly Forecast
- Next 3-6 hours of weather
- Temperature and conditions per hour
- 12-hour time format
- Smart current-time detection
- OpenHome device or app
- Python 3.8+
- WeatherAPI.com account (free tier works)
- Get Your API Key
Sign up at: https://www.weatherapi.com/signup.aspx
Copy your free API key
-
Install the Ability
- Upload
weather_master_ability.pyto your OpenHome abilities folder - Set the ability's trigger words in the OpenHome dashboard
- Upload
-
Configure API Key
# In weather_master_ability.py, replace:
WEATHER_API_KEY: ClassVar[str] = "REPLACE_WITH_YOUR_KEY"
# With your actual key:
WEATHER_API_KEY: ClassVar[str] = "your_actual_api_key_here"- Deploy
- Restart your OpenHome device
- The ability will be available via the trigger words you saved in the OpenHome dashboard
Configure trigger words for this ability in the OpenHome dashboard.
Suggested phrases:
weathercheck weatherweather forecast
The ability automatically creates and manages weather_preferences.json:
{
"home_city": "Paris",
"temp_unit": "celsius",
"favorites": ["London", "Tokyo", "New York"]
}This file persists across sessions and stores:
- Home location
- Temperature unit preference (celsius/fahrenheit)
- List of favorite cities (max 5)
Step 1: Trigger the Ability
User: "Weather"
App: "Ready."
App: "Welcome! Let's set up your weather preferences."
Step 2: Choose Temperature Unit
App: "Do you prefer Celsius or Fahrenheit?"
User: "Celsius"
App: "Celsius selected."
Step 3: Set Home Location
App: "Now let's set your home location."
App: "Which city should be your home?"
User: "Paris"
App: "Paris set as home."
Check Home Weather
User: "Weather"
App: "Ready."
App: "Your home is Paris."
App: "Paris. 7 degrees Celsius and partly cloudy. 89 percent chance of rain. Bring an umbrella and wear a jacket."
Get 3-Day Forecast
App: "Want the 3-day forecast?"
User: "Yes"
App: "Today: high 10, low 5, partly cloudy. Tomorrow: high 12, low 6, sunny. Day after tomorrow: high 9, low 4, rainy."
Get Hourly Forecast
App: "Want the hourly forecast?"
User: "Yes"
App: "At 2:00 PM: 8 and cloudy. At 3:00 PM: 9 and partly cloudy. At 4:00 PM: 7 and rainy."
Check Other Cities
App: "Do you want to check other areas?"
User: "Yes"
App: "Which area?"
User: "London"
App: "London. 8 degrees Celsius and rainy. High 10, low 5. Bring an umbrella."
Add to Favorites
// After checking a city:
App: "Add London to favorites?"
User: "Yes"
App: "London added to favorites."
Manage Favorites via Settings
App: "Do you want to change settings or manage favorites?"
User: "Yes"
App: "Say home, unit, or favorites."
User: "Favorites"
App: "Say add, remove, list, or check all."
Check All Favorites
User: "Check all"
App: "Checking 3 favorite locations."
App: "London: 8, rainy. High 10, low 5."
App: "Tokyo: 15, sunny. High 18, low 12."
App: "New York: 5, cloudy. High 7, low 2."
- "Weather"
- "Check weather"
- "Weather forecast"
| Command | Action |
|---|---|
| "Yes" / "Yeah" / "Sure" | Confirm action |
| "No" / "Nope" / "Nah" | Decline action |
| "[City name]" | Check weather for that city |
| "Stop" / "Exit" / "Quit" / "Goodbye" | End session |
| "Home" | Change home location (in settings) |
| "Unit" | Change temperature unit (in settings) |
| "Favorites" | Manage favorites (in settings) |
| "Add" | Add city to favorites |
| "Remove" | Remove city from favorites |
| "List" | List all favorites |
| "Check all" | Check weather for all favorites |
Free Tier Includes:
- 1,000,000 calls/month
- Current weather
- 3-day forecast
- Hourly forecast
- Astronomy (sunrise/sunset)
- Weather alerts
API Endpoint Used:
http://api.weatherapi.com/v1/forecast.json
Parameters:
key: Your API keyq: Location (city name)days: Forecast days (1-3)aqi: Air quality (set to no)alerts: Weather alerts (set to yes)
Rate Limits:
- Free tier: ~33,000 requests/day
- This ability uses ~1-5 requests per session
- Well within free limits for personal use
weather_master_ability.py
โโโ Persistence Layer
โ โโโ get_preferences()
โ โโโ save_preferences()
โโโ Weather Engine
โ โโโ fetch_weather_data()
โ โโโ get_smart_recommendations()
โ โโโ create_current_weather_briefing()
โ โโโ create_3day_forecast_briefing()
โ โโโ create_hourly_forecast_briefing()
โ โโโ create_sun_times_briefing()
โโโ Favorites Management
โ โโโ add_to_favorites()
โ โโโ remove_from_favorites()
โ โโโ check_favorites_weather()
โโโ Main Flow
โโโ run_main()
User Trigger
โ
Load Preferences (persistent)
โ
Fetch Weather Data (API)
โ
Generate Smart Recommendations
โ
Create Voice Briefing
โ
Speak to User
โ
Offer Additional Options (3-day, hourly, sun times)
โ
Save Preferences (if changed)
- Language: Python 3.8+
- Framework: OpenHome Capability SDK
- API: WeatherAPI.com REST API
- Storage: JSON file-based persistence
- Voice: Text-to-Speech via OpenHome
weather_master_ability/
โโโ weather_master_ability.py # Main ability code
โโโ weather_preferences.json # Auto-generated user data
โโโ README.md # This file
Example: Add Wind Speed Alert
- Update
get_smart_recommendations():
# Add wind speed parameter
if wind_kph > 50:
recommendations.append("very windy, avoid outdoor activities")- Update weather data structure if needed:
# Ensure wind_kph is in the weather dict
'wind_kph': current['wind_kph']- Test with voice:
User: "Weather"
// Check if wind alert appears in recommendations
- Voice-first: Keep all spoken text under 2 sentences
- Error handling: Always wrap API calls in try/catch
- Logging: Use
self.worker.editor_logging_handler.info()for debugging - Exit words: Check exit words before processing any input
Issue: "Couldn't get weather for [city]"
- Cause: Invalid API key or city name
- Fix:
- Verify API key is correct
- Check city spelling
- Try with country name: "Paris France"
Issue: "Something went wrong"
- Cause: Network error or API timeout
- Fix:
- Check internet connection
- Verify WeatherAPI.com is accessible
- Check logs for detailed error
Issue: Preferences not saving
- Cause: File permission issues
- Fix:
- Check file permissions on
weather_preferences.json - Ensure ability has write access to directory
- Check file permissions on
Issue: Temperature unit not changing
- Cause: Preferences file corrupted
- Fix:
- Delete
weather_preferences.json - Restart ability (will recreate file)
- Delete
Issue: Favorites not working
- Cause: Maximum 5 favorites reached
- Fix: Remove one favorite before adding new ones
Enable detailed logging:
# Add to run_main():
self.worker.editor_logging_handler.info(f"Preferences: {prefs}")
self.worker.editor_logging_handler.info(f"Weather data: {weather}")View logs in OpenHome console or log file.
- Speak clearly - Wait for app to finish before responding
- Use full city names - "New York" instead of "NY"
- Be patient - API calls take 1-2 seconds
- Say "stop" to exit - Ends session immediately
- Keep responses short - 1-2 sentences max
- Always confirm actions - Use
run_confirmation_loop()for changes - Handle messy input - Voice transcription isn't perfect
- Test with real voice - Read responses aloud before deploying
โ Don't:
- Dump walls of text
- Use technical jargon
- Require precise input
- Skip confirmations for actions
โ Do:
- Keep responses brief (1-2 sentences)
- Use natural conversational language
- Accept varied input ("yeah", "yep", "sure")
- Always confirm before changing settings
The base LLM can answer questions like "What's the weather in Paris?" using its training data, but it cannot:
- Fetch real-time current weather
- Access live forecasts
- Remember user preferences across sessions
- Provide location-specific alerts
- Store favorite locations
This ability does what the LLM cannot - it takes action, accesses live data, and persists state.
- Startup time: <1 second
- API call latency: 1-2 seconds
- Total session time: 30-60 seconds
- API calls per session: 1-5
- Storage size: <5KB
- Batch favorites check - Single loop through all favorites
- Cache weather data - Reuse data within same session
- Limit forecast days - Only fetch 3 days (API limit)
- Truncate hourly data - Show only next 3 hours
Potential features for future versions:
- Compare Cities: Side-by-side weather comparison
- Travel Planning: Multi-day weather for trip dates
- Air Quality Index: AQI data and health recommendations
- Pollen Count: Allergy alerts
- Severe Weather Notifications: Proactive alerts
- Weather History: Past week's weather trends
- Custom Alerts: User-defined temperature/rain thresholds
- Multi-language Support: Localized responses
Contributions are welcome! Please:
- Fork the repository
- Create a feature branch
- Test thoroughly with voice
- Submit a pull request
This project is licensed under the MIT License.
- WeatherAPI.com - Free weather data API
- OpenHome - Voice-first platform
- Anthropic - Claude AI assistance
For issues or questions:
- Check Troubleshooting section
- Review OpenHome documentation
- Contact WeatherAPI.com support for API issues
- โ 3-day forecast
- โ Favorite locations management
- โ Hourly forecast
- โ Smart recommendations
- โ Sunrise/sunset times
- โ Temperature unit preference
- โ Persistent home location
User: "Weather"
App: "Ready. Your home is Paris. Paris. 7 degrees Celsius and partly cloudy.
89 percent chance of rain. Bring an umbrella and wear a jacket."
App: "Want the 3-day forecast?"
User: "Yes"
App: "Today: high 10, low 5, partly cloudy. Tomorrow: high 12, low 6, sunny.
Day after tomorrow: high 9, low 4, rainy."
App: "Want the hourly forecast?"
User: "No"
App: "Want sunrise and sunset times?"
User: "No"
App: "Do you want to change your Home"
User:"Yes"
App: "Which city for new home?"
User: "London"
App: "London is now your home"
User: "Paris. 6 degrees Celsius and patchy rain nearby."
App: "Do you want to change settings or manage favorites?"
User: "No"
App: "Do you want to check other areas?"
User: "No"
App: "Goodbye."
That's it! You're now a Weather Master pro! ๐ค๏ธ
Made with โค๏ธ for OpenHome by the Weather Master Team