All Insights
#SundayCoffeeAndCode
September 2026

Sunday Coffee & Code: the porch light Agent that knows I'm coming home

This weekendโ€™s project continued with the simple idea - as I get close to home, switch on the porch light - but let an AI agent ๐˜ฅ๐˜ฆ๐˜ค๐˜ช๐˜ฅ๐˜ฆ ๐˜ฉ๐˜ฐ๐˜ธ ๐˜ฃ๐˜ณ๐˜ช๐˜จ๐˜ฉ๐˜ต ๐˜ข๐˜ฏ๐˜ฅ ๐˜ฉ๐˜ฐ๐˜ธ ๐˜ธ๐˜ข๐˜ณ๐˜ฎ based on the time, darkness and weather.

By Steve Harris

๐—ฆ๐˜‚๐—ป๐—ฑ๐—ฎ๐˜† ๐—–๐—ผ๐—ณ๐—ณ๐—ฒ๐—ฒ & ๐—–๐—ผ๐—ฑ๐—ฒ: ๐˜๐—ต๐—ฒ ๐—ฝ๐—ผ๐—ฟ๐—ฐ๐—ต ๐—น๐—ถ๐—ด๐—ต๐˜ ๐—”๐—ด๐—ฒ๐—ป๐˜ ๐˜๐—ต๐—ฎ๐˜ ๐—ธ๐—ป๐—ผ๐˜„๐˜€ ๐—œโ€™๐—บ ๐—ฐ๐—ผ๐—บ๐—ถ๐—ป๐—ด ๐—ต๐—ผ๐—บ๐—ฒ

This weekendโ€™s project continued with the simple idea - as I get close to home, switch on the porch light - but let an AI agent ๐˜ฅ๐˜ฆ๐˜ค๐˜ช๐˜ฅ๐˜ฆ ๐˜ฉ๐˜ฐ๐˜ธ ๐˜ฃ๐˜ณ๐˜ช๐˜จ๐˜ฉ๐˜ต ๐˜ข๐˜ฏ๐˜ฅ ๐˜ฉ๐˜ฐ๐˜ธ ๐˜ธ๐˜ข๐˜ณ๐˜ฎ based on the time, darkness and weather.

The result is a small experiment in what agentic systems look like when they have control over something in the physical world.

๐—ง๐—ต๐—ฒ ๐—ฝ๐—ถ๐—ฒ๐—ฐ๐—ฒ๐˜€

  • A WiZ smart bulb, wrapped in a small MCP server so an agent can call tools such as turn_on and get_light_state.
  • OwnTracks on my phone, publishing locations over MQTT
  • Mosquitto running in WSL on my PC.
  • Tailscale, allowing the phone to reach the broker from anywhere.
  • An OpenWeather API key
  • An Agent built with Microsoft Agent Framework. It has tools for sun position and weather, plus a plain-English policy on light bulb settings.
  • GoogleGemini 2.5 Flash via OpenRouter - fast, inexpensive for an occasional arrival event.

๐—ง๐—ต๐—ฒ ๐—ฑ๐—ฒ๐˜€๐—ถ๐—ด๐—ป ๐—ฟ๐˜‚๐—น๐—ฒ: ๐—ธ๐—ฒ๐—ฒ๐—ฝ ๐˜๐—ต๐—ฒ ๐—Ÿ๐—Ÿ๐—  ๐—ผ๐—ป ๐—ฎ ๐˜€๐—ต๐—ผ๐—ฟ๐˜ ๐—น๐—ฒ๐—ฎ๐˜€๐—ต

  • Anything that must never go wrong is handled by deterministic code, not the model.
  • Distance and arrival detection fires once per arrival.
  • The agent has a hard 30-second timeout. If the model or weather API fails, deterministic fallback logic turns the light on at 80% after dusk.
  • And after the command is sent, the system reads the bulb state back and verifies what actually happened.
  • ๐—ง๐—ต๐—ฒ ๐—ฎ๐—ด๐—ฒ๐—ป๐˜ ๐—ฐ๐—ต๐—ผ๐—ผ๐˜€๐—ฒ๐˜€. ๐—ง๐—ต๐—ฒ ๐—ฐ๐—ผ๐—ฑ๐—ฒ ๐—ด๐˜‚๐—ฎ๐—ฟ๐—ฎ๐—ป๐˜๐—ฒ๐—ฒ๐˜€ (๐™—๐™ช๐™œ๐™จ ๐™–๐™จ๐™ž๐™™๐™š) which feels increasingly important when AI starts controlling things outside a chat window.

And on the first real test, I drove more than a kilometre away and came home again, it was a bright, sunny afternoon (๐˜ต๐˜ฉ๐˜ช๐˜ด ๐˜ช๐˜ด ๐˜๐˜ช๐˜ค๐˜ต๐˜ฐ๐˜ณ๐˜ช๐˜ข ๐˜ข๐˜ง๐˜ต๐˜ฆ๐˜ณ ๐˜ข๐˜ญ๐˜ญ). The agent looked at the conditions, decided the porch light wasnโ€™t needed, switched it off, and wrote a one-line explanation to the log - made me grin.

๐—ง๐—ต๐—ฒ ๐—น๐—ฒ๐˜€๐˜€๐—ผ๐—ป ๐—œ ๐—ฑ๐—ถ๐—ฑ๐—ปโ€™๐˜ ๐—ฒ๐˜…๐—ฝ๐—ฒ๐—ฐ๐˜ - while writing the documentation, my actual home coordinates ended up in a sample log line in a public GitHub repository. So I had to build a new public repo with a clean history and a much more careful scan for information. A useful reminder:

Code and a step-by-step build guide covering WSL, Tailscale, Mosquitto, OwnTracks, MCP and the agent: GitHub Repo

Iโ€™m done for the day - time to grab another coffee - remember: Think-Model-Act. โ˜•

Want to Discuss This Topic?

Steve is always happy to have a direct conversation.