Skip to content

Repository files navigation

SmartHaus 2.0 - IoT Home Automation

A comprehensive Flutter-based mobile application for controlling and monitoring ESP32-powered smart home devices. Features real-time video streaming, AI assistant with voice commands, security monitoring, and cross-platform support.

Screenshots

Login Screen Dashboard Smart Controls

Features

Core Functionality

  • AI Assistant: Voice commands with wake word detection ("Hey SmartHaus") powered by Porcupine and Google Gemini
  • Live Video Streaming: WebSocket-based ESP32-CAM integration with frame capture
  • Smart Door Control: Biometric authentication with 30-second auto-lock security feature
  • Water Level Monitoring: Real-time tank monitoring with threshold alerts
  • Relay Control System: Manage up to 8 smart devices with customizable names
  • Security Logs: Comprehensive logging with device health monitoring

Technical Features

  • Firebase Integration: Real-time database, authentication, cloud messaging, and cloud functions
  • Responsive UI: Material Design 3 with dark/light mode persistence
  • Background Wake Word: Foreground service for always-listening voice activation
  • Cross-Device Compatibility: Optimized storage permissions for major Android manufacturers

Tech Stack

Layer Technology
Frontend Flutter 3.9+ / Dart
Backend Firebase (Auth, RTDB, FCM, Functions)
Hardware ESP32-CAM, Relay modules, Fingerprint sensor
AI/Voice Google Gemini API, Porcupine Wake Word, Speech-to-Text
State Provider pattern with ChangeNotifier

Project Structure

lib/
 main.dart                    # Application entry point and main UI
 ai_chatbot_page.dart         # AI assistant with voice commands
 firebase_options.dart        # Firebase configuration (excluded from repo)
 websocket_stream_widget.dart # ESP32-CAM streaming component
 services/
     enhanced_permission_service.dart   # Cross-device permission handling
     manufacturer_storage_service.dart  # Device-specific storage management
     simple_notification_service.dart   # Push notification service

functions/
 src/index.ts                 # Firebase Cloud Functions for AI chatbot

assets/
 wake_words/                  # Porcupine wake word models

Database Schema

Firebase Realtime Database Structure

{
  "devices": {
    "esp32cam_001": {
      "ip_address": "192.168.1.100",
      "ws_port": 81
    },
    "fingerprint_door_001": {
      "failed_attempts": 0,
      "last_updated": "2025-12-22 16:07:03",
      "last_seen": "2025-12-22 16:07:10",
      "status": "active"
    },
    "water_level_001": {
      "water_level": true,
      "last_updated": "2025-12-22 03:14:50"
    }
  },
  "smart_controls": {
    "system_enabled": true,
    "last_seen": "2025-12-22 16:07:10",
    "relays": {
      "door": { "isLocked": true, "state": false },
      "1": { "name": "Living Room Light", "state": false }
    }
  }
}

Setup

  1. Clone the repository
  2. Run flutter pub get
  3. Create lib/firebase_options.dart from template
  4. Add android/app/google-services.json from Firebase Console
  5. (Optional) Deploy cloud functions: cd functions && npm install && firebase deploy --only functions
  6. Run flutter run

Build

# Android Release APK
flutter build apk --release

# Split APKs by architecture (smaller file sizes)
flutter build apk --split-per-abi

# Using build script
./build_production.bat   # Windows
./build_production.sh    # Linux/macOS

What's New in 2.0

  • AI chatbot with natural language control
  • Wake word detection for hands-free activation
  • Door auto-lock feature (30-second timer)
  • Device health monitoring with last_seen timestamps
  • Improved WebSocket lifecycle management
  • Floating AI assistant button on dashboard

License

MIT

About

Home Automation, Security, and Water Control System Project

Resources

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages