Skip to content

Consumer quickstart

This path is for developers building browser dashboards, scripts, custom cards, panel experiences, or agent-facing tools.

Install the browser client from npm:

Terminal window
npm install @varco/client

Inside this repository, @varco/client is also available as the packages/client workspace for development:

Terminal window
npm install
npm --workspace packages/client run build
import { createVarcoConsumerClient } from "@varco/client";
const client = createVarcoConsumerClient({
authorityId: "PASTE_AUTHORITY_ID_FROM_HOME_ASSISTANT",
bridgeUrl: "wss://varco-bridge.andreabaccega.com",
manifest: {
name: "My dashboard",
version: "0.1.0",
read_entities: ["sensor.temperature"],
subscriptions: ["sensor.temperature"],
history: [],
camera_snapshots: [],
actions: [],
},
});
const access = await client.requestAccess();
console.log(access.pairing_code);
// After the Home Assistant owner approves the request:
await client.connect();
const states = await client.getStates(["sensor.temperature"]);

Inside a Home Assistant custom card or panel, pass the frontend hass object:

import { createVarcoConsumerClient } from "@varco/client";
// Pass the HA frontend `hass` object — no relay, no pairing, no grant needed.
const client = createVarcoConsumerClient({ hass });
// requestAccess() and connect() are no-ops in local mode.
const states = await client.getStates(["sensor.temperature"]);

Local Home Assistant mode uses the already-authenticated frontend session. It does not pair through the relay and does not request a Varco grant. Calls go directly to the HA WebSocket API using the session credentials already present in the browser.