I have created a TCP Client in Python that responds to button clicks from the Flic Hub. My idea was to create an Integration to HomeAssistant, but I haven't had the time to finish it. So I wanted to share the python tcp client for other people to use and improve.
Pull requests and feedback is appriciated :)
You can find the repository here
I cannot seem to get a valid batterystatus from my old flic buttons.
Please see issue the issue I reported on github: https://github.com/50ButtonsEach/fliclib-linux-hci/issues/84
Does the batterystatus require an firmware update of the buttons?
I know this is a little old, but here is one way to approach this.
Create a webhook endpoint on the server, then use a websocket to push messages to the frontend.
Register the buttons with the database, giving them a UUID.
Split the API route based on button actions, passing the button's UUID as the parameter.
Assign the URL as an action to the botton, i.e. ".../button/action/uuid
Hope that helps
Thank you for your help!
I got a syntax error but I managed to repair it with this code:
cc = fliclib.ButtonConnectionChannel(bd_addr)
cc.on_button_single_or_double_click = \
lambda channel, click_type, was_queued, time_diff: \
keyboard.press(Key.right) if click_type == fliclib.ClickType.ButtonSingleClick else keyboard.press(Key.left)
cc.on_connection_status_changed = \
lambda channel, connection_status, disconnect_reason: \
print(channel.bd_addr + " " + str(connection_status) + (" " + str(disconnect_reason) if connection_status == fliclib.ConnectionStatus.Disconnected else ""))
It works perfectly and it seems I don't need to release the key.
But it seems Windows Universal Apps don't recognize key presses sent by Python... Key presses are recognized everywhere else. Anybody knows why or how to get around it?
The next step to have a fully functional Windows integration would be to make the script work with Eventghost. I will try either by capturing the keystroke event and by sending http requests to it's built-in webserver. I will let you know!
@shawn-james-c Hello, this is possible using flic > ifttt > pushbullet. I tested it with Google Chrome and the pushbullet addon in the browser. When a URL is pushed, you set google chrome to open the url as default action.
@restauraid-mx The hub supports up to 63 buttons to be connected at the same time. But as I wrote earlier, the buttons are then connected to the hub and not to the Android device. So that's why I wondered what you want should happen with the button events when the buttons are pressed.