A modern, responsive smart home dashboard with real-time device control, voice commands, and analytics.
- Device Control: Toggle lights, speakers, AC, fans, and locks
- Voice Commands: Control devices with voice using Web Speech API
- Real-time Weather: Live weather data integration
- Energy Analytics: Dynamic energy consumption charts using Chart.js
- Room Temperature Control: Multi-room temperature management
- AI Chatbot: GPT-powered assistant with device control integration
- State Persistence: Device states saved using localStorage
- Toast Notifications: Modern notification system
- Responsive Design: Works on desktop and mobile devices
-
Clone the repository
git clone <repository-url> cd smart-home
-
Open the application
- Simply open
index.html
in your browser - Or use a local server:
python -m http.server 8000
- Simply open
-
Access the dashboard
- Main dashboard:
index.html
- About page:
aboutus.html
- Main dashboard:
- Double-click anywhere or click the microphone button
- Say commands like: "turn on light", "turn off speaker", "turn on AC"
- Toggle switches to control devices
- States are automatically saved and restored
- Real-time notifications for all actions
- Select different rooms from the dropdown
- Temperatures update based on real weather data
- Preferences are saved automatically
- Click the chat button to open the AI assistant
- Ask questions or give device commands
- Try: "Turn on the living room lights"
The project uses these APIs (optional for basic functionality):
-
OpenWeatherMap API (for weather data)
- Get your key at: https://openweathermap.org/api
- Set as environment variable:
WEATHER_API_KEY
-
OpenAI API (for chatbot)
- Get your key at: https://platform.openai.com/
- Update in
script.js
(line with API_KEY)
WEATHER_API_KEY=your_weather_api_key_here
For full smart home functionality, consider setting up a backend:
-
Install dependencies
npm init -y npm install express mongoose cors dotenv jsonwebtoken bcryptjs
-
Create server structure
backend/ ├── server.js ├── models/ │ ├── User.js │ ├── Device.js │ └── Log.js ├── routes/ │ ├── auth.js │ ├── devices.js │ └── analytics.js └── middleware/ └── auth.js
-
Basic server setup
// server.js const express = require('express'); const mongoose = require('mongoose'); const cors = require('cors'); require('dotenv').config(); const app = express(); app.use(cors()); app.use(express.json()); mongoose.connect(process.env.MONGODB_URI); app.use('/api/auth', require('./routes/auth')); app.use('/api/devices', require('./routes/devices')); app.use('/api/analytics', require('./routes/analytics')); const PORT = process.env.PORT || 5000; app.listen(PORT, () => console.log(`Server running on port ${PORT}`));
- Vercel: Perfect for static sites with serverless functions
- Render: Easy deployment with automatic scaling
- Railway: Simple container deployment
- Netlify: Great for static sites with form handling
smart-home/
├── index.html # Main dashboard
├── aboutus.html # About page
├── script.js # Main JavaScript functionality
├── styles.css # Main stylesheet
├── aboutus.css # About page styles
├── profile/ # Profile images and favicon
└── README.md # This file
- API Keys: Never commit API keys to version control
- HTTPS: Use HTTPS in production for secure communication
- Input Validation: Validate all user inputs
- Rate Limiting: Implement rate limiting for API endpoints
- Authentication: Use JWT tokens for user authentication
-
Voice commands not working
- Ensure microphone permissions are granted
- Check browser compatibility (Chrome/Edge recommended)
-
Weather data not loading
- Verify API key is correct
- Check network connectivity
-
Chart not displaying
- Ensure Chart.js CDN is loading
- Check browser console for errors
- Chrome/Edge: Full support
- Firefox: Most features supported
- Safari: Limited voice command support
- Fork the repository
- Create a feature branch
- Make your changes
- Test thoroughly
- Submit a pull request
This project is licensed under the MIT License - see the LICENSE file for details.
Ramkumar V - Intern @COSMIC365 AI
- GitHub: fuzziecoder
- Instagram: fuzziecoder
Design by 😄 fuzziecoder