SmartDKDH is a comprehensive IoT-based home automation system that allows users to monitor and control various home devices through a mobile application. The system integrates with the Adafruit IO platform to provide real-time device control and sensor monitoring.
The project consists of two main components:
- Mobile Application (home-app): A React Native app built with Expo
- Backend Server: A FastAPI-based server handling data and device management
- User Authentication: Secure login and registration system
- Device Control: Control LED lights and fans remotely
- Sensor Monitoring: View real-time data from temperature and humidity sensors
- Profile Management: User profile updates with secure data handling
- Voice Control: Voice commands for device operation
- Real-time Updates: WebSocket connection for instant device status updates
- REST API: RESTful endpoints for data access and modification
- WebSocket Service: Real-time communication with client applications
- MongoDB Integration: Persistent data storage with MongoDB
- Adafruit IO Integration: Connection to Adafruit IoT platform
- User Management: CRUD operations for user accounts
- Device Management: Registration and control of connected devices
- React Native / Expo: Cross-platform mobile framework
- Expo Router: File-based navigation system
- AsyncStorage: Local data persistence
- React Native Animated: UI animations
- WebSocket: Real-time communication
- FastAPI: Modern, high-performance web framework for Python
- MongoDB: NoSQL database for data storage
- PyMongo: MongoDB driver for Python
- Pydantic: Data validation and settings management
- WebSockets: Real-time communication protocol
- Node.js (v14 or higher)
- Python 3.8+
- MongoDB
- Adafruit IO account
- Android Studio / Xcode (for mobile development)
- Navigate to the backend directory:
cd backend - Create and activate a virtual environment:
python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate
- Install dependencies:
pip install -r requirements.txt
- Configure environment variables:
Create a
.envfile and add the following:MONGODB_URI=<your-mongodb-uri> ADAFRUIT_IO_KEY=<your-adafruit-io-key> ADAFRUIT_IO_USERNAME=<your-adafruit-io-username> SECRET_KEY=<your-secret-key> - Start the server:
uvicorn main:app --reload
- Navigate to the home-app directory:
cd home-app - Install dependencies:
npm install
- Configure API endpoint:
Update the
API_BASE_URLin the appropriate files to point to your backend server - Start the Expo development server:
npx expo start
- Run on a device or emulator:
- Press
afor Android - Press
ifor iOS - Scan the QR code with the Expo Go app on your physical device
- Press
POST /api/users: Register a new userGET /api/users/{user_no}: Get user detailsPATCH /api/users/{user_no}: Update user profileDELETE /api/users/{user_no}: Delete a user
POST /api/auth/login: User loginPOST /api/auth/logout: User logout
GET /led-devices: List all LED devicesGET /fan-devices: List all fan devicesPOST /led-control: Control LED devicePOST /fan-control: Control fan device
/ws: WebSocket endpoint for real-time updates
- Flux Pattern (Redux): For state management
- Component Composition Pattern: For UI building
- Container/Presentational Pattern: For separating logic and UI
- Observer Pattern: For real-time updates
- Command Pattern: For voice control
- MVC Pattern: For API organization
- Repository Pattern: For data access
- REST API Pattern: For HTTP endpoints
- WebSocket Pattern: For real-time communication
- Middleware Pattern: For request processing
- Automation Rules: Allow users to create custom automation rules
- Energy Monitoring: Track energy usage of connected devices
- Scene Management: Create and save device configurations as scenes
- Two-factor Authentication: Add additional security layer
- Offline Mode: Basic functionality when internet is unavailable
This project is maintained by the SmartDKDH team.
This project is licensed under the MIT License - see the LICENSE file for details.
- Adafruit IO for the IoT platform
- FastAPI for the efficient API framework
- Expo for simplifying mobile development
- MongoDB for database services