Here is what worked for me using the instruction the amazing Ingo put together but adding a little more details in case someone find them useful or not sure what to change.
1- Go to https://hubsdk.flic.io/
2- Create a new module and rename it to MQTT
3- Create two new files by or rename the default files to main.js and mqtt.js
4- Copy the code from the files main.js and mqtt.js from Github GitHub - id628/flic2hass: A Flic SDK utility to publish all Flic buttons to Home Assistant via MQTT
5- If your MQTT has a password. Edit the main.js using the below.
var server = “192.168.0.x”;
var hatopic = “yourMQTTusername”;
var flictopic = “flic”;
var username = ‘homeassistant’;
var password = ‘yourMQTTpassword’;
var buttonManager = require(“buttons”);
var mqtt = require("./mqtt").create(server,{‘username’:username,‘password’:password});
var myButtons = {}; //Dictionary of Button objects
you can replace the first lines, change the values between the quotes to:
- var server is the IP address of your HA or MQTT server if different.
- var hatopic, keep as homeassistant.
- var username of your MQTT username that you can find in HA under Settings > Devices & Services > MQTT > Configure > Re-configure MQTT > copy the username and password from there
- var password is your MQTT password you can get from step 3
- keep var mqtt and var myButtons as is (just copy them)
6- Click the play button.
7- if everything works you should see a list of your buttons and some details. press it once and you should see the name and button details and the type of click.
8- Go back to HA and MQTT integration and search for “flic” and you should see all your buttons listed and use them from there in your automations. States are 'click", “double_click”, and “hold”.
It is a hit and miss and I also had to restart the module and the flic hub couple times. But it should work fine after that.
I hope this helps. Thanks Ingo again for the work. Very much appreciated.