Status: v1 implemented (2026-11-08) — flua --tool house, the completions
provider in the VS Code extension (vscode/src/completions.ts), the
flua.house.refresh/flua.house.generateHomeTable commands, and the
flua.houseDb/flua.houseRefresh settings. Stretch items (live refresh
against a running emulator, room filters, ht.lua regeneration) remain.
Magic numbers are the biggest friction in fibaro.* calls: fibaro.call(45,
"turnOn") says nothing about what device 45 is. A developer in the HC3
web editor can look up the ID, but in VS Code the number is just a
number. This note designs completions that carry the data — device IDs
with names and rooms, global variable names, scene IDs, custom event
names, and a HT.kitchen.light home table — through the existing flua
VS Code extension. One edge worth claiming: the data can also come from
the simulated house (db/seed file), so completions work fully
offline — or for a house that does not exist yet.
vscode/src/): extension.ts registers commands only;
flua.ts provides execFlua() — every feature shells out to the flua
CLI. No HTTP client, no credential handling in the extension: the CLI
owns the .env chain.hc3.py client — /devices,
/globalVariables, /scenes, /customEvents./devices, /globalVariables, /scenes,
/customEvents (src/flua/api/routes/); --tool state already
loads sim state from a seed/db file.--tool setup installs LuaLS + types; a generated, typed
Lua module in the workspace gets completions for free.flua --tool house --json prints a stable shape:
{
"devices": [{"id": 45, "name": "Kitchen light", "room": "Kitchen", "type": "com.fibaro.binarySwitch"}],
"globals": ["AlarmState", "Presence"],
"scenes": [{"id": 3, "name": "Evening lights"}],
"customEvents": ["DoorOpened"]
}
Resolution order:
.env chain) → fetch from the hub
(online mode, the same path downloadQA/uploadQA use).flua.houseDb extension setting, or the
workspace's .flua-directives --%%db:) → load the sim state, the
same logic as --tool state.The tool is the single choke point: the provider never talks to a hub or the sim directly, so credential handling and offline behavior stay in one place (and agents/CI get the same JSON for free).
One new file vscode/src/completions.ts:
languages.registerCompletionItemProvider("lua", provider, '"', "'", ".", " ", "0".."9")fibaro.call( / fibaro.getValue( /
fibaro.setValue( → device items: insertText = id,
label = "45 — Kitchen light", detail = room, filterText includes
the name so typing kitchen finds it.fibaro.getGlobalVariable(" / fibaro.setGlobalVariable(" →
global names.fibaro.scene("execute", <id>) → scene IDs with names.fibaro.emitCustomEvent(" → custom event names.HT.*: no provider needed — a flua.generateHomeTable command
writes a ---@class-annotated ht.lua into the workspace (rooms →
names → ids, plus the HT = json.decode(fibaro.getGlobalVariable(...))
loader snippet). Plain LuaLS then completes
HT.kitchen.light, and the table travels in the QA like any file.flua.refreshHouse command and on
extension activation; setting flua.houseRefresh (onSave | manual).
Data never leaves the machine.--ui/helper port, REST
query) so the list tracks the run.ht.lua when the house changes (save-time diff).fibaro.call without a native VS Code provider; works in any LuaLS
host. More moving parts (addon shipping/loading, per-workspace
install), no access to flua settings/commands — and the extension's
whole architecture is already execFlua + native providers.local DEV = {...} or HT alone):
completions only for names the user already knows to reference; no
context awareness in calls. HT covers the readability goal, the
provider covers discoverability — v1 does both but keeps them separate.flua --tool house --json (hub or db/seed) with a pinning test for
the JSON shape.vscode/src/completions.ts — the four contexts above.flua.generateHomeTable + flua.refreshHouse commands, the
flua.houseDb/flua.houseRefresh settings.--tool house) and the extension README.src/flua/tools/state_tool.py — the seed/db loading logic to reusevscode/src/flua.ts — the execFlua bridge the provider ridesdocs/notes/notes-mcp.md — same design-draft style