Fibaro has never documented how custom icons work, and the forum
answers are mostly guessing. So we did what everyone else does — poked
around: fetched icon files from <hc3>/assets, uploaded test
sets, compared bytes, and read people's attempts on the forum, then
pieced the story together. Everything below about the controller was
observed that way against a 5.22x controller — treat it as "how it
works on 5.22x", not a contract. flua's own parts are documented and
tested.
GET /api/icons lists every icon the controller knows:
{"device": [
{"id": 300, "deviceType": "com.fibaro.binarySwitch",
"iconSetName": "ButtonSwitchV2", "fileExtension": "svg"},
{"id": 1109, "deviceType": "com.fibaro.binarySwitch",
"iconSetName": "User1109", "fileExtension": "png"}
]}
Two families: the built-in sets (named after their device family, like
ButtonSwitchV2) and custom sets — User<id>,
one per uploaded icon set, with the id assigned at upload time. The
deviceType says which kind of device the set was built for.
Each device type belongs to one of four providers that decide how many files a set has:
iconicon0 + icon100icon0 … icon100 in tens (11 files)iconOpening, iconOpened, iconClosing, iconClosed, iconUnknownPOST /api/icons, multipart form: type=device,
deviceTemplate=com.fibaro.binarySwitch, and one file part per
provider file (icon0, icon100, …). The images must be
reasonably large — 128×128 PNGs are accepted, a 32×32 was refused with
INVALID_ICON_SIZE. On success:
201 {"id":1109,"iconSetName":"User1109","fileExtension":"png"}
The HC3 ships standard QuickApp functions for exactly this:
QuickApp:uploadExternalIconSet(urls, options, success, error)
downloads the files from a list of URLs (say, a GitHub repo) and uploads
them, then sets deviceIcon to the new id itself —
QuickApp:externalIconsDownload is the recursive downloader
behind it.
This is the part nobody documents, and it explains most of the confusion:
/assets/icon/fibaro/<set>/<set><state>.<ext> —
the standard library tree. For custom User<id> sets this tree
serves the generic placeholder (the grey box with a question mark) under
every name — including the declared .png slot, which returns
an SVG body. A naive download of "the icon files" for a custom set gets
you grey boxes./assets/userIcons/devices/User<id>/User<id><state>.png —
the real uploaded artwork, served byte-identical to the upload. A
binary set's files live here as User11090.png and
User1109100.png. Names that don't exist — including the base
file for binary/multilevel sets, which have no base — return an HTML
error page.The device's deviceIcon property takes the icon id.
The HC3 UI then switches the image per the device's state: binary types
use value 0/100, multilevel types the nearest ladder step,
shutters the named state. That is why a binary icon set needs
two files.
The manual flow (web UI upload + set deviceIcon) works, but a
QA often wants to install its own set on first boot. The classic problem:
"is my set already uploaded?" — quickVars/internalStorage go stale on
reinstall and you end up with duplicate User sets.
The controller's icon library is the state you need:
api.get("/icons") → entries where deviceType == self.type
and iconSetName starts with User.net.HTTPClient from
http://127.0.0.1/assets/userIcons/devices/… — the plain
web server (port 80) serves the asset tree credential-free — and
byte-compare with the icons you bundle.updateProperty("deviceIcon", id).uploadExternalIconSet(urls, …) → new id.Because the HC3 serves uploaded bytes verbatim, the comparison is exact — and reinstall-proof.
flua ships the icon catalog and file manifest but not Fibaro's
copyrighted artwork. flua --tool icons download fetches the
images once into a machine-level cache (~/.flua/icons):
User sets from the userIcons tree — the real
artwork, not placeholders, including state files for binary/multilevel
sets,The run is incremental (--force refetches) and
--dump <www> copies from a local webroot dump with no network.
The web view looks ids up in /flua/iconMap (the checked-in
catalog, merged with your controller's live library when running
online) and fetches images from /flua/icons/…, switching state
files exactly like the HC3 UI.
To test an icon set before it exists on any controller, point a directive at a folder that uses the upload naming:
--%%name:myqa
--%%type:com.fibaro.binarySwitch
--%%icons:icons
-- --------------- EOH ---------------
function QuickApp:onInit()
self:updateProperty("value", false)
setTimeout(function() self:updateProperty("value", true) end, 1000)
end
icons/icon.png -- base icons/icon0.png -- off icons/icon100.png -- on
flua then sets the QA's deviceIcon to its own id (a fake
icon id; an explicit --%%property:deviceIcon wins), registers a
synthetic Local<qaId> set listing whatever the folder holds,
and serves the images from the folder. Run flua myqa.lua --ui,
flip value, and watch the web view switch the icons — offline, no
upload, no cache. (The folder may hold any subset; only present files are
listed.) The directive never travels into packed .fqa files: it
is a pure preview. A runnable example ships with flua
(examples/local-icons.lua, red/green/blue folder).
The whole flow: develop offline with --%%icons: → run
online and download the cache once → upload the set (web UI or
uploadExternalIconSet) → set the real User<id> id.
If anything here misbehaves on your firmware — or you have learned more about how the icon system really works — corrections are most welcome.