Flic Hub (Flic buttons) integration using Flic Hub SDK and HA binary sensors/automations

Hi guys

Total HA newbie here. The last piece of my setup jigsaw, for now, is to get my Flic integrated.

This page and instructions look great, thanks for taking the time to share. I’m not getting any success though. I’ve added the automation in automation.YAML file but nothing happening.

Would anyone be happy to help me?

Hello everyone,

I got my Flic Buttons working with flicd they are working most of the time just fine. The range is very bad and my Bluetooth dongle only supports 5 Buttons max. I got a flic hub laying around.

Is the methode with the flic hub with the sdk and webhooks working localy?

I’m not that advanced, can someone help me out?

Hi all. what is the webhook?

1 Like

This is great! Thanks @diegomorales17

This is absolutely awesome! :smiley:
I am still trying to figure out how to manage automation based on click types. I only use one help but it seems to switch a light on on click and off on hold without any click type config… which is neat but I want to add a double click function.

I edited line 16 of the flic hub code to make a more detailed log output so you can see the button name and press types. (handy for when you do not know what button it is and what the name you gave it was…)

		console.log("Activity log - request status: " + res.statusCode +", " + button.name +", " + clickType);

Thanks again, this has made flic so much more awesome.

If you haven’t solved it, you need to change double_click to double-click
it’s correct in the first code block, but has a typo in the 3rd code block

Thanks for pointing it out. I have modified all code blocks to use _ instead of - wherever possible to standardize the naming convention further.

I am getting an issue with my config file once adding it.

Can you see what is wrong here?

template: !include_dir_merge_list templates/

sensor:
  - platform: foxess
    name: FoxESS1
    username: ****
    password: *****
    deviceID: 59e48e7c-95ff-47c8-ae4a-****
  - platform: foxess
    name: FoxESS2
    username: *****
    password: ****
    deviceID: b9d1760b-6869-4027-a241-******
  
  - trigger:
    - platform: webhook
      webhook_id: flicserver-binary_sensor.flic1

      binary_sensor:
      - unique_id: "binary_sensor.flic1_button"
        name: "[binary_sensor.flic1] Button"
        state: "on"
        auto_off: 0.1
        attributes:
            click_type: "{{ trigger.json.click_type }}"
            battery: "{{ trigger.json.battery_status }}"

If you have a MQTT server you could follow this guide:

I just tried it and it’s all local!

2 Likes

Can anyone tell me what is going wrong here? I have removed ‘template’ because apparently it only needs to say it once in the config file and it says it at the top and also when I do add ‘template’ it says duplicate key.

Does anyone look at this anymore? I have managed to sort out the above.

I have done everything @diegomorales17 said in their first post yet I cannot get it to work. The flic button does not seem to exist anywhere in my HA and the automation says there is an error.

Am I meant to remove or leave the square brackets? Am I meant to remove or leave the ’ surrounding the bits I have to type?

I have moved to MQTT for my flic buttons and it’s working great!
I’m using this:

1 Like

Can you share what you did please?

I wanted to share an integration I have made for Flic Hub. It uses a TCP socket between the hub and HA. The integration will automatically find the hub or can be configured using the UIin HA.

Let me know what you think!

I had a question about your Flichub tool, about how i can trigger automations with single, double and hold button presses

I can’t add the integration to HA. I have installed the components through HACS, I have activated SDK on the Flic Hub and I have created a module based on “tcpserver.js” and started the module. I can see connection attempts from the HA IP but it disconnects and in HA GUI I get an error message: “Unable to connect to device”.

Made by JohNan - GitHub - JohNan/pyflichub-tcpclient
The server should have started now!
Waiting for connections…
Connection from 192.168.5.197
Client disconnected: 192.168.5.197

image

Have you double checked the port? The default port in the script is 8124 and it looks like you have set 8125 in HA.

But if you see the connection attempt the port should be correct. Can you enable debug logs for the integration and post them here? I think you have to enable them manually by adding it to configuration.yml

logger:
  default: info
  logs:
    pyflichub.client: debug
    custom_components.flichub: debug

Same question, this was INCREDIBLY easy to set up and works amazingly well (thank you!) however I can’t see how to differentiate between click, double click, and hold button functions for automations etc. Is there a way to do this that I’m not seeing?

UPDATE: I found this blueprint, and it works PERFECTLY - just add the blueprint, then make an automation for your button based on this and it combines actions for single/double/hold into one automation. BEAUTIFUL!

I modified the trigger config to this and it fixed it:

trigger:

  • platform: webhook
    allowed_methods:
    • POST
    • PUT
      local_only: true
      webhook_id: [XXXXXXXX]