flic
#
Description#
This integration listens for events from the Flic smart buttons over Bluetooth.
Requires:
fliclib (50ButtonsEach/fliclib-linux-hci).
Clone the repository and follow the instructions in the README. This plugin requires:
The
flicd
daemon to be running - either on the same machine or on a machine that can be reached through the network.The buttons to be paired with the device running the
flicd
daemon. The repository provides several scanners, but the easiest way is probably through thenew_scan_wizard.py
script.
# Clone the repository
$ git clone https://github.com/50ButtonsEach/fliclib-linux-hci.git
# Run the flid daemon
$ [sudo] fliclib-linux-hci/bin/$(uname -m)/flicd -f /path/to/flicd.db &
# Run the new_scan_wizard.py script to pair the buttons
$ cd fliclib-linux-hci/clientlib/python
$ python3 new_scan_wizard.py
Configuration#
flic:
# [Optional]
# flicd server host (default: localhost)
# server: localhost # type=str
# [Optional]
# How long you should press a button for a
# press action to be considered "long press" (default: 0.3 secohds)
# long_press_timeout: 0.3 # type=float
# [Optional]
# How long since the last button release before
# considering the user interaction completed (default: 0.5 seconds)
# btn_timeout: 0.5 # type=float
# [Optional]
# How often the `RunnablePlugin.loop <https://docs.platypush.tech/platypush/plugins/.html#platypush.plugins.RunnablePlugin.loop>`_ function should be
# executed (default: 15 seconds). *NOTE*: For back-compatibility
# reasons, the `poll_seconds` argument is also supported, but it's
# deprecated.
# poll_interval: 15 # type=Optional[float]
# [Optional]
# How long we should wait for any running
# threads/processes to stop before exiting (default: 5 seconds).
# stop_timeout: 5 # type=Optional[float]
# [Optional]
# If set to True then the plugin will not monitor
# for new events. This is useful if you want to run a plugin in
# stateless mode and only leverage its actions, without triggering any
# events. Defaults to False.
# disable_monitor: False # type=bool
Triggered events#
Module reference#
- class platypush.plugins.flic.FlicPlugin(server: str = 'localhost', long_press_timeout: float = 0.3, btn_timeout: float = 0.5, **kwargs)[source]#
Bases:
RunnablePlugin
This integration listens for events from the Flic smart buttons over Bluetooth.
Requires:
fliclib (50ButtonsEach/fliclib-linux-hci).
Clone the repository and follow the instructions in the README. This plugin requires:
The
flicd
daemon to be running - either on the same machine or on a machine that can be reached through the network.The buttons to be paired with the device running the
flicd
daemon. The repository provides several scanners, but the easiest way is probably through thenew_scan_wizard.py
script.
# Clone the repository $ git clone https://github.com/50ButtonsEach/fliclib-linux-hci.git # Run the flid daemon $ [sudo] fliclib-linux-hci/bin/$(uname -m)/flicd -f /path/to/flicd.db & # Run the new_scan_wizard.py script to pair the buttons $ cd fliclib-linux-hci/clientlib/python $ python3 new_scan_wizard.py
- __init__(server: str = 'localhost', long_press_timeout: float = 0.3, btn_timeout: float = 0.5, **kwargs)[source]#
- Parameters:
server – flicd server host (default: localhost)
long_press_timeout – How long you should press a button for a press action to be considered “long press” (default: 0.3 secohds)
btn_timeout – How long since the last button release before considering the user interaction completed (default: 0.5 seconds)
- start()#
Start the plugin.
- stop()#
Stop the plugin.
- wait_stop(timeout=None)#
Wait until a stop event is received.