CommunityRedacción y edicióngithub.com

KoBa-beep/ClaudeCode-Skill

Escribe y depura escenas Lua para Fibaro Home Center 3 / Yubii Home (HC3, firmware 5.x): declaraciones (disparadores y condiciones — dispositivo, cron, amanecer/atardecer, variables globales, eventos personalizados, botones de escena central), código de acciones, sourceTrigger, variables de escena, opción de reinicio y la elección entre una escena y un QuickApp.

¿Qué es ClaudeCode-Skill?

Esta habilidad para agentes de IA (compatible con Claude Code, Cursor y Codex) permite crear y depurar escenas Lua para controladores domóticos Fibaro Home Center 3 / Yubii Home (firmware 5.x). Separa claramente las declaraciones (disparadores y condiciones en formato de tabla Lua) del código de acciones, siguiendo la arquitectura nativa del HC3. Incluye ejemplos detallados de condiciones avanzadas como eventos de botones de escena central, cron, amanecer/atardecer, variables globales y eventos personalizados. También explica cómo elegir entre una Escena y un QuickApp, cómo manejar la opción 'Permitir reiniciar una escena en ejecución', y resuelve problemas comunes como la falta de memoria entre ejecuciones, bucles accidentales, tipos de valores y diferencias en la numeración de días de la semana. La respuesta se adapta al nivel del usuario, explicando los pasos de clic para principiantes y proporcionando bloques de declaraciones y acciones listos para pegar, junto con los ID a reemplazar y un procedimiento de prueba. Es útil siempre que el usuario solicite una automatización, una regla del tipo 'cuando X entonces Y', convierta una escena de bloques a Lua, pregunte por qué una escena no se inicia o mencione escenas Fibaro.

Compatible con✓Claude Code~Codex CLI~Cursor
npx skills add https://github.com/KoBa-beep/ClaudeCode-Skill/tree/HEAD/fibaro-hc3/hc3-lua-scenes

Installed? Explore more Redacción y edición skills: steipete/notion, langchain-ai/langchain, bytedance/podcast-generation · View all 6 →

Preguntar en tu IA favorita

Abre un nuevo chat con esta habilidad de agente ya precargada.

Documentación

HC3 Lua scenes

Answer in the user's language; keep identifiers in English. Explain to beginners where to click.

Scene or QuickApp?

NeedSceneQuickApp
React to an event (button, door, time, variable) with a few actions✅heavier
Keep state in memory, run permanently, talk to a device (HTTP, TCP, MQTT)❌ starts from scratch each run✅
Buttons / labels in the UI❌✅
Rule of thumb: QuickApps are the drivers, scenes chain actions by calling QA methods
(fibaro.call(qaId, "setMode", "Away")). For QuickApps use the hc3-quickapp skill.

Two parts

  1. Declarations (conditions / triggers): a Lua table, not code — when the scene starts.
  2. Actions: Lua code executed at each start. Tip for users: build the scene in block mode, then "Convert to Lua": the HC3 writes exact declarations (property names, weekday numbers). Conversion is one-way.

Declarations

{
  operator = "all",               -- "all" (AND) | "any" (OR); groups can be nested
  conditions = {
    { type = "device", id = 201, property = "value", operator = "==", value = true, isTrigger = true },
    { type = "date", property = "cron", operator = "match", value = {"*", "*", "*", "*", "*", "*"}, isTrigger = false },
  }
}
  • isTrigger = true: a change of this condition starts the scene (then all conditions are evaluated); false: filter only. At least one trigger is needed or the scene never starts by itself.
  • Operators: ==, !=, >, >=, <, <=, anyValue (any change), match (dates).
  • duration = 60 in a device condition: must stay true 60 s [V] (visible in converted block scenes). Condition types and examples: references/declarations.md (device, central scene button, cron, sunrise/sunset, global variable, custom event, alarm, location, weather, HC3 start).

Actions

fibaro.debug("MyScene", json.encode(sourceTrigger))      -- first line while developing: see what started it
if sourceTrigger.type == "device" then                    -- .id, .property, .value
elseif sourceTrigger.type == "date" then
elseif sourceTrigger.type == "user" then                  -- started by hand (Run button, app)
end

Functions: fibaro.call, fibaro.getValue, fibaro.get (value + timestamp), fibaro.getGlobalVariable / setGlobalVariable (strings), fibaro.getSceneVariable / setSceneVariable (persist between runs of the same scene), fibaro.alert, fibaro.emitCustomEvent, fibaro.scene("execute"|"kill", {ids}), fibaro.profile, fibaro.alarm, fibaro.setTimeout(ms, fn), api.*, net.HTTPClient, json. Logs need a tag: fibaro.debug("Tag", "msg"). Notifications: same rules as QuickApps (users vs phone IDs, no critical push) — see the hc3-quickapp skill, references/notifications.md.

Traps (read before answering "my scene does not work")

  1. No memory between runs → scene variables or global variables.
  2. "Allow restarting a running scene" option: Yes = a new trigger kills the running instance (pending setTimeout lost) and starts again — right for "light off 5 min after the last motion"; No = triggers are ignored while it runs (including while a setTimeout waits).
  3. Manual mode ignores declarations.
  4. Triggers fire on changes only: same value again → nothing.
  5. Value types: switch true/false, dimmer / shutter 0–99, sensor number; global variables are always strings (== "1", not == 1); in declarations write value = true without quotes.
  6. A scene that changes its own trigger device can loop: filter with sourceTrigger.
  7. Only device properties trigger scenes; a QuickApp's internal variable does not (a global variable does, and QA property updates like value do).
  8. Avoid while true / long fibaro.sleep: use triggers, setTimeout, or a QuickApp.
  9. Weekday numbering in cron and some property names vary: check a converted block scene [V].

Deliverable

Declarations block + actions block (separately, ready to paste), the scene options to set (restart yes/no, automatic mode, room), the IDs to replace (ID_DOOR_SENSOR…) or real IDs from the user's inventory, and a test procedure ("open the door, the console of the scene shows …"). Worked examples: references/examples.md.

Individual skills in this repo

This repo contains 2 individual skills — each has its own dedicated page.

Skills relacionados