Flic

The flic integration集成将 Home Assistant 与您的设备、服务等连接和集成。 [Learn more] allows you to receive click events from flic smart buttons.

The integration集成将 Home Assistant 与您的设备、服务等连接和集成。 [Learn more] does not directly interact with the buttons, but communicates with a flic service that manages the buttons. The service can run on the same instance as Home Assistant or any other reachable machine.

Action setup

If you are using the Home Assistant Operating System, you can run the service locally by installing the flicd add-on from pschmitt’s repository.

For instructions on how to install the service manually, visit the GitHub repository of the service for Linux, macOS or Windows.

Configuration

To use your flic buttons in your installation, add the following to your configuration.yamlconfiguration.yaml 文件是 Home Assistant 的主要配置文件。它列出了要加载的集成及其特定配置。在某些情况下,需要直接在 configuration.yaml 文件中手动编辑配置。大多数集成可以在 UI 中配置。 [Learn more] file. 在更改了configuration.yamlconfiguration.yaml 文件是 Home Assistant 的主要配置文件。它列出了要加载的集成及其特定配置。在某些情况下,需要直接在 configuration.yaml 文件中手动编辑配置。大多数集成可以在 UI 中配置。 [Learn more] 文件后,重启 Home Assistant 以应用更改。 该集成现在显示在集成页面的 设置 > 设备与服务 下。其实体在集成卡片上以及实体标签上列出。

# Example configuration.yaml entry
binary_sensor:
  - platform: flic

Configuration Variables

host string (Optional, default: localhost)

The IP or hostname of the flic service server.

port integer (Optional, default: 5551)

The port of the flic service.

discovery boolean (Optional, default: true)

If true then the integration is configured to constantly scan for new buttons.

ignored_click_types list (Optional)

List of click types whose occurrence should not trigger a flic_click event. Click types are single, double, and hold.

timeout integer (Optional, default: 3)

The maximum time in seconds an event can be queued locally on a button before discarding the event.

Discovery

If discovery is enabled, you can add a new button by pressing it for at least 7 seconds. The button will be paired with the flic service and added to Home Assistant. Otherwise, you have to manually pair it with the flic service. The Home Assistant platform will not scan for new buttons and will only connect to buttons already paired.

Timeout

When the flic button is triggered while disconnected from flic service, it will queue all events and try to connect and transmit them as soon as possible. The timeout variable can be used to stop events from triggering if too much time passed between the action and the notification in Home Assistant.

Events

The flic integration fires flic_click events on the bus. You can capture the events and respond to them in automation scripts like this:

# Example configuration.yaml automation entry
automation:
  - alias: "Turn on lights in the living room when flic is pressed once"
    triggers:
      - trigger: event
        event_type: flic_click
        event_data:
          button_name: flic_81e4ac74b6d2
          click_type: single
    actions:
      - action: homeassistant.turn_on
        target:
          entity_id: group.lights_livingroom

Event data:

  • button_name: The name of the button, that triggered the event.
  • button_address: The Bluetooth address of the button, that triggered the event.
  • click_type: The type of click. Possible values are single, double and hold.
  • queued_time: The amount of time this event was queued on the button, in seconds.

To help detect and debug flic button clicks, you can use this automation that send a notification on very click type of every button. This example uses the HTML5 push notification platform. Visit the notification integration page for more information on setting up notifications.

automation:
  - alias: "FLIC Html5 notify on every click"
    triggers:
      - trigger: event
        event_type: flic_click
    actions:
      - action: notify.html5
        data:
          title: "flic click"
          message: "flic {{ trigger.event.data.button_name }} was {{ trigger.event.data.click_type }} clicked"

Ignoring click types

For some purposes it might make sense to exclude a specific click type from triggering click events. For example, when ignoring double clicks, pressing the button twice fast results in two single instead of a double click event. This is very useful for applications where you want to click fast.