# oursprojects/nexushome architecture

> Architecture diagram of the GitHub repository oursprojects/nexushome, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-01). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/oursprojects/nexushome
- Repository: https://github.com/oursprojects/nexushome

## Overview

NexusHome is an Android smart-home controller: users connect to paired hardware, monitor temperature and device status, switch automatic/manual operation, and issue light, fan, and curtain commands. The app’s ViewModel exposes Bluetooth state to the main screen; command history is persisted locally and displayed separately. The README also documents a preconfigured VC-02 offline voice module. Source excerpts establish the app, Bluetooth service, and history-storage relationships; links to firmware and voice hardware reflect README-level product descriptions, not inspected firmware internals.

Main entry points: [`app/src/main/java/com/capstone/nexushome/MainActivity.kt`](https://github.com/oursprojects/nexushome/blob/main/app/src/main/java/com/capstone/nexushome/MainActivity.kt) (Control dashboard), [`app/src/main/java/com/capstone/nexushome/CommandHistoryActivity.kt`](https://github.com/oursprojects/nexushome/blob/main/app/src/main/java/com/capstone/nexushome/CommandHistoryActivity.kt) (History screen), [`app/src/main/java/com/capstone/nexushome/MainViewModel.kt`](https://github.com/oursprojects/nexushome/blob/main/app/src/main/java/com/capstone/nexushome/MainViewModel.kt) (Main ViewModel), [`app/src/main/java/com/capstone/nexushome/bluetooth/BluetoothService.kt`](https://github.com/oursprojects/nexushome/blob/main/app/src/main/java/com/capstone/nexushome/bluetooth/BluetoothService.kt) (Bluetooth service)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_android["Android app"]
  node_main_screen["Control dashboard<br/>[MainActivity.kt]"]
  node_view_model["Main ViewModel<br/>[MainViewModel.kt]"]
  node_bluetooth["Bluetooth service"]
end

subgraph group_device["Smart-home device"]
  node_firmware["Device firmware<br/>[NexusHomeCode.ino]"]
  node_home_hardware{{"NexusHome hardware"}}
  node_voice_module{{"VC-02 voice module"}}
end

subgraph group_history["Command history"]
  node_history_activity["History screen"]
  node_log_adapter["Log list adapter"]
  node_log_dao["Command log DAO<br/>[CommandLogDao.kt]"]
  node_log_entity["Command log record<br/>[CommandLog.kt]"]
  node_app_database[("Local Room database<br/>[AppDatabase.kt]")]
end

node_resident(("Home user"))

node_resident -->|"controls"| node_main_screen
node_main_screen -->|"observes state"| node_view_model
node_main_screen -->|"sends commands"| node_view_model
node_view_model -->|"delegates control"| node_bluetooth
node_bluetooth -->|"Bluetooth control"| node_home_hardware
node_home_hardware -->|"status updates"| node_bluetooth
node_firmware -.->|"runs on"| node_home_hardware
node_voice_module -.->|"voice control"| node_home_hardware
node_main_screen -->|"records commands"| node_app_database
node_history_activity -->|"opens database"| node_app_database
node_app_database -->|"provides DAO"| node_log_dao
node_log_dao -->|"stores records"| node_log_entity
node_history_activity -->|"observes and clears"| node_log_dao
node_history_activity -->|"renders entries"| node_log_adapter
node_log_adapter -->|"displays fields"| node_log_entity

click node_main_screen "https://github.com/oursprojects/nexushome/blob/main/app/src/main/java/com/capstone/nexushome/MainActivity.kt"
click node_view_model "https://github.com/oursprojects/nexushome/blob/main/app/src/main/java/com/capstone/nexushome/MainViewModel.kt"
click node_bluetooth "https://github.com/oursprojects/nexushome/blob/main/app/src/main/java/com/capstone/nexushome/bluetooth/BluetoothService.kt"
click node_history_activity "https://github.com/oursprojects/nexushome/blob/main/app/src/main/java/com/capstone/nexushome/CommandHistoryActivity.kt"
click node_log_adapter "https://github.com/oursprojects/nexushome/blob/main/app/src/main/java/com/capstone/nexushome/adapter/CommandLogAdapter.kt"
click node_log_dao "https://github.com/oursprojects/nexushome/blob/main/app/src/main/java/com/capstone/nexushome/data/CommandLogDao.kt"
click node_log_entity "https://github.com/oursprojects/nexushome/blob/main/app/src/main/java/com/capstone/nexushome/data/CommandLog.kt"
click node_app_database "https://github.com/oursprojects/nexushome/blob/main/app/src/main/java/com/capstone/nexushome/data/AppDatabase.kt"
click node_firmware "https://github.com/oursprojects/nexushome/blob/main/firmware/NexusHomeCode.ino"

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_main_screen,node_view_model,node_bluetooth,node_resident toneBlue
class node_firmware,node_home_hardware,node_voice_module toneAmber
class node_history_activity,node_log_adapter,node_log_dao,node_log_entity,node_app_database toneMint
```

## Components

### Android app

- [Control dashboard](https://github.com/oursprojects/nexushome/blob/main/app/src/main/java/com/capstone/nexushome/MainActivity.kt): `app/src/main/java/com/capstone/nexushome/MainActivity.kt`
- [Main ViewModel](https://github.com/oursprojects/nexushome/blob/main/app/src/main/java/com/capstone/nexushome/MainViewModel.kt): `app/src/main/java/com/capstone/nexushome/MainViewModel.kt`
- [Bluetooth service](https://github.com/oursprojects/nexushome/blob/main/app/src/main/java/com/capstone/nexushome/bluetooth/BluetoothService.kt): `app/src/main/java/com/capstone/nexushome/bluetooth/BluetoothService.kt`

### Smart-home device

- [Device firmware](https://github.com/oursprojects/nexushome/blob/main/firmware/NexusHomeCode.ino): `firmware/NexusHomeCode.ino`
- **NexusHome hardware**
- **VC-02 voice module**

### Command history

- [History screen](https://github.com/oursprojects/nexushome/blob/main/app/src/main/java/com/capstone/nexushome/CommandHistoryActivity.kt): `app/src/main/java/com/capstone/nexushome/CommandHistoryActivity.kt`
- [Log list adapter](https://github.com/oursprojects/nexushome/blob/main/app/src/main/java/com/capstone/nexushome/adapter/CommandLogAdapter.kt): `app/src/main/java/com/capstone/nexushome/adapter/CommandLogAdapter.kt`
- [Command log DAO](https://github.com/oursprojects/nexushome/blob/main/app/src/main/java/com/capstone/nexushome/data/CommandLogDao.kt): `app/src/main/java/com/capstone/nexushome/data/CommandLogDao.kt`
- [Command log record](https://github.com/oursprojects/nexushome/blob/main/app/src/main/java/com/capstone/nexushome/data/CommandLog.kt): `app/src/main/java/com/capstone/nexushome/data/CommandLog.kt`
- [Local Room database](https://github.com/oursprojects/nexushome/blob/main/app/src/main/java/com/capstone/nexushome/data/AppDatabase.kt): `app/src/main/java/com/capstone/nexushome/data/AppDatabase.kt`

### Other components

- **Home user**

## Connections

- Home user → Control dashboard: controls (evidence: `README.md`)
- Control dashboard → Main ViewModel: observes state (evidence: `app/src/main/java/com/capstone/nexushome/MainActivity.kt`)
- Control dashboard → Main ViewModel: sends commands (evidence: `app/src/main/java/com/capstone/nexushome/MainActivity.kt`)
- Main ViewModel → Bluetooth service: delegates control (evidence: `app/src/main/java/com/capstone/nexushome/MainViewModel.kt`)
- Bluetooth service → NexusHome hardware: Bluetooth control (evidence: `README.md`)
- NexusHome hardware → Bluetooth service: status updates (evidence: `README.md`)
- Device firmware → NexusHome hardware: runs on
- VC-02 voice module → NexusHome hardware: voice control (evidence: `README.md`)
- Control dashboard → Local Room database: records commands (evidence: `app/src/main/java/com/capstone/nexushome/MainActivity.kt`)
- History screen → Local Room database: opens database (evidence: `app/src/main/java/com/capstone/nexushome/CommandHistoryActivity.kt`)
- Local Room database → Command log DAO: provides DAO (evidence: `app/src/main/java/com/capstone/nexushome/data/AppDatabase.kt`)
- Command log DAO → Command log record: stores records (evidence: `app/src/main/java/com/capstone/nexushome/data/CommandLogDao.kt`)
- History screen → Command log DAO: observes and clears (evidence: `app/src/main/java/com/capstone/nexushome/CommandHistoryActivity.kt`)
- History screen → Log list adapter: renders entries (evidence: `app/src/main/java/com/capstone/nexushome/CommandHistoryActivity.kt`)
- Log list adapter → Command log record: displays fields (evidence: `app/src/main/java/com/capstone/nexushome/adapter/CommandLogAdapter.kt`)
