The uiView format — a field guide for QuickApps

When you design a QuickApp UI in the HC3's visual editor, there is a button that exports the view as a uiView JSON structure — the modern, second way to describe a QuickApp interface, next to the legacy $jason viewLayout. The exported struct is meant to be pasted into createChildDevice's initialProperties.uiView, and it is clearly a format Fibaro plans to keep: the editor itself writes it, and it must stay backward compatible.

What Fibaro has not published is documentation of the format. This post is our reverse-engineered field guide — everything below comes from black-box observation of firmware 5.221, our own controllers, and reading the app's behavior. Treat it as our best guess. If you know better, correct us in a comment and we'll update the post (and flua).

The shape

A uiView is a list of rows. Each row is a container ("type": "horizontal" or "vertical") holding a components list. Every component carries at least a name, a type, and a style object:

[
  { "type": "horizontal", "style": {"weight": "1.0"}, "components": [
    { "name": "lbl", "type": "label", "text": "Hello", "visible": true,
      "style": {"weight": "1.0", "textAlign": "left"}, "classes": [] },
    { "name": "btn", "type": "button", "text": "Go", "visible": true,
      "style": {"weight": "0.5", "color": ""}, "classes": [],
      "eventBinding": { "onReleased": [
        { "type": "deviceAction", "params": { "actionName": "press", "args": [] } } ] } }
  ]}
]

Names must be unique — events route by element name, and duplicates collide. visible is a boolean. Unknown fields are simply ignored by the app.

Weights and containers

style.weight (a string, like "1.0" or "7") is the element's share of its container: inside a horizontal row it shares the width among siblings; inside a vertical container it shares the height. The catch we verified the hard way: the split only happens in fixed-height layouts. A QA's UI is auto-height, so a lone element's weight changes nothing — that's why weight=7 on an image did not make it taller on the controller. Weight never changes text size either.

style: color and textAlign

classes

An element's classes array reaches the rendered component, and the app also switches behavior on specific names. The ones we have found and tested:

The divider (a space with borderTop)

The grey horizontal separator line: a component of type: "space" with classes: ["borderTop"]. The app draws its .spacer-line for exactly that. It is a v2 feature — with useUiView: false the legacy renderer draws nothing, unique names or not (verified).

The image element and its update quirk

An image is {"name", "type": "image", "url", "useProxy"}. useProxy: true routes the URL through the controller's plugin proxy — needed for plugin-relative paths and remote camera access, pointless for a public https:// URL. The element renders max-width:100%; height:auto: natural aspect, capped by the container width. To make a picture taller, use a portrait source.

The quirk: to change the picture at runtime you must self:updateView(elm, "source", url) — "source" is the image element's legacy update property, which the HC3 remaps to the url. "url" does nothing. And updateView never touches the declared struct: the device's uiView keeps the old url, the update lives in live render state. You can see that state yourself: GET /plugins/getView?id=<id> returns the rendered view with updates merged (and the app's own defaults filled in), while /devices/<id> only shows the declared uiView. Declared vs rendered — two layers, one UI.

eventBinding — how events reach your methods

The v2 format binds events on the element itself instead of the separate uiCallbacks table:

"eventBinding": { "onReleased": [
  { "type": "deviceAction", "params": { "actionName": "press", "args": [] } }
] }

For a child device the actionName is your Child class method and args is a JSON array — argless calls must use a real array (json.array() in Lua); a plain {} encodes as an object and the app silently drops the action. For a main QA the binding is "type": "UIAction" and the good old uiCallbacks table still does the routing. See our earlier post The button that did nothing for the full model.

The modern widgets

Spelling it in flua

flua compiles the same format from your QA file, so everything above is one directive away:

--%%u:{label="lbl",text="Hello",textAlign="center"}
--%%u:{{button="a",text="A",onReleased="go",color="#2e9e5b"},{button="b",text="B",onReleased="go"}}
--%%u:{space="div1",classes={"borderTop"}}
--%%rsrc:childUI:{image="art",url="https://host/art.png",classes={"imageL"}}

The visual uibuilder (post 37) can build all of this in the browser and exports the directives. flua's own viewer mirrors the format — with the same declared-vs-live split, so your QAs behave alike in the sim and on the controller.

Our best guess, as always — corrections and additions welcome in the comments · related posts: Design your QuickApp UI in the browser, Child UIs as resources, The button that did nothing · flua: https://github.com/jangabrielsson/flua