Home & car

Home Assistant

Every home is set up differently, so we highly recommend having an agent build your Home Assistant pages: it can read your entities and lay out the rooms and devices you actually have. This starter is the place to begin. It lists the lights that are on, reads your instance once a minute, and needs only your address and a token: no entity IDs, switches or changes to your dashboards.

Install in LegatoSet it up by hand ↓

Home Assistant
Lights on
  • Kitchen
  • Hallway
  • Porch
Updated 12 min ago

What you’ll see

  • Lights on: the name of each light that’s on.

How it connects

The page sends one Jinja template to Home Assistant’s REST API template endpoint for the lights that are on.

Requests it makes on its own 1

  • POST/api/template

    lights, a list of names whose light state is on.

    Once a minute

Legato sends the saved token in the Authorization header as a Bearer token. The page makes no /api/services/… calls. Its use of POST evaluates the template; it does not turn anything on or off. The token still grants the access of its Home Assistant user, so keep it private even though this page only reads. Sources and buttons describes the supported authentication methods.

Your Mac needs a route to the instance: the same local network, a VPN or an existing remote-access address. Fetches stop while the Mac sleeps or Legato is closed.

Set it up

  1. Install Legato and connect your local agent, or use the bundled legato command. See Quickstart.
  2. Create a long-lived access token in your Home Assistant user profile. Never paste the token into an agent chat.
  3. Download the page. If your Home Assistant isn’t at http://homeassistant.local:8123, change the source’s url to its address, keeping /api/template.
  4. Add it using the agent prompt, or run /Applications/Legato.app/Contents/Helpers/legato set home-assistant-starter home-assistant-starter.json with an unused page ID. Don’t replace an existing page without reading it first.
  5. In Settings → Secrets, save the token under home-assistant, bound to the service’s host. You can also link a 1Password reference.
  6. Open the page and check its source status. Missing credentials or an unreachable address need fixing before the list can fill.

For a local HTTP address, requests and credentials are unencrypted in transit. Use it only on a trusted network; prefer HTTPS when configured. Don’t expose a local service to the internet just to use this page.

Prompt for your agent

prompt
Add a Legato page for Home Assistant, starting from https://legatobar.com/examples/home-assistant-starter.json.

Change the source’s url to my Home Assistant’s address, keeping /api/template. I’ll save the token as home-assistant in Settings → Secrets myself.

Use the local Legato MCP tools or /Applications/Legato.app/Contents/Helpers/legato.
Use list_pages first and choose an unused page ID. Do not overwrite an existing page. If I explicitly ask to update one, read its full body with get_page, preserve unrelated cards and settings, and use if_match with that version. On version_mismatch, read again before merging.
Ask me only for non-secret setup details that are missing. Never ask me to paste a password, token or API key into chat, page JSON or command arguments. Tell me to save it in Settings → Secrets for the service host, or link it from 1Password there.
Use the downloadable page, not the illustration’s sample data. Never invent readings. Fix any invalid_page paths and verify that the page loads. Do not press buttons that change the service or real devices to test it.

Download the page

Download home-assistant-starter.json

Show the page’s JSON 32 lines
json
{
  "$schema": "https://legatobar.com/schemas/page.schema.json",
  "title": "Home Assistant",
  "icon": "house",
  "sources": {
    "home": {
      "url": "http://homeassistant.local:8123/api/template",
      "secret": "home-assistant",
      "every": "1m",
      "method": "POST",
      "body": {
        "template": "{{ {\"lights\": states.light | selectattr(\"state\", \"eq\", \"on\") | map(attribute=\"name\") | list} | tojson }}"
      }
    }
  },
  "cards": [
    {
      "id": "lights",
      "type": "list",
      "label": "Lights on",
      "source": {
        "ref": "home",
        "map": {
          "items": {
            "each": "lights",
            "template": "{$}"
          }
        }
      }
    }
  ]
}

Questions

Does an empty Lights on list mean every light is off?

It means no light entity was reported as on. Unavailable and unknown lights are left out, as are lights represented only as switch entities. Light groups can also appear alongside their members. This starter is a list of reported activity, not an availability check or an exact fixture count.

Do I need Home Assistant Cloud?

No, if the Mac can reach Home Assistant directly. Away from home, use your existing remote-access arrangement. There is no need to expose the instance to the internet just for this page.

Why does the source fail before the list fills?

Check the address, including /api/template, and the saved secret’s host binding. A rejected token needs replacing in Settings → Secrets. A template error usually points to an edit in the JSON body; try the same template in Home Assistant’s Developer tools → Template.

On 31 October 2026, the starter’s unchanged template was evaluated against a real Home Assistant instance. It returned a list of light names. The returned data was also checked through Legato’s page renderer. This verifies the template and card mappings, not setup through the installed app or its saved token. No devices were controlled. Illustrations use made-up readings. See the service index for other examples.

Legato is independent and isn’t affiliated with or endorsed by Home Assistant.