An open API service indexing awesome lists of open source software.

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

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! ๐Ÿ’ป๐Ÿ“ฑ

---
[![Watch Demo](thumbnail.jpg)](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-Droid

2. 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!