Month 6 Box - Build TARS

TARS at Home: Smart-Home Control

TARS at Home: Smart-Home Control

TARS becomes genuinely useful the moment it can act on your home. In this lesson you connect TARS to the Home Assistant smart home you built in Month 4, so you can ask it out loud to turn on a light, run a scene, or tell you how warm it is, and it makes it happen. This is not new plumbing, it is the exact Home Assistant integration from Month 4, a long-lived access token, entity IDs, and API calls, now driven by TARS's voice instead of a camera trigger or a rule.

The same integration, a new trigger

You already taught a program to control Home Assistant in Month 4: you created a long-lived access token, found each device's entity ID, and sent an API call to turn things on, off, or activate a scene. TARS uses that identical approach, and the only thing that changes is who pulls the trigger. Instead of a camera detection deciding to act, TARS's understanding of your spoken request decides which service to call on which device. The wiring is familiar; the interface is now a conversation.

From speech to intent to action

When you ask TARS to turn on the living room light, several pieces you already own chain together. Speech-to-text transcribes your words, TARS works out what you meant, the intent, and maps it to a Home Assistant service call on the right entity. That mapping can be as simple as matching keywords to devices, the command-matching idea from Month 3, or as flexible as letting the language model choose the action. Either way, a sentence becomes a specific, safe command:

import requests

HA_URL = "http://homeassistant.local:8123"
TOKEN = "YOUR_LONG_LIVED_TOKEN"     # from Home Assistant, kept private
HEADERS = {"Authorization": f"Bearer {TOKEN}"}

def ha(domain, service, entity_id):
    requests.post(f"{HA_URL}/api/services/{domain}/{service}",
                  headers=HEADERS, json={"entity_id": entity_id})

def handle(command):
    c = command.lower()
    if "light" in c and "on" in c:
        ha("light", "turn_on", "light.living_room")
        speak("Turning on the living room light.")
    elif "movie" in c:
        ha("scene", "turn_on", "scene.movie_mode")
        speak("Movie mode activated.")

handle(speech_to_text(listen()))   # transcription -> intent -> action

That is the Month 4 Home Assistant call, now spoken to: transcribe the request, match it to a service call on the right entity, act, and speak a confirmation.

Voice-driven scenes and reports, kept safe

Because Home Assistant already has scenes and sensors, TARS can do more than flip one light. Ask for movie mode and it activates the scene that dims the lights and starts a fan; ask how warm it is and it reads the temperature sensor and speaks the answer, closing the loop between your home and TARS's voice. Since this runs on your own network it stays private, just like your Month 4 setup. Keep the access token secret as you would any key, and consider limiting which devices TARS can control and confirming important actions, so a misheard request can never do something drastic. That restraint is what makes a voice-controlled home a pleasure rather than a hazard.

Home Assistant is yours; the TARS-AI community can help integrate it

The smart home you are connecting is the one you built in Month 4, and Home Assistant's own documentation covers tokens and entities. The TARS-AI Community is a great place to see how others have wired TARS into their homes and to share your own integrations:

TARS-AI docs: docs-tars-ai.vercel.app · Discord: discord.gg/AmE2Gv9EUt

With this, TARS stops being a clever toy and becomes a genuine part of your home: something that can both operate it and answer questions about it, all with the skills you already earned in Month 4.