@msiekkinen This is great!!! So what did the final install look like? Has it held up?
-
While it's nice to finally be able to use the device after having it sit in a drawer for (years now?), there seems to be a somewhat repeatable and relatively huge latency spike in communication between the devices (happens exactly the same on both of my twist devices) that shows itself every 3-4 button presses.
The latency is between the physical device and the hub, from the time you actually press the button until there is any sort of communication received or shown via the hub SDK.
(Note, the FlicHub LR is hardwired, not using wifi. Though I don't think it would matter much for this particular issue either way.)
Ex:
Press button - response is milliseconds Press button - response is milliseconds Press button - response is milliseconds Press button - response is 2.5 - 3 seconds from time of physical press until the very first log message appears. Press button - response is milliseconds... repeat this any number of times, the only difference is the issue might move to spot #2,3, but always happens after a few button presses.
The "very first log message" I am referring to is the following:
buttonManager.on("buttonSingleOrDoubleClickOrHold", function (obj) { log("Initial Press"); // ... Rest of the code }This issue feels very much like it is firmware/connection between the device and flichub related, as I first noticed this when I initially received my flictwist/hub a few years ago when it came out. I just didn't bother to mention it at that point and put the twist in a drawer.
Now that the device has the potential to actually be useful, this random yet always present lag is annoying enough that I don't even want to use the device as I have had a lot of time to fine-tune the code for my Hue Tap Dials.
While they lack any sort of 'current rotation value' indication, they are always as close to instant as one could get and reliable. After a number of years building my smarthome, I have found those two qualities to be much more important than "neat and fancy".
That said, for additional context, I have tried every combination of resetting, reconnecting, reconfiguring that are available. It does not matter how close or far I am from the hub. I tested with the hub on my desk, button in my hand. I tried with the hub in a corner of the house farthest away from any other devices as I could be to ensure there wasn't any sort of interference from other signals, etc. The result is always the same.
I am guessing that this is just how it is, and that's that?
Edit: I captured some timestamps, generating a timestamp upon pressing a button on my keyboard and pressed the button and the keyboard at the same time:
Button Physical Press: 2025-06-19 14:32:31.705 Log Message In Hub: 2025-06-19 14:32:32.394 info: Initial Press Button Physical Press: 2025-06-19 14:32:39.541 Log Message In Hub: 2025-06-19 14:32:40.045 info: Initial Press Button Physical Press: 2025-06-19 14:32:46.322 Log Message In Hub: 2025-06-19 14:32:50.958 info: Initial PressThe last press had a latency of 4.636 seconds.
-
We are today announcing a Beta release of some new features in the Hub SDK that can be used together with Flic Twist.
In order to seamlessly continue to work with the rest of your smart home devices that you might have assigned to other triggers on the Flic Twist, we introduce the concept of Virtual Devices. A Virtual Device is handled by the Flic Hub firmware just like any other supported real device, but its functionality is implemented by the user in the Hub SDK, typically by writing some kind of bridge software that sends commands and receives update events over the LAN to/from the real device. If for example the brightness of a (real) light is changed by some external means, it is possible to tell the Flic Hub firmware from javascript about the new brightness level, which the hub then forwards to the Flic Twist, so that the LED status can update accordingly. That way when you twist it, it will start from the correct position.
We are also adding a "message" action that can be used to send arbitrary strings to your scripts whenever the action is triggered. The intended use case is to be able to trigger custom code also for Push/Double Push in the Selector feature or perform some action when a specific point is reached in Advanced Dimming or Scene Blender.
The virtual devices can be created in the Flic App and be set to be controlled by a Flic Twist as follows:
IMG_9799.png
IMG_9797.png
Using this piece of code, updates are received in your javascript code after configuring a virtual device to be triggered in the Flic App for a specific Flic Twist:
const flicapp = require("flicapp"); flicapp.on("virtualDeviceUpdate", (metaData, values) => { // The values object can contain hue, saturation, brightness, colorTemperature, volume, position (for blinds) console.log(`Twist ${metaData.buttonId} updated virtual device ${metaData.virtualDeviceId} of type ${metaData.dimmableType} with these values: ${JSON.stringify(values)}`); });When a device is modified externally, we use this function to inform the system of the change:
flicapp.virtualDeviceUpdateState(dimmableType, virtualDeviceId, values);The dimmableType can be either "Light", "Speaker" or "Blind". The values is an object containing at least one of the fields mentioned above that is appropriate for the corresponding dimmableType. For example:
flicapp.virtualDeviceUpdateState("Light", "my_ceiling_light", {hue: 0.6, saturation: 0.7, brightness: 0.8});The values themselves are always floating point numbers between 0 and 1.
Configure an action message to be triggered by assigning the following action in the Flic app:
IMG_9798.png
The action messages are easy to receive, just register a listener as follows:
flicapp.on("actionMessage", message => console.log(`Got a message: ${message}`));We'd love to hear your feedback!
-
-
TL;DR: If you use Home Assistant, getting programmatic access to Flic Twist events is doable.
alt text
https://youtube.com/shorts/vk94HH6OKEI?si=wHioNnW3-7Nc5gYW
This video shows using the twist events to switch pandora radio stations. Each of the 25 clicks on the twist is a station.
These instructions are my best recollection of setting it up and not what actually happened. If you run into something that isn’t right, I’m happy to update this post or answer a question.
ALSO: If you know of a simpler way to work programmatically with the Flic Twist, please let me know! This was born from me wondering if it would take less time to do this than to keep checking this forum to see if the Twist SDK was available yet.
Have Home Assistant: I use Home Assistant OS on a Raspberry Pi 4. Add Matterbridge: Install Matterbridge to connect Flic devices with Home Assistant. Follow the setup to get a QR code and register your devices in the Flic app under “Providers -> Matter.” Matterbridge expos
https://github.com/t0bst4r/matterbridge-home-assistant-addon?tab=readme-ov-file Configure a Virtual Light: Install the Home Assistant File Editor.
https://github.com/home-assistant/addons/blob/master/configurator/DOCS.md Edit configuration.yaml to add a virtual light. Example configuration: light: - platform: template lights: album_dial: friendly_name: "Album Dial" level_template: "{{ states('input_number.album_dial_brightness') | int }}" value_template: "{{ is_state('input_boolean.album_dial_switch', 'on') }}" turn_on: - service: input_boolean.turn_on target: entity_id: input_boolean.album_dial_switch - service: input_number.set_value target: entity_id: input_number.album_dial_brightness data: value: 255 turn_off: service: input_boolean.turn_off target: entity_id: input_boolean.album_dial_switch set_level: - service: input_boolean.turn_on target: entity_id: input_boolean.album_dial_switch - service: input_number.set_value target: entity_id: input_number.album_dial_brightness data_template: value: "{{ brightness }}" 4. Restart Home Assistant. Your virtual light (album_dial) should appear in the Matterbridge logs. 5. Link Flic Twist to Virtual Light: In the Flic app, go to your Twist settings -> Brightness -> Link to album_dial. Turning the dial now adjusts the brightness.Optional: Use MQTT for Custom Events
If you want to integrate with the Flic Hub or other systems, publish MQTT events from Home Assistant:
Install Mosquitto Broker: Add the Mosquitto addon in Home Assistant. Set up Automation: Edit automations.yaml to publish events to MQTT: - id: publish_album_dial_to_mqtt alias: Publish Album Dial State to MQTT trigger: - platform: state entity_id: light.album_dial action: - service: mqtt.publish data: topic: home/album_dial/switch payload: > { "state": "{{ 'on' if state_attr('light.album_dial', 'brightness') | int > 0 else 'off' }}", "brightness": "{{ state_attr('light.album_dial', 'brightness') | int }}", "timestamp": "{{ now().timestamp() | int }}" } retain: true Restart Home Assistant: You should now see MQTT events in the logs or an MQTT client like MQTT Explorer.Flic Hub Integration Example
If you want to work with the Flic Hub, you can subscribe to these MQTT events:
var mqtt = require("./mqtt").create("HOME_ASSISTANT_IP", { port: 1883 }); mqtt.on("connected", function () { console.log("Connected"); mqtt.subscribe("home/album_dial/switch"); }); mqtt.on("publish", function (pub) { console.log("Received: ", pub.message); // Example: const message = JSON.parse(pub.message); }); mqtt.connect();
1. Start a Flic Hub Project: Use flic-hub-sdk-mqtt-js.
2. Subscribe to MQTT Events: Example main.js script:Hope this helps someone!