Back to Flic Hub Studio

Flic Hub Studio
Matter Guide

Introduction

The Flic Hub LR is equipped with a powerful, fully integrated Matter controller, opening up a world of possibilities for smart home automation. With Flic Script and Flic Studio, you can easily create fully customizable Matter-based solutions tailored to your unique needs. Whether you’re looking to streamline your routines, enhance your home’s connectivity, or develop advanced smart environments, the Flic Hub LR gives you unparalleled flexibility and control—all with an intuitive and seamless user experience. Unlock the true potential of Matter with Flic, and bring your smart home vision to life.

Send Commands

Sending commands to a Matter device is done with the sendCommand function. Here are a few examples on how to send commands to a Matter light:
const matter = require("matter");
// Toggle  light
matter.sendCommand(nodeId, 1, "On/Off", "Toggle", {}, (error, response) => console.log(JSON.stringify(error) + ", " + JSON.stringify(response))); 

// Setting brightness:
matter.sendCommand(nodeId, 1, "Level Control", "MoveToLevel", {"Level": 110, "TransitionTime": 0, "OptionsMask": 1, "OptionsOverride": 1}, (error, response) => console.log(JSON.stringify(error) + ", " + JSON.stringify(response)));

// Setting color using hue/saturation:
matter.sendCommand("5716184942583194821", 1, "Color Control", "MoveToHueAndSaturation", {"Hue": 254, "Saturation": 254, "TransitionTime": 0, "OptionsMask": 1, "OptionsOverride": 1}, (error, response) => console.log(JSON.stringify(error) + ", " + JSON.stringify(response)));

// Setting color temperature:
matter.sendCommand("5716184942583194821", 1, "Color Control", "MoveToColorTemperature", {"ColorTemperatureMireds": 370, "TransitionTime": 0, "OptionsMask": 1, "OptionsOverride": 1}, (error, response) => console.log(JSON.stringify(error) + ", " + JSON.stringify(response)));

Subscribtions

To react to changes that happens on a Matter device you can use our subscription model to register a listener that is called when an attribute is updated:

let subscription = matter.subscribe("5716184942583194821", [{endpointId: 1}]);

subscription.on("update", function(d) {
    console.log("connected: " + d.connected);
    if (d.updates === undefined) return;
    console.log(JSON.stringify(d.updates));
});

For the full documentation of our Matter API, go here:

Flic Script Matter API Documentation