Can you use the buttons on the hub without internet access?
Yes, take a look here.
You need to replace ‘x-ha-access’ with ‘Authorization’ and the Value String then need to be ‘Bearer YourToken’.
Any news on Flic Hub intetration? Would love to see this…Currently using a Pi with hassio as my “flic-hub” (feeds mqtt into my main HA-setup on my Synology). Feels slightly buggy sometimes…
Would like to see this to Also with the addition of the IR = Awesome beans
- Add to automations.yaml
- alias: "Flic1 hold"
trigger:
platform: event
event_type: flic
event_data:
button_name: flic1
click_type: hold
action:
- service: script.turn_on
entity_id: script.test_script4 # change this name to your's script name
-
Remember to replace
hassio.local
in all steps below with homeassistant IP (typically 192.168.x.x). Although some steps may work also without replacing. -
Generate token here: http://hassio.local:8123/profile
Replace all GENERATED_TOKEN below with it. -
(Optional) test if it works on curl:
curl -k -X POST -H "Authorization: Bearer GENERATED_TOKEN" -H "Content-Type: application/json" -d '{ "button_name": "flic1", "click_type": "hold" }' http://hassio.local:8123/api/events/flic
- Add “internet request” to button via flic app
use these settings:
http://hassio.local:8123/api/events/flic
Content-Type: application/json
header:
name: Authorization
body of header: Bearer GENERATED_TOKEN
body: { "button_name": "flic1", "click_type": "hold" }
I’ve just picked up a Flic hub for a very reasonable price, thinking I could use it instead of the Pi Zero I’ve been using (which has been a bit of a mixed bag reliability wise), but I’d love to add my +1 to this and ask where is it up to, if anywhere?
I’ve got this working in Curl, but not on flic. You were able to get this in flic? I’m assuming its something with the Bearer token as i don’t see anything come through when i listen for the flic event from the app
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.
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?
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";
http.makeRequest({
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)
});
});
console.log("Started");
This will then create a flic event in home assistant for each button press (and send the battery level as a bonus)
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?
More people talking about this subject
Would be awesome with a native integration of the FLIC HUB.
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 ?
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