Skip to content

Voice-controlled weather app for MentraOS smart glasses with location-based forecasts

Notifications You must be signed in to change notification settings

buildwithfenna/WeatherToday

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

WeatherToday! 🌤️

Voice-controlled weather app for MentraOS smart glasses with location-based forecasts.

Features

  • Voice Commands: Ask "What's the weather?" or "Weather in [city name]"
  • Auto-Location: Automatically detects your current location for local weather
  • Current Conditions: Temperature, weather description, humidity, and wind
  • Multiple Cities: Get weather for any city by voice command
  • Smart Display: Clean, readable weather cards optimized for smart glasses
  • Audio Feedback: Spoken weather summaries for hands-free use

Setup and Deployment

Prerequisites

Installation

  1. Clone the repository:

    git clone https://github.com/buildwithfenna/WeatherToday.git
    cd WeatherToday
  2. Install dependencies:

    npm install
    # or
    bun install
  3. Set up environment variables:

    cp .env.example .env

Required API Keys and Environment Variables

Edit your .env file with the following required variables:

# MentraOS Configuration (Required)
MENTRAOS_API_KEY=your_mentraos_api_key_here
MENTRAOS_PACKAGE_NAME=com.yourcompany.weathertoday

# Weather API Configuration (Required)
OPENWEATHER_API_KEY=your_openweather_api_key_here

# Server Configuration (Optional)
PORT=3000
NGROK_URL=your_ngrok_url_here
NODE_ENV=development

Where to get API keys:

MentraOS Developer Console Setup

  1. Register your app at console.mentraglass.com
  2. Set package name: com.yourcompany.weathertoday (or your preferred package name)
  3. Set webhook URL: Your ngrok URL + /webhook (e.g., https://your-ngrok-url.ngrok.io/webhook)
  4. Required permissions:
    • MICROPHONE - For voice commands
    • LOCATION - For current location weather

How to Run the App Locally

  1. Start the development server:

    npm run dev
    # or
    bun run dev
  2. Expose with ngrok (in a separate terminal):

    ngrok http --url=your-ngrok-url 3000
  3. Test on your MentraOS device:

    • Install the Mentra app on your phone
    • Launch your WeatherToday! app
    • Try voice commands like:
      • "What's the weather?"
      • "Weather in New York"
      • "Current conditions"

Voice Commands

  • "What's the weather?" - Gets weather for your current location
  • "Weather in [city]" - Gets weather for any city (e.g., "Weather in Tokyo")
  • "Current conditions" - Shows current weather conditions
  • "How's the weather?" - Alternative way to ask for current weather

Button Controls

  • Select Button: Get current location weather
  • Back Button: Return to welcome screen

Build for Production

npm run build
npm start

Development

# Run in development mode with hot reload
npm run dev

# Build TypeScript
npm run build

# Lint code
npm run lint

# Format code
npm run format

Troubleshooting

"Permission denied" errors:

  • Ensure MICROPHONE and LOCATION permissions are enabled in the MentraOS Developer Console
  • Check that users have approved permissions when installing the app

"Failed to fetch weather data" errors:

  • Verify your OpenWeatherMap API key is valid and has sufficient quota
  • Check internet connectivity

Location timeout errors:

  • Location requests timeout after 10 seconds
  • Try specifying a city name instead: "Weather in [your city]"

App not responding to voice commands:

  • Check that MICROPHONE permission is granted
  • Ensure your ngrok tunnel is active and webhook URL is correct in the developer console

License

MIT License - see LICENSE file for details.

Support

For MentraOS SDK questions, visit the MentraOS documentation or join the developer community.

About

Voice-controlled weather app for MentraOS smart glasses with location-based forecasts

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published