Rooms, lights, shutters and thermostats, modelled cleanly.
A small management panel for the smart devices in a home: create rooms, register devices by IP address and control them one by one or all together.
The problem
Smart-home devices are different (a light has brightness, a thermostat has a temperature, a shutter has a position) but must be managed the same way. The challenge was designing a model that stays simple while new device types are added.
What I built
A TypeScript domain model with a base Device class (state, IP address, on/off) and specialised Light, Thermostat and Shutter subclasses. Rooms aggregate devices and the HomeSystem aggregates rooms, so turning off a room or the whole house is one method call. A browser UI drives the model.
Technical highlights
Inheritance and encapsulation: private state exposed through typed getters and setters.
Domain rules live in the model (e.g. the thermostat only accepts 15–25 °C).
Bulk operations cascade from house → rooms → devices.
Strict TypeScript compiled to ES modules, no framework.