johnan / home-assistant-flichub Goto Github PK
View Code? Open in Web Editor NEWCustom HomeAssistant integration for FlicHub
License: MIT License
Custom HomeAssistant integration for FlicHub
License: MIT License
I have a Home Assistant yellow and successful used the your flic integration in past. After I update HA my bluetooth device didn't worked anymore, so I can't used my flic buttons. So I removed the configuration of the Flic integration, but know I can configure the flic hub, but no buttons are found anymore. My bluetooth device is working again. Attached you will find my HA log.
error_log-7.txt
When trying to manually add integration (after installing it through HACS) and using correct IP (and port), I receive the error: "Unknown error occurred"
On the FlicHub-slide the console log is:
"Connection from 192.168.86.53
Client disconnected: 192.168.86.53"
So a connection is made, but it doesn't work.
The link seen in the HA-configuration-windows states
This redirect to a 404.
I think the link could be https://github.com/JohNan/home-assistant-flichub
Somewhat of a continuation of Issue #19 @JohNan
After updating to 1.0.7 #20 Manual setup is one again working as expected and the Hub is added to home assistant. Buttons however, are not being added by the integration.
Homeassistant logs below:
2023-10-26 23:07:33.606 INFO (MainThread) [pyflichub.client] Trying to connect to ('192.168.1.12', '8124')
2023-10-26 23:07:33.778 INFO (MainThread) [pyflichub.client] Disconnected
2023-10-26 23:07:33.779 INFO (MainThread) [pyflichub.client] Trying to connect to ('192.168.1.12', '8124')
2023-10-26 23:07:33.779 INFO (MainThread) [pyflichub.client] Connection lost
2023-10-26 23:07:33.905 WARNING (MainThread) [pyflichub.client] 'server_info'
Traceback (most recent call last):
File "/usr/local/lib/python3.11/site-packages/pyflichub/client.py", line 152, in data_received
self._handle_command(Command(**msg))
File "/usr/local/lib/python3.11/site-packages/pyflichub/client.py", line 172, in _handle_command
if self._data_ready[cmd.command] is not None and cmd.data is not None:
~~~~~~~~~~~~~~~~^^^^^^^^^^^^^
KeyError: 'server_info'
2023-10-26 23:07:33.907 WARNING (MainThread) [pyflichub.client] Unable to decode received data
2023-10-26 23:07:34.313 WARNING (MainThread) [pyflichub.client] Unterminated string starting at: line 1 column 1442 (char 1441)
Traceback (most recent call last):
File "/usr/local/lib/python3.11/site-packages/pyflichub/client.py", line 148, in data_received
msg = json.loads(data_part, cls=_JSONDecoder)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/json/__init__.py", line 359, in loads
return cls(**kw).decode(s)
^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/json/decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/json/decoder.py", line 353, in raw_decode
obj, end = self.scan_once(s, idx)
^^^^^^^^^^^^^^^^^^^^^^
json.decoder.JSONDecodeError: Unterminated string starting at: line 1 column 1442 (char 1441)
2023-10-26 23:07:34.319 WARNING (MainThread) [pyflichub.client] Unable to decode received data
2023-10-26 23:07:34.321 WARNING (MainThread) [pyflichub.client] Expecting value: line 1 column 1 (char 0)
Traceback (most recent call last):
File "/usr/local/lib/python3.11/site-packages/pyflichub/client.py", line 148, in data_received
msg = json.loads(data_part, cls=_JSONDecoder)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/json/__init__.py", line 359, in loads
return cls(**kw).decode(s)
^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/json/decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/json/decoder.py", line 355, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
2023-10-26 23:07:34.325 WARNING (MainThread) [pyflichub.client] Unable to decode received data
2023-10-26 23:07:41.270 INFO (MainThread) [homeassistant.components.sensor] Setting up sensor.rest
2023-10-26 23:07:41.986 INFO (MainThread) [homeassistant.components.bluetooth_le_tracker.device_tracker] Discovered Bluetooth LE device 77:68:20:71:0E:87
2023-10-26 23:07:43.790 WARNING (MainThread) [pyflichub.client] Waited for 'server' data for 10.0 secs.
2023-10-26 23:07:43.790 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
File "/config/custom_components/flichub/__init__.py", line 104, in client_connected
await client.get_server_info()
File "/usr/local/lib/python3.11/site-packages/pyflichub/client.py", line 106, in get_server_info
return command.data
^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'data'
2023-10-26 23:07:43.794 WARNING (MainThread) [pyflichub.client] Waited for 'buttons' data for 10.0 secs.
2023-10-26 23:07:43.805 INFO (MainThread) [homeassistant.components.binary_sensor] Setting up binary_sensor.flichub
2023-10-26 23:07:43.805 INFO (MainThread) [homeassistant.components.sensor] Setting up sensor.flichub
2023-10-26 23:07:43.806 INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new binary_sensor.flichub entity: binary_sensor.flichub_wifi
2023-10-26 23:07:43.806 INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new binary_sensor.flichub entity: binary_sensor.flichub_ethernet
Hi,
I was trying to connect to my Flic Hub LR but un successful, I am getting this error (from logs):
Logger: custom_components.flichub
Source: custom_components/flichub/config_flow.py:131
Integration: Flic Hub (documentation, issues)
First occurred: 10.44.04 (1 occurrences)
Last logged: 10.44.04
Error connecting
Traceback (most recent call last):
File "/config/custom_components/flichub/config_flow.py", line 132, in _test_credentials
await client_ready.wait()
File "/usr/local/lib/python3.11/asyncio/locks.py", line 213, in wait
await fut
asyncio.exceptions.CancelledError
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/config/custom_components/flichub/config_flow.py", line 131, in _test_credentials
with async_timeout.timeout(CLIENT_READY_TIMEOUT):
File "/usr/local/lib/python3.11/site-packages/async_timeout/init.py", line 128, in exit
self._do_exit(exc_type)
File "/usr/local/lib/python3.11/site-packages/async_timeout/init.py", line 228, in _do_exit
raise asyncio.TimeoutError
TimeoutError
I am able to connect to the hub from my phone (app) and have anabled the SDK access in the hup.
Any ideas?
Hi, after the first try all four flic buttons where added and also got the automations to work.
I tried a new Project with mini media player and some scripts for radiostations and also added spotify playlists. I also had to make changes on my configuration.yaml for that. After this other project the flic buttons stoped working and were not be detected from HA. I don't know if this have to do something with this issue. In the Flic App the buttons are still available. I tried to reinstall the flic hub, but now I only see one deviece (only the hub). I also tried to restard the tcpserver in the sdk. If I press configuration on the flic hub integration I'll get this error: 500 Internal Server Error Server got itself in trouble
Is there anything else which I can check to get the buttons back to home assistant?
Thanks in advanced.
Is there a way to integrate double click and hold into Home assistant?
Hi,
I really loved this integration and it has been working perfect until a few weeks back. Do not know exacly when it broke but every time a button is pressed it generats the following error:
`Logger: homeassistant
Källa: helpers/frame.py:203
Inträffade först: 19:31:20 (3 händelser)
Senast loggade: 19:31:20
Error doing job: Future exception was never retrieved
Traceback (most recent call last):
File "/usr/local/lib/python3.12/concurrent/futures/thread.py", line 58, in run
result = self.fn(*self.args, **self.kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/flichub/binary_sensor.py", line 214, in _event_callback
self.async_write_ha_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1008, in async_write_ha_state
self.hass.verify_event_loop_thread("async_write_ha_state")
File "/usr/src/homeassistant/homeassistant/core.py", line 440, in verify_event_loop_thread
frame.report(
File "/usr/src/homeassistant/homeassistant/helpers/frame.py", line 162, in report
_report_integration(what, integration_frame, level, error_if_integration)
File "/usr/src/homeassistant/homeassistant/helpers/frame.py", line 203, in _report_integration
raise RuntimeError(
RuntimeError: Detected that custom integration 'flichub' calls async_write_ha_state from a thread at custom_components/flichub/binary_sensor.py, line 214: self.async_write_ha_state(). Please report it to the author of the 'flichub' custom integration.
`
Does someone know how to fix this or does it work for anyone else? Thanks!!!
I'm running into a weird problem with this integration. I have two automations setup. One for a single click, another for a double click on the same button. However, I must wait several seconds between click types for the automation to recognize the second click type.
For example, if I single click to turn the lights on, all is well. If wait 2-3 seconds and double click (to turn lights off), the double click is not recognized by my automation. But if I do the same sequence and wait say 10 seconds between click types, everything works.
Should the clicks be recognized with only a short delay between click types, or does one need to pause longer than say 5 seconds for the second click type to be recognized?
Probably after the last update "Flic Hub" has stopped working with HACS.
Can see the following error in Home Assistant "Failed, trying to configure again" when I check the logs it says "2023-09-18 10:46:12.574 WARNING (MainThread) [pyflichub. client] Unable to decode received data"
It keeps saying "Failed setup, will retry" When i check the debug logs below is the error i see repeated over and over
2023-09-26 07:37:29.301 WARNING (MainThread) [pyflichub.client] FlicButton.init() missing 1 required positional argument: 'battery_timestamp'
Traceback (most recent call last):
File "/usr/local/lib/python3.11/site-packages/pyflichub/client.py", line 131, in data_received
self._handle_command(Command(**msg))
File "/usr/local/lib/python3.11/site-packages/pyflichub/client.py", line 145, in _handle_command
self.buttons = [FlicButton(**button) for button in humps.decamelize(cmd.data)]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/pyflichub/client.py", line 145, in
self.buttons = [FlicButton(**button) for button in humps.decamelize(cmd.data)]
^^^^^^^^^^^^^^^^^^^^
I believe this started after last update. Getting two errors:
This error originated from a custom integration.
Logger: homeassistant.config_entries
Source: custom_components/flichub/init.py:81
Integration: Flic Hub (documentation, issues)
First occurred: May 8, 2023 at 7:49:07 PM (4 occurrences)
Last logged: 10:10:27 AM
Error setting up entry 192.168.86.9 for flichub
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/config_entries.py", line 387, in async_setup
result = await component.async_setup_entry(hass, self)
File "/config/custom_components/flichub/init.py", line 81, in async_setup_entry
hass.config_entries.async_setup_platforms(entry, [BINARY_SENSOR])
AttributeError: 'ConfigEntries' object has no attribute 'async_setup_platforms'
And
Logger: pyflichub.client
Source: runner.py:179
First occurred: 4:25:26 AM (4 occurrences)
Last logged: 8:14:02 AM
Failed to connect to socket at ('192.168.86.9', '8124')
The steps needed to install this very nice integration are described in the readme.md.
The window which fields to fill are not mentioned:
It looks like i figured it out by myself.
But it is not working yet at my place so i want to rule out some bad configuration.
Having connected multiple buttons to my FlicHub, I get an error, that the JSON cannot be parsed due to varying errors. Looking at the logs one can see, that the payload for the buttons gets split up in multiple sections, which results in an error, as the payload gets split up somewhere within the JSON string, which than cannot be parsed correctly due to missing content afterwards.
Limiting the payload to send data from only 3-4 buttons (depending on whether they are V1 or V2 buttons), the payload is small enought to not be split up and therefore gets parsed correctly and therefore also shows the different buttons as valid entities within HomeAssistant. Is there a fix for that?
Here is some example output of the sent payload which gets cut off and continued in a second payload after a certain amount of letters:
2024-02-21 13:52:37.876 WARNING (MainThread) [pyflichub.client] Unable to decode received data 2024-02-21 13:52:37.885 DEBUG (MainThread) [pyflichub.client] Data received: '{"command":"buttons","data":[{"bdaddr":"80:e4:da:76:46:3e","serialNumber":"BA33-A01193","color":"","name":"Bed","activeDisconnect":false,"connected":true,"ready":true,"batteryStatus":38,"batteryTimestamp":1708519179964,"uuid":"ea739305bbcd410380cb591232e623ee","flicVersion":2,"firmwareVersion":11,"key":"2bd802b66ef327243a2bb7bd7958d298d5ae3b79","passiveMode":false},{"bdaddr":"80:e4:da:76:57:88","serialNumber":"BA33-A05647","color":"","name":"AC","activeDisconnect":false,"connected":false,"ready":false,"batteryStatus":100,"batteryTimestamp":1694058647178,"uuid":"01779e107e66437fa400a86f2d1c2f2f","flicVersion":2,"firmwareVersion":11,"key":"12a3bbd63d89a62b9835d94a51c78f3ba1b1abae","passiveMode":false},{"bdaddr":"80:e4:da:76:66:05","serialNumber":"BA33-A09367","color":"","name":"TV","activeDisconnect":false,"connected":true,"ready":true,"batteryStatus":40,"batteryTimestamp":1708512441173,"uuid":"febbed83210b4ad5a5e86fbbab519203","flicVersion":2,"firmwareVersion":11,"key":"2f4cce8cbd5a6ee9988c17d0920ba02bc44ce5b9","passiveMode":false},{"bdaddr":"80:e4:da:76:98:1b","serialNumber":"BA46-A22457","color":"","name":"Entrance Bed/Living Room","activeDisconnect":false,"connected":true,"ready":true,"batteryStatus":38,"batteryTimestamp":1708519191663,"uuid":"16c5ed02f74f4611909efde20db34a0a","flicVersion":2,"firmwareVersion":11,"key":"0ed2bcbdcab92ccc64ae20e203348d8bd87acb71","passiveMode":false},{"bdaddr":"80:e4:da:76:9d:09","serialNumb' 2024-02-21 13:52:37.885 WARNING (MainThread) [pyflichub.client] Unterminated string starting at: line 1 column 1438 (char 1437) Traceback (most recent call last): File "/usr/local/lib/python3.12/site-packages/pyflichub/client.py", line 148, in data_received msg = json.loads(data_part, cls=_JSONDecoder) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/json/__init__.py", line 359, in loads return cls(**kw).decode(s) ^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/json/decoder.py", line 337, in decode obj, end = self.raw_decode(s, idx=_w(s, 0).end()) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/json/decoder.py", line 353, in raw_decode obj, end = self.scan_once(s, idx) ^^^^^^^^^^^^^^^^^^^^^^ json.decoder.JSONDecodeError: Unterminated string starting at: line 1 column 1438 (char 1437) 2024-02-21 13:52:37.887 WARNING (MainThread) [pyflichub.client] Unable to decode received data 2024-02-21 13:52:37.894 DEBUG (MainThread) [pyflichub.client] Data received: 'er":"BA46-A23381","color":"","name":"Musik","activeDisconnect":false,"connected":false,"ready":false,"batteryStatus":47,"batteryTimestamp":1691341967929,"uuid":"3d11fcb02cdf4bc79740b9ac55996452","flicVersion":2,"firmwareVersion":10,"key":"76410d9aed0f00932ab3ee3e6bcbb3a89cfab40e","passiveMode":false}]}\n' 2024-02-21 13:52:37.894 WARNING (MainThread) [pyflichub.client] Expecting value: line 1 column 1 (char 0) Traceback (most recent call last): File "/usr/local/lib/python3.12/site-packages/pyflichub/client.py", line 148, in data_received msg = json.loads(data_part, cls=_JSONDecoder) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/json/__init__.py", line 359, in loads return cls(**kw).decode(s) ^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/json/decoder.py", line 337, in decode obj, end = self.raw_decode(s, idx=_w(s, 0).end()) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/json/decoder.py", line 355, in raw_decode raise JSONDecodeError("Expecting value", s, err.value) from None json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0) 2024-02-21 13:52:37.897 WARNING (MainThread) [pyflichub.client] Unable to decode received data
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.