IoT: Fibaro Quick Apps — Extending the FIBARO System with Lua

FIBARO Quick Apps allow developers to extend the capabilities of the FIBARO Home Center 3 using object-oriented Lua. They enable custom device logic, integrations with external services, and bespoke automation behavior that goes beyond the standard FIBARO device set.

FIBARO is a leading smart home automation platform, and Quick Apps are its extensibility mechanism. When built-in FIBARO devices and scenes are not enough, Quick Apps allow developers to write custom logic in Lua — an object-oriented scripting language — to create new virtual devices, integrate with external APIs, or implement specialized automation behavior.


What Are Quick Apps?

Quick Apps are programmable virtual devices within the FIBARO Home Center 3 (HC3). They extend the FIBARO platform by allowing developers to:

  • Create custom virtual devices that behave like real hardware devices
  • Integrate with third-party services and APIs
  • Implement complex automation logic that standard scenes cannot express
  • Build custom user interfaces that appear in the FIBARO mobile app

The official documentation is available at: FIBARO Home Center 3 Quick Apps Manual


The QuickApp Class

Every Quick App is built around the QuickApp class — the central Lua class that represents the virtual device being created.

The QuickApp class:

  • Serves as the object-oriented foundation for all Quick App logic
  • Provides built-in methods for interacting with the FIBARO system (logging, device control, variable management)
  • Is instantiated automatically by the HC3 when the Quick App runs

Basic Structure

lua
function QuickApp:myMethod()
    self:debug("Hello from my method")
end

In this example:

  • QuickApp is the class being extended
  • myMethod is a custom method added to the class
  • self is the object instance — it provides access to the Quick App's built-in methods and properties
  • self:debug(...) calls the built-in debug logging method

The `self` Object

self is the object reference that can be used inside any Quick App class method. It provides access to:

  • Built-in methodsself:debug(), self:warning(), self:error() for logging
  • Device properties — reading and writing device state
  • System functions — interacting with the FIBARO system, other devices, and the automation engine

Quick App Lifecycle Methods

Quick Apps use predefined lifecycle methods that the HC3 calls at specific points:

lua
-- Called when the Quick App initializes
function QuickApp:onInit()
    self:debug("Quick App initialized")
    -- Set up timers, initial state, connections here
end

-- Called when the Quick App needs to update its state
function QuickApp:onUpdate()
    self:debug("Updating device state")
    -- Fetch data, update device properties here
end


Example: A Custom Temperature Device

Here is an example Quick App that simulates reading temperature from an external source and updating a virtual temperature sensor:

lua
-- Initialize the Quick App
function QuickApp:onInit()
    self:debug("Temperature Quick App starting")
    self:updateProperty("unit", "°C")
    self:scheduleRefresh()
end

-- Schedule periodic refresh
function QuickApp:scheduleRefresh()
    self:debug("Scheduling refresh in 60 seconds")
    setTimeout(function()
        self:refreshTemperature()
        self:scheduleRefresh()
    end, 60000)
end

-- Read temperature and update device
function QuickApp:refreshTemperature()
    local temperature = 22.5  -- In real use: fetch from sensor or API
    self:debug("Current temperature: " .. temperature)
    self:updateProperty("value", temperature)
end


Example: Interacting with Other FIBARO Devices

Quick Apps can control and read from other devices in the FIBARO system:

lua
-- Turn on a FIBARO switch (device ID 10)
function QuickApp:activateSwitch()
    fibaro.call(10, "turnOn")
    self:debug("Switch device 10 turned on")
end

-- Read value from another device
function QuickApp:readSensor()
    local value = fibaro.getValue(15, "value")
    self:debug("Sensor device 15 reports: " .. tostring(value))
end

-- Set a global variable
function QuickApp:setGlobalVar()
    fibaro.setGlobalVariable("MyVariable", "active")
end


Quick App UI Elements

Quick Apps can expose a custom user interface in the FIBARO mobile app. UI elements are defined in the Quick App structure and respond to user interaction:

lua
-- React to a button press from the Quick App UI
function QuickApp:onButtonPress(event)
    local buttonId = event.elementName
    self:debug("Button pressed: " .. buttonId)

    if buttonId == "startButton" then
        self:startProcess()
    elseif buttonId == "stopButton" then
        self:stopProcess()
    end
end

UI elements supported by Quick Apps include buttons, sliders, labels, and text fields — allowing developers to build fully interactive control panels within the FIBARO app.


Built-In Logging Methods

Quick Apps provide several logging levels that appear in the HC3 debug console:

lua
self:debug("This is a debug message")    -- Informational
self:warning("This is a warning")        -- Warning level
self:error("This is an error")           -- Error level
self:trace("Detailed trace information") -- Verbose debugging

These methods are essential for development and troubleshooting Quick App logic.


When to Use Quick Apps

Quick Apps are the right tool when:

  • You need to integrate with external REST APIs (weather services, energy providers, custom backends)
  • You want to create a custom virtual device that models a non-standard piece of hardware
  • Standard FIBARO scenes cannot express the required logic complexity
  • You need scheduled tasks that run independently of physical device events
  • You want to expose a custom UI to users in the FIBARO app

Summary

FIBARO Quick Apps provide a powerful extension mechanism for the Home Center 3 platform:

ConceptDescription
QuickApp ClassThe base class representing the virtual device
selfObject reference providing access to built-in methods
onInit()Lifecycle method called at startup
Built-in methodsdebug(), warning(), error(), updateProperty(), call()
fibaro APISystem API for controlling other devices and variables
UI elementsButtons, sliders, labels exposed in the FIBARO mobile app

For developers extending FIBARO beyond its standard capabilities, Quick Apps — powered by Lua's object-oriented model — provide a clean, scriptable approach to custom home automation logic.