# hirnoel/deisgn-patterns-smart-home architecture

> Architecture diagram of the GitHub repository hirnoel/deisgn-patterns-smart-home, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-12-02). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/hirnoel/deisgn-patterns-smart-home
- Repository: https://github.com/hirnoel/deisgn-patterns-smart-home

## Overview

This is a Java smart-home dashboard and environment simulator. A user adds room devices and sensors, creates sensor-triggered or scheduled rules, and operates security modes; simulation updates room conditions, which can trigger rules or security alerts. Device commands pass through a hub that records history and supports undo. The source index and excerpts support these relationships, but the README is empty and some runtime modules were not sampled, so their internal links are omitted.

Main entry points: [`src/main/java/com/smarthome/gui/SmartHomeDashboard.java`](https://github.com/hirnoel/deisgn-patterns-smart-home/blob/main/src/main/java/com/smarthome/gui/SmartHomeDashboard.java) (Home dashboard), [`src/main/java/com/smarthome/simulation/RoomEnvironment.java`](https://github.com/hirnoel/deisgn-patterns-smart-home/blob/main/src/main/java/com/smarthome/simulation/RoomEnvironment.java) (Room environment), [`src/main/java/com/smarthome/factories/DeviceFactory.java`](https://github.com/hirnoel/deisgn-patterns-smart-home/blob/main/src/main/java/com/smarthome/factories/DeviceFactory.java) (Device factory), [`src/main/java/com/smarthome/rules/AutomationRule.java`](https://github.com/hirnoel/deisgn-patterns-smart-home/blob/main/src/main/java/com/smarthome/rules/AutomationRule.java) (Automation rule)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ui["Dashboard"]
  node_dashboard["Home dashboard"]
end

subgraph group_devices["Devices and commands"]
  node_device["Smart device<br/>[SmartDevice.java]"]
  node_factory["Device factory<br/>[DeviceFactory.java]"]
  node_light["Smart light<br/>[SmartLight.java]"]
  node_ac["Smart AC<br/>[SmartAC.java]"]
  node_blinds["Blinds adapter<br/>[BlindsAdapter.java]"]
  node_motorized["Motorized blinds"]
  node_command["Device commands<br/>[Command.java]"]
  node_hub["Command hub<br/>[SmartHomeHub.java]"]
end

subgraph group_automation["Sensors and automation"]
  node_heat["Heat sensor"]
  node_light_sensor["Light sensor"]
  node_motion["Motion sensor"]
  node_smoke["Smoke detector"]
  node_observer["Sensor observer"]
  node_automation_rule["Automation rule"]
  node_time_rule["Time rule<br/>[TimeRule.java]"]
  node_scheduler["Rule scheduler<br/>[Scheduler.java]"]
end

subgraph group_environment["Simulation and security"]
  node_room["Room environment"]
  node_simulator["Environment simulator"]
  node_security["Security system"]
  node_security_modes["Security modes"]
end

node_user(("Home user"))

node_user -->|"operates"| node_dashboard
node_dashboard -->|"creates devices"| node_factory
node_dashboard -->|"manages rooms"| node_room
node_dashboard -->|"issues commands"| node_hub
node_dashboard -->|"configures rules"| node_automation_rule
node_dashboard -->|"schedules actions"| node_time_rule
node_dashboard -->|"sets security"| node_security
node_dashboard -->|"reads simulation"| node_simulator
node_factory -->|"creates"| node_light
node_factory -->|"creates"| node_ac
node_factory -->|"adapts"| node_blinds
node_blinds -->|"delegates"| node_motorized
node_light -->|"implements"| node_device
node_ac -->|"implements"| node_device
node_hub -->|"executes"| node_command
node_automation_rule -->|"executes via"| node_hub
node_time_rule -->|"executes via"| node_hub
node_scheduler -->|"runs rules"| node_time_rule
node_room -->|"updates device effects"| node_device
node_room -->|"updates temperature"| node_heat
node_room -->|"updates light"| node_light_sensor
node_room -->|"simulates motion"| node_motion
node_room -->|"simulates smoke"| node_smoke
node_heat -->|"notifies observers"| node_automation_rule
node_light_sensor -->|"notifies observers"| node_observer
node_automation_rule -->|"implements"| node_observer
node_motion -->|"triggers motion"| node_security
node_security -->|"delegates state"| node_security_modes
node_simulator -->|"simulates rooms"| node_room
node_simulator -->|"uses scheduler"| node_scheduler

click node_dashboard "https://github.com/hirnoel/deisgn-patterns-smart-home/blob/main/src/main/java/com/smarthome/gui/SmartHomeDashboard.java"
click node_room "https://github.com/hirnoel/deisgn-patterns-smart-home/blob/main/src/main/java/com/smarthome/simulation/RoomEnvironment.java"
click node_simulator "https://github.com/hirnoel/deisgn-patterns-smart-home/blob/main/src/main/java/com/smarthome/simulation/EnvironmentSimulator.java"
click node_device "https://github.com/hirnoel/deisgn-patterns-smart-home/blob/main/src/main/java/com/smarthome/core/SmartDevice.java"
click node_factory "https://github.com/hirnoel/deisgn-patterns-smart-home/blob/main/src/main/java/com/smarthome/factories/DeviceFactory.java"
click node_light "https://github.com/hirnoel/deisgn-patterns-smart-home/blob/main/src/main/java/com/smarthome/devices/SmartLight.java"
click node_ac "https://github.com/hirnoel/deisgn-patterns-smart-home/blob/main/src/main/java/com/smarthome/devices/SmartAC.java"
click node_blinds "https://github.com/hirnoel/deisgn-patterns-smart-home/blob/main/src/main/java/com/smarthome/adapters/BlindsAdapter.java"
click node_motorized "https://github.com/hirnoel/deisgn-patterns-smart-home/blob/main/src/main/java/com/smarthome/thirdparty/MotorizedBlinds.java"
click node_command "https://github.com/hirnoel/deisgn-patterns-smart-home/blob/main/src/main/java/com/smarthome/commands/Command.java"
click node_hub "https://github.com/hirnoel/deisgn-patterns-smart-home/blob/main/src/main/java/com/smarthome/hub/SmartHomeHub.java"
click node_heat "https://github.com/hirnoel/deisgn-patterns-smart-home/blob/main/src/main/java/com/smarthome/sensors/SmartHeatSensor.java"
click node_light_sensor "https://github.com/hirnoel/deisgn-patterns-smart-home/blob/main/src/main/java/com/smarthome/sensors/SmartLightSensor.java"
click node_motion "https://github.com/hirnoel/deisgn-patterns-smart-home/blob/main/src/main/java/com/smarthome/sensors/SmartMotionSensor.java"
click node_smoke "https://github.com/hirnoel/deisgn-patterns-smart-home/blob/main/src/main/java/com/smarthome/sensors/SmartSmokeDetector.java"
click node_observer "https://github.com/hirnoel/deisgn-patterns-smart-home/blob/main/src/main/java/com/smarthome/core/SensorObserver.java"
click node_automation_rule "https://github.com/hirnoel/deisgn-patterns-smart-home/blob/main/src/main/java/com/smarthome/rules/AutomationRule.java"
click node_time_rule "https://github.com/hirnoel/deisgn-patterns-smart-home/blob/main/src/main/java/com/smarthome/rules/TimeRule.java"
click node_scheduler "https://github.com/hirnoel/deisgn-patterns-smart-home/blob/main/src/main/java/com/smarthome/rules/Scheduler.java"
click node_security "https://github.com/hirnoel/deisgn-patterns-smart-home/blob/main/src/main/java/com/smarthome/security/SecuritySystem.java"
click node_security_modes "https://github.com/hirnoel/deisgn-patterns-smart-home/tree/main/src/main/java/com/smarthome/security"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_dashboard,node_user toneBlue
class node_device,node_factory,node_light,node_ac,node_blinds,node_motorized,node_command,node_hub toneAmber
class node_heat,node_light_sensor,node_motion,node_smoke,node_observer,node_automation_rule,node_time_rule,node_scheduler toneMint
class node_room,node_simulator,node_security,node_security_modes toneRose
```

## Components

### Dashboard

- [Home dashboard](https://github.com/hirnoel/deisgn-patterns-smart-home/blob/main/src/main/java/com/smarthome/gui/SmartHomeDashboard.java): `src/main/java/com/smarthome/gui/SmartHomeDashboard.java`

### Devices and commands

- [Smart device](https://github.com/hirnoel/deisgn-patterns-smart-home/blob/main/src/main/java/com/smarthome/core/SmartDevice.java): `src/main/java/com/smarthome/core/SmartDevice.java`
- [Device factory](https://github.com/hirnoel/deisgn-patterns-smart-home/blob/main/src/main/java/com/smarthome/factories/DeviceFactory.java): `src/main/java/com/smarthome/factories/DeviceFactory.java`
- [Smart light](https://github.com/hirnoel/deisgn-patterns-smart-home/blob/main/src/main/java/com/smarthome/devices/SmartLight.java): `src/main/java/com/smarthome/devices/SmartLight.java`
- [Smart AC](https://github.com/hirnoel/deisgn-patterns-smart-home/blob/main/src/main/java/com/smarthome/devices/SmartAC.java): `src/main/java/com/smarthome/devices/SmartAC.java`
- [Blinds adapter](https://github.com/hirnoel/deisgn-patterns-smart-home/blob/main/src/main/java/com/smarthome/adapters/BlindsAdapter.java): `src/main/java/com/smarthome/adapters/BlindsAdapter.java`
- [Motorized blinds](https://github.com/hirnoel/deisgn-patterns-smart-home/blob/main/src/main/java/com/smarthome/thirdparty/MotorizedBlinds.java): `src/main/java/com/smarthome/thirdparty/MotorizedBlinds.java`
- [Device commands](https://github.com/hirnoel/deisgn-patterns-smart-home/blob/main/src/main/java/com/smarthome/commands/Command.java): `src/main/java/com/smarthome/commands/Command.java`
- [Command hub](https://github.com/hirnoel/deisgn-patterns-smart-home/blob/main/src/main/java/com/smarthome/hub/SmartHomeHub.java): `src/main/java/com/smarthome/hub/SmartHomeHub.java`

### Sensors and automation

- [Heat sensor](https://github.com/hirnoel/deisgn-patterns-smart-home/blob/main/src/main/java/com/smarthome/sensors/SmartHeatSensor.java): `src/main/java/com/smarthome/sensors/SmartHeatSensor.java`
- [Light sensor](https://github.com/hirnoel/deisgn-patterns-smart-home/blob/main/src/main/java/com/smarthome/sensors/SmartLightSensor.java): `src/main/java/com/smarthome/sensors/SmartLightSensor.java`
- [Motion sensor](https://github.com/hirnoel/deisgn-patterns-smart-home/blob/main/src/main/java/com/smarthome/sensors/SmartMotionSensor.java): `src/main/java/com/smarthome/sensors/SmartMotionSensor.java`
- [Smoke detector](https://github.com/hirnoel/deisgn-patterns-smart-home/blob/main/src/main/java/com/smarthome/sensors/SmartSmokeDetector.java): `src/main/java/com/smarthome/sensors/SmartSmokeDetector.java`
- [Sensor observer](https://github.com/hirnoel/deisgn-patterns-smart-home/blob/main/src/main/java/com/smarthome/core/SensorObserver.java): `src/main/java/com/smarthome/core/SensorObserver.java`
- [Automation rule](https://github.com/hirnoel/deisgn-patterns-smart-home/blob/main/src/main/java/com/smarthome/rules/AutomationRule.java): `src/main/java/com/smarthome/rules/AutomationRule.java`
- [Time rule](https://github.com/hirnoel/deisgn-patterns-smart-home/blob/main/src/main/java/com/smarthome/rules/TimeRule.java): `src/main/java/com/smarthome/rules/TimeRule.java`
- [Rule scheduler](https://github.com/hirnoel/deisgn-patterns-smart-home/blob/main/src/main/java/com/smarthome/rules/Scheduler.java): `src/main/java/com/smarthome/rules/Scheduler.java`

### Simulation and security

- [Room environment](https://github.com/hirnoel/deisgn-patterns-smart-home/blob/main/src/main/java/com/smarthome/simulation/RoomEnvironment.java): `src/main/java/com/smarthome/simulation/RoomEnvironment.java`
- [Environment simulator](https://github.com/hirnoel/deisgn-patterns-smart-home/blob/main/src/main/java/com/smarthome/simulation/EnvironmentSimulator.java): `src/main/java/com/smarthome/simulation/EnvironmentSimulator.java`
- [Security system](https://github.com/hirnoel/deisgn-patterns-smart-home/blob/main/src/main/java/com/smarthome/security/SecuritySystem.java): `src/main/java/com/smarthome/security/SecuritySystem.java`
- [Security modes](https://github.com/hirnoel/deisgn-patterns-smart-home/tree/main/src/main/java/com/smarthome/security): `src/main/java/com/smarthome/security`

### Other components

- **Home user**

## Connections

- Home user → Home dashboard: operates (evidence: `src/main/java/com/smarthome/gui/SmartHomeDashboard.java`)
- Home dashboard → Device factory: creates devices (evidence: `src/main/java/com/smarthome/gui/SmartHomeDashboard.java`)
- Home dashboard → Room environment: manages rooms (evidence: `src/main/java/com/smarthome/gui/SmartHomeDashboard.java`)
- Home dashboard → Command hub: issues commands (evidence: `src/main/java/com/smarthome/gui/SmartHomeDashboard.java`)
- Home dashboard → Automation rule: configures rules (evidence: `src/main/java/com/smarthome/gui/SmartHomeDashboard.java`)
- Home dashboard → Time rule: schedules actions (evidence: `src/main/java/com/smarthome/gui/SmartHomeDashboard.java`)
- Home dashboard → Security system: sets security (evidence: `src/main/java/com/smarthome/gui/SmartHomeDashboard.java`)
- Home dashboard → Environment simulator: reads simulation (evidence: `src/main/java/com/smarthome/gui/SmartHomeDashboard.java`)
- Device factory → Smart light: creates (evidence: `src/main/java/com/smarthome/factories/DeviceFactory.java`)
- Device factory → Smart AC: creates (evidence: `src/main/java/com/smarthome/factories/DeviceFactory.java`)
- Device factory → Blinds adapter: adapts (evidence: `src/main/java/com/smarthome/factories/DeviceFactory.java`)
- Blinds adapter → Motorized blinds: delegates (evidence: `src/main/java/com/smarthome/adapters/BlindsAdapter.java`)
- Smart light → Smart device: implements (evidence: `src/main/java/com/smarthome/devices/SmartLight.java`)
- Smart AC → Smart device: implements (evidence: `src/main/java/com/smarthome/devices/SmartAC.java`)
- Command hub → Device commands: executes (evidence: `src/main/java/com/smarthome/hub/SmartHomeHub.java`)
- Automation rule → Command hub: executes via (evidence: `src/main/java/com/smarthome/rules/AutomationRule.java`)
- Time rule → Command hub: executes via (evidence: `src/main/java/com/smarthome/rules/TimeRule.java`)
- Rule scheduler → Time rule: runs rules (evidence: `src/main/java/com/smarthome/rules/Scheduler.java`)
- Room environment → Smart device: updates device effects (evidence: `src/main/java/com/smarthome/simulation/RoomEnvironment.java`)
- Room environment → Heat sensor: updates temperature (evidence: `src/main/java/com/smarthome/simulation/RoomEnvironment.java`)
- Room environment → Light sensor: updates light (evidence: `src/main/java/com/smarthome/simulation/RoomEnvironment.java`)
- Room environment → Motion sensor: simulates motion (evidence: `src/main/java/com/smarthome/simulation/RoomEnvironment.java`)
- Room environment → Smoke detector: simulates smoke (evidence: `src/main/java/com/smarthome/simulation/RoomEnvironment.java`)
- Heat sensor → Automation rule: notifies observers (evidence: `src/main/java/com/smarthome/sensors/SmartHeatSensor.java`)
- Light sensor → Sensor observer: notifies observers (evidence: `src/main/java/com/smarthome/sensors/SmartLightSensor.java`)
- Automation rule → Sensor observer: implements (evidence: `src/main/java/com/smarthome/rules/AutomationRule.java`)
- Motion sensor → Security system: triggers motion (evidence: `src/main/java/com/smarthome/sensors/SmartMotionSensor.java`)
- Security system → Security modes: delegates state (evidence: `src/main/java/com/smarthome/security/SecuritySystem.java`)
- Environment simulator → Room environment: simulates rooms (evidence: `src/main/java/com/smarthome/simulation/EnvironmentSimulator.java`)
- Environment simulator → Rule scheduler: uses scheduler (evidence: `src/main/java/com/smarthome/simulation/EnvironmentSimulator.java`)
