How thailearncoding/smarthousebot works
SmartHouseBot is a local-first smart-home dashboard and Vietnamese voice assistant. Users issue device commands or voice/text requests; the backend transcribes audio, resolves and validates intent, performs device or sensor work, then generates and streams a response with optional speech audio. The UI also exposes device status, telemetry history, health, and audit logs. The README documents the major product stages and interfaces; several backend router, voice-pipeline, and telemetry details are unsampled, so those links follow documented behavior and the repository layout.
Main entry points: voice_service.py Voice orchestration · coreiot_service.py Device and telemetry service · main.py FastAPI app · repository.py Storage repository
Components 28
Dashboard UI
- App routes
frontend/src/App.jsx - Dashboard state
frontend/src/store/useDashboardStore.js - Dashboard API
frontend/src/services/dashboardApi.js - Voice state
frontend/src/store/useVoiceAssistantStore.js - Voice API
frontend/src/services/voiceApi.js
Voice Assistant
- Voice endpoints
backend/app/routers/voice.py - Voice controller
backend/app/controllers/voice_controller.py - Voice orchestration
backend/app/services/voice_service.py - Speech recognition
backend/app/services/whisper_service.py - Intent parsing
backend/app/services/intent_service.py - LLM generation
backend/app/services/llm_service.py - Speech synthesis
backend/app/services/tts_service.py
Devices and Telemetry
- FastAPI app
backend/app/main.py - Device endpoints
backend/app/routers/devices.py - Device controller
backend/app/controllers/device_controller.py - Device and telemetry service
backend/app/services/coreiot_service.py - CoreIoT client
backend/app/clients/coreiot_client.py - Telemetry endpoints
backend/app/routers/telemetry.py - Telemetry sampler
backend/app/services/telemetry_sampler.py
Audit and Storage
- Audit endpoints
backend/app/routers/audit.py - Audit controller
backend/app/controllers/audit_controller.py - Storage repository
backend/app/db/repository.py - SQLite database
backend/app/db/database.py
Other components
- Home user
- Ollama LLM
- PhoWhisper
- Piper TTS
- CoreIoT platform
Connections 31
- Home user → App routes: uses
- App routes → Voice state: opens voice
- App routes → Dashboard state: opens dashboard
- Voice state → Voice API: transcribes audio
- Voice state → Voice endpoints: streams text
- Dashboard state → Dashboard API: requests data
- FastAPI app → Voice endpoints: mounts routes
- FastAPI app → Device endpoints: mounts routes
- FastAPI app → Telemetry endpoints: mounts routes
- FastAPI app → Audit endpoints: mounts routes
- Voice endpoints → Voice controller: dispatches
- Voice controller → Voice orchestration: processes turn
- Voice orchestration → Speech recognition: transcribes audio
- Voice orchestration → Intent parsing: resolves intent
- Voice orchestration → LLM generation: generates response
- Voice orchestration → Speech synthesis: synthesizes speech
- Speech recognition → PhoWhisper: transcribes with
- LLM generation → Ollama LLM: requests generation
- Speech synthesis → Piper TTS: synthesizes with
- Voice orchestration → Device controller: executes device intent
- Voice orchestration → Storage repository: records interaction
- Device endpoints → Device controller: dispatches
- Device controller → Device and telemetry service: controls device
- Telemetry endpoints → Device and telemetry service: requests readings
- Telemetry sampler → Device and telemetry service: collects snapshots
- Device and telemetry service → CoreIoT client: fetches or commands
- CoreIoT client → CoreIoT platform: RPC and telemetry
- Device and telemetry service → Storage repository: persists snapshots
- Audit endpoints → Audit controller: dispatches
- Audit controller → Storage repository: reads audit logs
- Storage repository → SQLite database: reads and writes