The ABCD Smart Home Automation System is a console-based application designed to simulate a smart home environment. The system features a main control panel that manages various smart devices and users, allowing for flexible automation and notification handling. No GUI or database is used; all interactions occur via the console.
- Single Main Control Panel: Only one instance exists at a time (Singleton pattern with lazy initialization).
- Smart Devices: Initially includes a smart thermostat, smart air conditioner, smart light, and smart camera. Each device can be turned on/off and has device-specific commands.
- User Management: Supports multiple users (admin, registered, and unregistered). Admin has full access; registered users receive notifications based on mode; unregistered users do not receive notifications.
- Modes of Operation: The control panel can operate in multiple modes (Away, Pet, Active), affecting notification behavior.
- Extensible Design: New devices and features can be added with minimal changes to the core logic.
- Turn all devices on/off from the control panel
- Device-specific commands (e.g., change temperature, adjust fan speed, change resolution, change brightness)
- User registration and notification preferences
- Mode switching (Away, Pet, Active) with dynamic notification strategies
- Real-time notifications to users based on device events and current mode
- Purpose: Ensures only one instance of the Main Control Panel exists, created only when first needed.
- Scenario: The control panel is the central hub for the entire home and must be unique.
- Purpose: Encapsulates the creation of smart devices, allowing for easy addition of new device types.
- Scenario: Devices are created by a dedicated factory after the control panel is initialized.
- Purpose: Allows sequential traversal of devices and users for bulk operations (e.g., turning all devices on/off, sending notifications).
- Scenario: The control panel iterates through device and user lists to perform actions consistently.
- Purpose: Implements a notification system where users can register/unregister for device notifications.
- Scenario: Registered users receive notifications based on mode; admin always receives all notifications.
- Purpose: Encapsulates user actions (e.g., turn all devices on/off) as command objects, decoupling request from execution.
- Scenario: Each action is a command object with an
execute()method, allowing for flexible action management.
- Purpose: Allows the control panel to switch between different notification algorithms (modes) at runtime.
- Scenario: Modes (Active, Away, Pet) are implemented as strategies, each handling notifications differently.
- Start the Application: The control panel is initialized on first use.
- Device Management: Devices are created via the factory and managed by the control panel.
- User Management: Users can register, unregister, and set notification preferences.
- Mode Switching: Users can switch between Active, Away, and Pet modes to change notification behavior.
- Command Execution: Actions like turning all devices on/off are executed via command objects.
- In Away Mode, if the smart camera detects movement, all registered users are notified.
- In Pet Mode, notifications are sent for movement except when a pet is detected.
- In Active Mode, notifications are suppressed for all except the admin.
- Add New Devices: Implement a new device class and update the factory.
- Add New Modes: Implement a new strategy class and integrate it with the control panel.
main/- Main application logic and entry pointcontrolPanel/- Control panel (Singleton)devices/- Smart device classesfactory/- Device factory (Factory Method)iterator/- Iterators for devices and usersusers/- User management and observer logiccommand/- Command pattern implementationsstrategy/- Notification strategies (modes)
This project demonstrates the use of multiple software design patterns in a practical smart home automation scenario, focusing on extensibility, maintainability, and clear separation of concerns.
