https://github.com/muawiya-contact/smart-home-simulator-
# Smart Home Simulator
https://github.com/muawiya-contact/smart-home-simulator-
coding-moves flask home-automation iot light-controller networking-programmability oop py-oop-iot-project python python-project smart-home termux wifi-communication
Last synced: about 1 month ago
JSON representation
# Smart Home Simulator
- Host: GitHub
- URL: https://github.com/muawiya-contact/smart-home-simulator-
- Owner: Muawiya-contact
- Created: 2025-04-20T15:02:22.000Z (about 1 month ago)
- Default Branch: main
- Last Pushed: 2025-04-20T18:04:00.000Z (about 1 month ago)
- Last Synced: 2025-04-24T00:58:27.472Z (about 1 month ago)
- Topics: coding-moves, flask, home-automation, iot, light-controller, networking-programmability, oop, py-oop-iot-project, python, python-project, smart-home, termux, wifi-communication
- Language: Python
- Homepage:
- Size: 188 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# ๐ Smart Home Simulator ๐ฆ | Powered by Python OOP + Flask + IoT
Welcome to the **Smart Home Simulator** โ a creative and fully functional IoT-based project where your **smartphone** acts as a **Smart Flashlight** (Light Device), and your **laptop** acts as the **Controller**! Built entirely using **Python**, **Flask**, and **Object-Oriented Programming (OOP)** concepts. No extra hardware required! ๐ป๐ฑ
---
[](https://www.linkedin.com/posts/contactmuawia_python-oop-iot-activity-7317201126267777024-MT_F?utm_source=share&utm_medium=member_desktop&rcm=ACoAAE83puMB2usKBg0a3tbcCz_4_33IjoRwOfw)
## ๐ก Project Highlights- โ Fully **Object-Oriented** Python structure
- โ Real-time **client-server communication** via HTTP
- โ Turns ON/OFF simulated Smart Flashlight remotely
- โ Uses only a **laptop & phone** to simulate real-world IoT
- โ Manual IP input = ๐ easily connect to any smart device on same network
- โ Bonus: ๐ Blink effect included!
- โ Future-ready: Easily expandable to other smart home devices---
## โ๏ธ Technologies Used
- ๐ Python 3
- ๐ Flask (REST API)
- ๐ก Wi-Fi LAN (Local Network Communication)
- ๐ง Object-Oriented Programming (OOP)
- ๐ฑ Termux (on Android for server)---
## ๐งฑ Project Structure
```
smart-home-simulator/
โ
โโโ controller.py # ๐ป Laptop - sends commands to the smart light
โโโ smart_light_server.py # ๐ฑ Phone - handles light states via Flask
โโโ README.md # ๐ You're here!
```
# ๐ How It Works
Think of this like a real-world smart home controller, but using basic devices and Python logic.## ๐ Communication Flow:
Run smart_light_server.py on your friendโs phone (Android + Termux + Flask)Run controller.py on your laptop
Enter the phoneโs IP address in your controller
Control light via options:
1๏ธโฃ Flash ON
2๏ธโฃ Flash OFF
3๏ธโฃ Blink
Flash is simulated as a virtual smart light using OOP
# ๐ง Setup Instructions
## ๐ฑ On Phone (Server):
1. Install Termux from F-Droid2. Run these commands in Termux:
```
pkg update
pkg install python
pip install flask termux-api
termux-setup-storage
```
3. Run the smart light server:
```
python smart_light_server.py
```
# ๐ป On Laptop (Client):
1. Install Flask & Requests:
```
pip install flask requests
```
2. Run the controller:
```
python controller.py
```
3. Enter IP of the phone when prompted# ๐ฎ Sample Controller Menu
```
Select the action:
1. Flash ON
2. Flash OFF
3. Blink
4. Exit
```
# ๐จโ๐ป Code Sample (Flashlight Class)
```
class SmartFlashlight:
def __init__(self):
self.state = "off"def turn_on(self):
self.state = "on"
return "Smart Flashlight is ON"def turn_off(self):
self.state = "off"
return "Smart Flashlight is OFF"def get_state(self):
return self.state
```
# ๐ ๏ธ Future Improvements
- ๐ก Auto IP detection & device scanning- ๐ฑ Mobile-friendly web GUI
- ๐ฒ Integrate with real flashlight or LED (via GPIO/Arduino)
- ๐ Analytics & dashboard for smart home actions
- ๐ Control multiple devices (Fan, AC, etc.)
# ๐ง What We Learned
- Real-world implementation of OOP in Python- Building REST APIs with Flask
- Local network-based IoT simulation
- Client-server architecture
- Collaboration and modular design in code
# ๐ Author
๐จโ๐ป Muawiya โ @Coding_Moves# ๐ Show Your Support
If you found this project inspiring:+ โญ Star this repo
+ ๐ข Share with friends
+ ๐ฝ๏ธ Watch the video demo on YouTube
+ ๐ Post it on LinkedIn with us!