Context-Aware Smart Home System with Vision-Language Models
Most smart rooms are not very smart. A motion sensor knows that something moved, but it cannot tell the difference between someone studying at a desk and someone asleep in bed, so the lights do the wrong thing at the wrong moment and the person ends up fighting the automation. I wanted to see whether a camera that understands what a person is doing, and where, could fix that.
This was my CSE468 course project at North South University in Spring 2026. An overhead camera watches the room, and a zero-shot vision-language model (Gemini 2.5 Flash) looks at a frame and answers in one inference pass: is anyone there, what are they doing, which intent does that suggest (focused work, relaxing, sleeping, or an empty room), where are they in the frame, and are they making a hand gesture. I forced the output into strict JSON using the API’s own JSON mode, because a chatty model that wraps its answer in Markdown will crash a parser, and I wanted something closer to a programmable controller than a chatbot.
Calling a cloud model on every frame would be slow and wasteful, so the camera side runs OpenCV’s MOG2 background subtraction and only wakes the model when something in the scene changes. The result goes to a Node.js engine that decides what to do. Explicit gestures always win: an open palm turns something on and a V-sign turns it off, regardless of what the room context says. If there is no gesture, the engine checks which zone the person is in and what they seem to be doing, and picks a device profile, such as dimming the lights for relaxation. Commands travel over MQTT to ESP8266 boards driving relays that switch real 220 V loads, and a live web dashboard shows the model’s output and the device states.

What the measurements taught me
Two decisions came straight from timing things. I first tried local vision models, LLaVA and Moondream through Ollama. Removing the network did not help, because on the hardware I had they took many seconds per frame and described the scene worse than Gemini did, so perception stayed in the cloud. Actuation was the opposite case. With a public cloud MQTT broker, switching a relay lagged by about a second. Running a Mosquitto broker on the local network brought that to under 10 ms, which is the difference between a light that responds and a light that seems to think about it. So the heavy reasoning lives in the cloud, and what has to feel instant stays on the LAN.
The honest limitation is that my gesture evaluation was small: 20 trials in a proof-of-concept test. The misses clustered where the hand was blurred by sudden movement, and a sample that size does not tell me how the system would behave across different rooms, lighting or people. Cloud perception also takes a few seconds per decision, so this suits ambient comfort better than anything that has to react at once. Dedicated neural hardware in a local hub would be the natural next step.
What I took away is less about any single model and more about placement: decide what has to be fast, keep that close to the devices, and let the slower, smarter part live wherever it runs best.