Hello,
Recent, Shortcutlabs has released a new product, the Flic Hub (Link ).
With this device, your phone hasn’t be always home for the flic buttons to interact.
It would be nice, if you can intergrate the buttons inside home assistnt. Like the Flic Smart Button (link ) if you have installed the library on a PI.
The configuration would be something like this:
# Example configuration.yaml entry
flic:
hubs:
- host: DEVICE_IP_ADDRESS
- host: DEVICE_IP_ADDRESS
after this, every button connected to the hub, would be a binary sensor like the smart button component and it would interact as a event trigger.
I have made a request on their ideas form: (link )
Thank you
dermotos
(Dermot)
June 15, 2018, 10:40am
4
While waiting for this, you could use the HTTP Binary Sensor
in HA, and use the Advanced > HTTP Request option in Flic to send HTTP requests to HA for each button press, which will then appear as binary sensor events in HA.
3 Likes
This would indeed be great! So far it is working pretty well with HTTP request and HA’s RESTful API but native integration would be awsome!
The HTTP Request method is a bit over my head and seems like you have to pass your password. Hub integration would be fantastic!
mihalski
(Michal Dobrzynski)
August 13, 2018, 9:11am
8
Perhaps a HTTP Request to mqtt bridge? you could specify the hub ip as the only source it accepts connections from for some security.
karlg
(Karl)
August 13, 2018, 8:58pm
9
Being new to this, could somebody please give me an idea about how to do the RESTful interface?
I understand the hub has to send a URL to HA, but I’m not sure how HA would accept it so actions can be initiated…
Thanks!
arch
September 8, 2018, 4:47am
10
Once you have enabled the api, the URL can change the state of the home-assistant entity specified in the body of the post.
This is how I toggle an input boolean for each flic button action:
First enable the home-assistant api, and specify your password in configuration.yaml (you’re going to have to expose it in the flic app):
http:
api_password: yourapipassword
Create an input boolean for each button action - in configuration.yaml:
#flic button 2 (black)
input_boolean:
flic2_singleclick:
name: black_flic2_singleclick
icon: mdi:checkbox-blank-circle
flic2_doubleclick:
name: black_flic2_doubleclick
icon: mdi:checkbox-multiple-blank-circle
flic2_hold:
name: black_flic2_hold
icon: mdi:clock
In the flic app, specify the URL details for each action (it’s a bit labourious - fortunately you can clone the config if you have multiple buttons). For example, for a single click:
URL:
http://XXX.XXX.X.XXX:8123/api/services/input_boolean/toggle
select:
POST
Content Type:
application/json
Body: (I had to stop my iphone from inserting “smart quotes”)
{“entitiy_id”:“input_boolean.flic2_singleclick”}
HTTP headers
Key:
x-ha-access
Value:
yourapipassword
then press INSERT
2 Likes
I use a event, works nice.
- alias: Single click
trigger:
platform: event
event_type: flic_click
event_data:
button_name: flic
click_type: single
action:
- service: switch.turn_off
entity_id: switch.light
Inside the fllic app:
post request to host/api/events/flic_click
with in the body and Content Type Json: { “button_name”: “flic”, “click_type”: “single” } this is the event data .
and ofcourse, for now, with the your password in the header, hopfully, the long life bearer tokens come quick
6 Likes
karlg
(Karl)
September 18, 2018, 5:25am
12
Thank you arch and janvanhelvoort!
johga
(Johan)
September 28, 2018, 2:23pm
14
Anyone got a working setup with a Long-Lived Access Token configured?
I’m a bit out of my comfort zone here but I suspect that I need to change ‘x-ha-access’ to something else and use my token that I’ve configured in HA.
SimonT
(Simon Talks)
November 3, 2018, 9:34am
15
I am using hassio and find the Flicd addon works great, I have a combination of Flics using both the Flic Hub and FlicD (for direct HA access).
Does that work even though there is an api password?
niXta1
(Ni Xta)
November 21, 2018, 12:00am
17
Can you use the buttons on the hub without internet access?
JanHG
December 1, 2018, 11:17pm
18
Yes, take a look here .
You need to replace ‘x-ha-access’ with ‘Authorization’ and the Value String then need to be ‘Bearer YourToken’.
Freland
(Fredrik Nilsson)
December 8, 2018, 11:19am
19
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…
1 Like
mpgibbs
(Mike)
January 3, 2019, 1:37pm
20
Would like to see this to Also with the addition of the IR = Awesome beans
qqgg231
January 19, 2019, 11:30am
21
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" }