Smart Home Controller is a deterministic Objective-C command-line simulator for a smart home hub. It models lights, thermostats, and security cameras, exposes a CLI for controlling them, persists state to disk, and includes a scene system for automating multi-device changes.
This repository also includes the original iOS storyboard assets, but the runnable artifact in this environment is the CLI simulator built from Objective-C source. The README documents exactly how to build, run, and verify that simulator.
- Control Smart Lights: Turn lights on/off, change brightness.
- Adjust Thermostat Settings: Set temperature targets with unit-aware clamping.
- View Security Cameras: Toggle streaming and take snapshots.
- Central Dashboard: Aggregated status summary.
- Scenes: Apply multi-device presets (e.g., “evening” or “away”).
- Deterministic State: State file persists between runs.
clangwith C99 support (available on macOS and most Linux environments)make
Sources/— Objective-C (C99) implementation for the CLI.config/— Default device and scene configuration.data/— Runtime state storage.scripts/— Run/test/verify entrypoints.tests/— Unit tests and fixtures.docs/— Architecture and usage references.
Each line defines a device:
<type>,<id>,<name>,<location>,<key=value,...>
Examples:
light,light-living,Living Room Lamp,Living Room,brightness=75
thermostat,thermo-main,Main Thermostat,Hallway,current=21.0,target=22.0,units=C
camera,cam-front,Front Door Camera,Front Door,streaming=on
Scenes are defined in blocks:
scene,<name>,<summary>
<device_type>,<device_id>,<attributes>
end
Example:
scene,evening,Relaxing evening setup
light,light-living,power=on,brightness=40
thermostat,thermo-main,target=21.5
camera,cam-front,streaming=on
end
SHC_CONFIG— overrides the device config path (defaultconfig/devices.conf).SHC_SCENES— overrides the scene config path (defaultconfig/scenes.conf).SHC_STATE— overrides the state file path (defaultdata/state.db).SHC_LOG_LEVEL—debug,info,warn, orerror.
A sample .env.example is provided.
All commands are run via the smart_home_controller binary (built automatically by the scripts):
./bin/smart_home_controller status [--config path] [--state path] [--json]
./bin/smart_home_controller dashboard [--config path] [--state path]
./bin/smart_home_controller scene list [--scenes path]
./bin/smart_home_controller scene show <name> [--scenes path]
./bin/smart_home_controller scene run <name> [--scenes path] [--state path]
./bin/smart_home_controller light on <id> [--config path] [--state path]
./bin/smart_home_controller light off <id> [--config path] [--state path]
./bin/smart_home_controller light brightness <id> <0-100> [--config path] [--state path]
./bin/smart_home_controller thermostat set <id> <temp> [--config path] [--state path]
./bin/smart_home_controller camera stream <id> <on|off> [--config path] [--state path]
./bin/smart_home_controller camera snapshot <id> [--config path] [--state path]
These commands were executed successfully in the workspace:
./scripts/run.sh status
./scripts/run.sh dashboard
./scripts/run.sh light on light-living
./scripts/run.sh thermostat set thermo-main 23.0
./scripts/run.sh scene run eveningThis command runs unit tests and smoke/integration checks:
./scripts/verify.sh- Missing config files: Ensure
config/devices.confandconfig/scenes.confexist or setSHC_CONFIG/SHC_SCENES. - State not persisting: Check permissions for
data/state.dbor setSHC_STATE. - Build errors: Confirm
clangandmakeare installed and that you can compile C99 code.