Flic hub intergration

Tags: #<Tag:0x00007fc3dd13ef40>

Yes, it is working for me for a long time already.

Need more details to help. I am not sure about which “event listening from app” you are talking about.

Did you type correct IP? You may need to replace hassio.local with IP.

switching from http://hassio.local to 192.168.x.x fixed the isssue.

Thanks for your help!

1 Like

exactly I currently receive the http request in NodeRed. and use it in flows to act on home assistant entities

Flic just released their SDK

Maybe something worth looking into?


Just got the Email about the SDK! Great news. Now where them intelligent developer at? :sweat_smile:

You can create a flic hub module:

// main.js
var buttonManager = require("buttons");
var http = require("http");
var url = "http://192.168.xx.xxx:8123/api/events/flic";

buttonManager.on("buttonSingleOrDoubleClickOrHold", function(obj) {
	var button = buttonManager.getButton(obj.bdaddr);
	var clickType = obj.isSingleClick ? "click" : obj.isDoubleClick ? "double_click" : "hold";
		url: url,
		method: "POST",
		headers: {"Content-Type": "application/json", "Authorization": "Bearer xxxxxxxxxxxxxxxxxxxxxx"},
//		content: JSON.stringify({"serial-number": button.serialNumber, "click-type": clickType}),		
		content: JSON.stringify({"button_name": button.name, "click_type": clickType, "battery_status": button.batteryStatus }),				
	}, function(err, res) {
		console.log("request status: " + res.statusCode);
//		console.log("button_name: " + button.name)
//		console.log("click_type: " + clickType)


This will then create a flic event in home assistant for each button press (and send the battery level as a bonus)

1 Like

Cool thanks! But this is pretty much what you could already do from the app.
Make a “Internet Request” with post etc.

What would be cool is to integrate the hub into Home Assistant. Basically being able to use any flic button as a “switch” for other integrations.
And maybe if possible use the Flic Hubs IR blaster through Home Assistant.
Right now Flic is pretty limited to their partnerships but if this would be possible then we could have a bunch of whole new use cases for this product!

Putting out a 20$ bounty on a integration like this, anyone wanna join me in order to get a developer invested in this project? :smiley:

More people talking about this subject

Would be awesome with a native integration of the FLIC HUB.

1 Like

Cool thanks! But this is pretty much what you could already do from the app.
Make a “Internet Request” with post etc.

But in the app, you would have to create that internet request for every click typoe on every button.
Now you do the script once on the hub and it works for all buttons !

Genuinely, all you need to do is copy and paste that code into the IDE on the flic hub.
It will then create an event for every click type of every button.

I’m not sure why you would need anything else ?

1 Like

I have created a TCP Server / Client to be able to get events and info from the Flic Hub. My goal is to create an integration using this python module. You can find it here GitHub - JohNan/pyflichub-tcpclient

The Flic Hub acts as the server and pushes events to the python client.

Any help and feedback is appreciated :slight_smile:


any interest in explaining how you got this add-on to work with the flic hub?

No Joke, my first project on HA is integrating wiz lights with flic buttons. Im pulling my hair out trying to figure this system out. I have the lights working. Following these steps for http requests I just get log in error notifications on HA. Need to figure out what information Im entering wrong then figure out how I tie the button to a light. I need a HA for dummies version of all this stuff, almost all the tutorials I find assume you know a lot of steps already.

Keep us posted, I need a simplified community integration to get flic operating.

The repository I linked to has no Home Assistant component. It’s just a simpla TcpClient that talks to a TcpServer on the Flic Hub. You start the server by enabling the Flic Hub SDK by following this instructions Flic Hub SDK Tutorial When you have accessed the online editor you create a new module and paste the javascript code in my repo and press the play button. Then start the python client and you’ll see that it picks up the clicks.

The python client will be integrated into a Home Assistant component once I get some more time to work on it. When that is done all clicks will be picked up in HA.

I assume serial-number is the one on the hub. Is button.serialnumber litterally button.(the same serialnumber)? Also, where do I get the button name?

The only thing you need to change in the code is the ip address of the hub.

The script will send the actual button name or button serial number into the event it creates.

OK, great. I seem to have it working, but I’m not sure how to get what I need. I’m currently listening to all events and when I click the one button I have connected I get this:

    "event_type": "persistent_notifications_updated",
    "data": {},
    "origin": "LOCAL",
    "time_fired": "2021-05-12T00:32:35.704310+00:00",
    "context": {
        "id": "a1bd43cc1967598bf3fc06652662cf83",
        "parent_id": null,
        "user_id": null

How do I use this in Home Assistant? There is nothing as a “flic” event. I can see “request status: 401” in the SDK console when I push the button but nothing useful in HA. Please explain how to use this.