Closed LGH531 closed 6 months ago
Hey there @abmantis, mind taking a look at this issue as it has been labeled with an integration (idasen_desk
) you are listed as a code owner for? Thanks!
(message by CodeOwnersMention)
idasen_desk documentation idasen_desk source (message by IssueLinks)
How much time (you should be able to see from the cover history)? Also, when that happens can you try reloading the integration without moving the desk first? If it fails, do that twice (because the desk sometimes fails to connect). Also, please share the logs of when that happens.
How much time (you should be able to see from the cover history)? Also, when that happens can you try reloading the integration without moving the desk first? If it fails, do that twice (because the desk sometimes fails to connect). Also, please share the logs of when that happens.
So, I ran a second test after getting the desk connected again. It stayed connected approximately 5.5 hours (consistent with the initial issue).
I tried reloading the integration (twice, as requested). Desk does NOT reconnect and the only messages in Logs are from the reconnect attempt:
_Logger: idasen_ha Source: components/idasen_desk/init.py:92 First occurred: 8:26:18 AM (3 occurrences) Last logged: 2:21:45 PM
Already disconnected_
Weird. Mine stays connected the whole day.
Can you enable debug logging next time, so that we can get more logs?
You can enable them with the logger.set_level
service:
service: logger.set_level
data:
idasen_ha: debug
idasen: debug
bleak: debug
Weird. Mine stays connected the whole day. Can you enable debug logging next time, so that we can get more logs? You can enable them with the
logger.set_level
service:service: logger.set_level data: idasen_ha: debug idasen: debug bleak: debug
Did another test last night with debug logging as suggested. The desk only stayed connected for 2hre 45mins this time. Nothing extra in the logs... just the same as shown in previous post..... EXCEPT:
When trying to reconnect the device again, it is seen in HA but not able to control it. Getting an "E16" error on the desk controller.
Unplugged the desk and paired it again to the ESPHome Bluetooth Proxy. Again, shows as connected but unable to control the desk. Now seeing this in LOG:
Logger: homeassistant.components.websocket_api.http.connection Source: components/websocket_api/commands.py:226 Integration: Home Assistant WebSocket API (documentation, issues) First occurred: 8:33:45 AM (1 occurrences) Last logged: 8:33:45 AM
[140424640499136] Bluetooth GATT Error address=DB:0A:3A:94:F1:E9 handle=29 error=133 description=Error Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/components/esphome/bluetooth/client.py", line 100, in _async_wrap_bluetooth_operation return await func(self, *args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/esphome/bluetooth/client.py", line 605, in read_gatt_char return await self._client.bluetooth_gatt_read( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/aioesphomeapi/client.py", line 852, in bluetooth_gatt_read resp = await self._send_bluetooth_message_await_response( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/aioesphomeapi/client.py", line 510, in _send_bluetooth_message_await_response raise BluetoothGATTAPIError(BluetoothGATTError.from_pb(resp[0])) aioesphomeapi.core.BluetoothGATTAPIError: Bluetooth GATT Error address=DB:0A:3A:94:F1:E9 handle=29 error=133 description=Error
The above exception was the direct cause of the following exception:
Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 226, in handle_call_service await hass.services.async_call( File "/usr/src/homeassistant/homeassistant/core.py", line 2012, in async_call response_data = await coro ^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/core.py", line 2049, in _execute_service return await target(service_call) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 235, in handle_service return await service.entity_service_call( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 876, in entity_service_call response_data = await _handle_entity_call( ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 948, in _handle_entity_call result = await task ^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/idasen_desk/cover.py", line 95, in async_set_cover_position await self._desk.move_to(int(kwargs[ATTR_POSITION])) File "/usr/local/lib/python3.11/site-packages/idasen_ha/init.py", line 82, in move_to await self._idasen_desk.move_to_target(height) File "/usr/local/lib/python3.11/site-packages/idasen/init.py", line 327, in move_to_target await self._move_task File "/usr/local/lib/python3.11/site-packages/idasen/init.py", line 303, in do_move height = await self.get_height() ^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/idasen/init.py", line 363, in get_height return _bytes_to_meters(await self._client.read_gatt_char(_UUID_HEIGHT)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/bleak/init.py", line 711, in read_gatt_char return await self._backend.read_gatt_char(char_specifier, *kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/esphome/bluetooth/client.py", line 86, in _async_wrap_bluetooth_connected_operation return await func(self, args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/esphome/bluetooth/client.py", line 122, in _async_wrap_bluetooth_operation raise BleakError(str(ex)) from ex bleak.exc.BleakError: Bluetooth GATT Error address=DB:0A:3A:94:F1:E9 handle=29 error=133 description=Error
Where have you seen E16? Does your desk controller have a display? What model is your desk?
Sorry, yes... it's the Linak DPG1C32 desk controller on an ikea desk
Same problem here, DESK dissconents after approximately 2-3 hours based on history. Need to re-pair/reload after that. I am using Bluetooth built-in into RPI 4B
@LGH531 what is your Bluetooth radio?
@LGH531 what is your Bluetooth radio?
On the HA side? It’s an ESP32 Bluetooth Proxy
I have the same problem on HAOS + RPi 4 with built-in radio, placed directly under the Idasen desk. Connection is lost reproducibly after every reboot, after which I need to re-pair and reload the integration to reconnect the desk.
~It may also lose the connection after about 48 hours, but I wasn't able to validate that yet (couldn't exclude reboots).~ Seems like mine only loses the connection on reboot (now connected 6 days since last reboot, without using the table or sending any commands).
Even if I don't have a "IKEA" branded desk. My Desk has the same linak controller as @LGH531 Also using ESP32 as BT Proxy. Setup was successful and desk also was immediately recognized as "IKEA Idasen". But when I try to use it I get the same problem "E16". According to LINAK manual it seems to be an input error (wrong key pressed)
First off THANK YOU for creating this, filled a gap I was missing. Second, using HAOS on Proxmox, ESP32 for Bluetooth <10ft from my Idasen desk, the Bluetooth connection drops randomly several times a day. I created an automation to reload the IKEA integration when this happens and it works fine 95% of the time.
@bstephens16 can you share how your automation looks? I'll be happy to use it as workaround as well up until there is a proper fix for it in the official integration.
Before the official one I used to use the unofficial one for ESP32 (github://j5lien/esphome-idasen-desk-controller@v1.2.3), it did not face such problems, I guess it was more aggressive with reconnecting back to the desk.
I also have this issue on my IKEA desk and had it previously with esphome-idasen-desk-controller as well.
The next release of HA should already include some improvements to automatically reconnect
@bstephens16 can you share how your automation looks? I'll be happy to use it as workaround as well up until there is a proper fix for it in the official integration.
Before the official one I used to use the unofficial one for ESP32 (github://j5lien/esphome-idasen-desk-controller@v1.2.3), it did not face such problems, I guess it was more aggressive with reconnecting back to the desk.
Sure, here you go!
Unfortunately issue seem to be still there as per Release 2023.10.5 - October 22, still disconnects after a while
Unfortunately issue seem to be still there as per Release 2023.10.5 - October 22, still disconnects after a while
The improvements are only in 2023.11
Thanks @bstephens16. For those of us that prefer YAML. I am going to be testing this.
- alias: Study Desk Unavailable
id: study_desk_unavailable
trigger:
- platform: state
entity_id: cover.study_desk
to: 'unavailable'
for:
seconds: 5
- platform: state
entity_id: cover.study_desk
to: 'unknown'
for:
seconds: 5
action:
- service: homeassistant.reload_config_entry
target:
entity_id: cover.study_desk
Before the official one I used to use the unofficial one for ESP32 (github://j5lien/esphome-idasen-desk-controller@v1.2.3), it did not face such problems, I guess it was more aggressive with reconnecting back to the desk.
I also used this. From looking at the logs it crashed when it disconnected which caused a restart :) Which effectively is what we wanted!
Seems like with the new update 11.0 it is even quicker to disconnect itself, it dies within 30 minutes for me. However old ESP32 custom version still works without issues.
Seems like with the new update 11.0 it is even quicker to disconnect itself, it dies within 30 minutes for me. However old ESP32 custom version still works without issues.
Please enable the following debug logs and share them when that happens again:
service: logger.set_level
data:
idasen_ha: debug
idasen: debug
bleak: debug
homeassistant.components.idasen_desk: debug
homeassistant.components.esphome.bluetooth: debug
Without logs, it is hard to know what is happening. Also, can you try using ESPHome Bluetooth Proxy instead? Builtin bluetooth is very buggy at the moment.
In HA 2023.11.0 I still need to repair after every HA restart. The are these warnings in the logs:
Logger: idasen_ha.connection_manager
Source: components/idasen_desk/__init__.py:59
First occurred: 4:28:16 PM (1 occurrences)
Last logged: 4:28:16 PM
Connect failed
Logger: idasen_ha.connection_manager
Source: runner.py:188
First occurred: 4:29:28 PM (4 occurrences)
Last logged: 4:33:04 PM
Connect failed
Logger: idasen
Source: runner.py:188
First occurred: 4:28:56 PM (17 occurrences)
Last logged: 4:33:44 PM
[<BT address>] Failed to connect, retrying (1/3)...
[<BT address>] Failed to connect, retrying (2/3)...
[<BT address>] Failed to connect, retrying (3/3)...
[<BT address>] Connection failed
In contrast to 2023.10, the integration itself initializes successfully, but the desk entity is unavailable. If I enter pairing mode on the desk controller, it eventually reconnects and works. If I reload the integration, the desk is again unavailable, and I need to repair again to get it working.
In HA 2023.11.0 I still need to repair after every HA restart. The are these warnings in the logs:
Logger: idasen_ha.connection_manager Source: components/idasen_desk/__init__.py:59 First occurred: 4:28:16 PM (1 occurrences) Last logged: 4:28:16 PM Connect failed
Logger: idasen_ha.connection_manager Source: runner.py:188 First occurred: 4:29:28 PM (4 occurrences) Last logged: 4:33:04 PM Connect failed
Logger: idasen Source: runner.py:188 First occurred: 4:28:56 PM (17 occurrences) Last logged: 4:33:44 PM [<BT address>] Failed to connect, retrying (1/3)... [<BT address>] Failed to connect, retrying (2/3)... [<BT address>] Failed to connect, retrying (3/3)... [<BT address>] Connection failed
In contrast to 2023.10, the integration itself initializes successfully, but the desk entity is unavailable. If I enter pairing mode on the desk controller, it eventually reconnects and works. If I reload the integration, the desk is again unavailable, and I need to repair again to get it working.
Please enable the following debug logs and share them when that happens again:
service: logger.set_level
data:
idasen_ha: debug
idasen: debug
bleak: debug
homeassistant.components.idasen_desk: debug
homeassistant.components.esphome.bluetooth: debug
Also, can you try using ESPHome Bluetooth Proxy instead? Builtin bluetooth is very buggy at the moment.
Logs with integration reload: home-assistant_2023-11-02T15-59-18.518Z.log
Also, can you try using ESPHome Bluetooth Proxy instead?
No, sorry.
Builtin bluetooth is very buggy at the moment.
Do you have a reference to a related issue?
Logs with integration reload: home-assistant_2023-11-02T15-59-18.518Z.log
Also, can you try using ESPHome Bluetooth Proxy instead?
No, sorry.
Builtin bluetooth is very buggy at the moment.
Do you have a reference to a related issue?
After checking the logs, I suspect that this may be due to the auth agent issues. IIRC I had the same error if there was no agent running. You can try using bluetoothctl to pair and trust the desk, and see if the problem persists.
Thanks, that solved it! I SSHed into the HAOS host and executed bluetoothctl pair <Desk-Address>
a few times while entering pairing mode on the desk controller, until it appeared in bluetoothctl devices Paired
. Now the pairing is retained through integration reloads, HA restarts, HAOS restarts, and HAOS upgrade (from 11.0 to 11.1).
Thanks, that solved it! I SSHed into the HAOS host and executed
bluetoothctl pair <Desk-Address>
a few times while entering pairing mode on the desk controller, until it appeared inbluetoothctl devices Paired
. Now the pairing is retained through integration reloads, HA restarts, HAOS restarts, and HAOS upgrade (from 11.0 to 11.1).
Great! Thanks for the feedback. Could you add that info to the integration documentation? Maybe replacing the part where it mentions keeping the agent open with the suggestion to pair it manually as you did.
I left the existing description and added mine specifically for a Raspi+HAOS setup. I don't know if this is valid on other systems and whether it really replaces the agent-based approach. Feel free to edit the PR to your liking. https://github.com/home-assistant/home-assistant.io/pull/29686
I'm running an esp32 as bluetooth proxy and turned on the extra debug logging as suggested. Here is what was logged until about 20 minutes after the status changed to 'unavailable'
2023-11-03 15:21:03.276 DEBUG (MainThread) [homeassistant.components.esphome.bluetooth.client] Bluetooth Proxy [48:e7:29:b5:b8:58]: Idasen - CC:EF:37:32:25:A5: Connection state changed to connected=False mtu=0 error=8
2023-11-03 15:21:03.276 DEBUG (MainThread) [homeassistant.components.esphome.bluetooth.client] Bluetooth Proxy [48:e7:29:b5:b8:58]: Idasen - CC:EF:37:32:25:A5: BLE device disconnected
2023-11-03 15:21:03.276 DEBUG (MainThread) [idasen_ha.connection_manager] Disconnect callback called
2023-11-03 15:21:03.276 DEBUG (MainThread) [idasen_ha] Disconnect callback called
2023-11-03 15:21:03.276 DEBUG (MainThread) [homeassistant.components.idasen_desk] Desk disconnected. Reconnecting
2023-11-03 15:21:03.276 DEBUG (MainThread) [homeassistant.components.idasen_desk] Manually updated Idasen data
2023-11-03 15:21:03.277 DEBUG (MainThread) [homeassistant.components.esphome.bluetooth.device] esp32-bluetooth-proxy-b5b858 [48:E7:29:B5:B8:58]: BLE connection limits: used=1 free=2 limit=3
2023-11-03 15:21:03.277 DEBUG (MainThread) [homeassistant.components.idasen_desk] Trying to connect CC:EF:37:32:25:A5
2023-11-03 15:35:14.897 WARNING (MainThread) [aioesphomeapi.connection] esp32-bluetooth-proxy-b5b858 @ 192.168.1.19: Connection error occurred: esp32-bluetooth-proxy-b5b858 @ 192.168.1.19: EOF received
2023-11-03 15:35:14.903 DEBUG (MainThread) [homeassistant.components.esphome.bluetooth.client] Bluetooth Proxy [48:e7:29:b5:b8:58]: Idasen - CC:EF:37:32:25:A5: ESP device disconnected
2023-11-03 15:35:14.903 DEBUG (MainThread) [homeassistant.components.esphome.bluetooth.client] Bluetooth Proxy [48:e7:29:b5:b8:58]: Idasen - CC:EF:37:32:25:A5: ESP device disconnected
2023-11-03 15:35:15.994 DEBUG (MainThread) [homeassistant.components.esphome.bluetooth] Bluetooth Proxy [48:e7:29:b5:b8:58]: Connecting scanner feature_flags=63, connectable=True
2023-11-03 15:35:16.094 DEBUG (MainThread) [homeassistant.components.esphome.bluetooth.device] esp32-bluetooth-proxy-b5b858 [48:E7:29:B5:B8:58]: BLE connection limits: used=0 free=3 limit=3
I also have a LD2410 presence sensor connected over bluetooth using the same proxy and it's status did not change.
EDIT: I don't think the last 5 lines are relevant. I waited for it to disconnect again and this time only the first 8 lines were logged.
I'm running an esp32 as bluetooth proxy and turned on the extra debug logging as suggested. Here is what was logged until about 20 minutes after the status changed to 'unavailable'
2023-11-03 15:21:03.276 DEBUG (MainThread) [homeassistant.components.esphome.bluetooth.client] Bluetooth Proxy [48:e7:29:b5:b8:58]: Idasen - CC:EF:37:32:25:A5: Connection state changed to connected=False mtu=0 error=8 2023-11-03 15:21:03.276 DEBUG (MainThread) [homeassistant.components.esphome.bluetooth.client] Bluetooth Proxy [48:e7:29:b5:b8:58]: Idasen - CC:EF:37:32:25:A5: BLE device disconnected 2023-11-03 15:21:03.276 DEBUG (MainThread) [idasen_ha.connection_manager] Disconnect callback called 2023-11-03 15:21:03.276 DEBUG (MainThread) [idasen_ha] Disconnect callback called 2023-11-03 15:21:03.276 DEBUG (MainThread) [homeassistant.components.idasen_desk] Desk disconnected. Reconnecting 2023-11-03 15:21:03.276 DEBUG (MainThread) [homeassistant.components.idasen_desk] Manually updated Idasen data 2023-11-03 15:21:03.277 DEBUG (MainThread) [homeassistant.components.esphome.bluetooth.device] esp32-bluetooth-proxy-b5b858 [48:E7:29:B5:B8:58]: BLE connection limits: used=1 free=2 limit=3 2023-11-03 15:21:03.277 DEBUG (MainThread) [homeassistant.components.idasen_desk] Trying to connect CC:EF:37:32:25:A5 2023-11-03 15:35:14.897 WARNING (MainThread) [aioesphomeapi.connection] esp32-bluetooth-proxy-b5b858 @ 192.168.1.19: Connection error occurred: esp32-bluetooth-proxy-b5b858 @ 192.168.1.19: EOF received 2023-11-03 15:35:14.903 DEBUG (MainThread) [homeassistant.components.esphome.bluetooth.client] Bluetooth Proxy [48:e7:29:b5:b8:58]: Idasen - CC:EF:37:32:25:A5: ESP device disconnected 2023-11-03 15:35:14.903 DEBUG (MainThread) [homeassistant.components.esphome.bluetooth.client] Bluetooth Proxy [48:e7:29:b5:b8:58]: Idasen - CC:EF:37:32:25:A5: ESP device disconnected 2023-11-03 15:35:15.994 DEBUG (MainThread) [homeassistant.components.esphome.bluetooth] Bluetooth Proxy [48:e7:29:b5:b8:58]: Connecting scanner feature_flags=63, connectable=True 2023-11-03 15:35:16.094 DEBUG (MainThread) [homeassistant.components.esphome.bluetooth.device] esp32-bluetooth-proxy-b5b858 [48:E7:29:B5:B8:58]: BLE connection limits: used=0 free=3 limit=3
I also have a LD2410 presence sensor connected over bluetooth using the same proxy and it's status did not change.
EDIT: I don't think the last 5 lines are relevant. I waited for it to disconnect again and this time only the first 8 lines were logged.
The logs don't tell that much, but the disconnection seems unrelated to the integration itself. Also, when the integration tries to connect again, it fails. Maybe a distance issue?
The esp32 was sitting on top of the desk I'm controlling, so I don't think it would be distance. I suppose it could be interference from the laptop or wifi router also on the desk.
There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.
Unfortunately, this issue is still there
The problem
IKEA Idasen Desk integration becomes “unavailable” after a period of time.
It appears the desk controller is going to sleep and making the device unavailable in Home Assistant
Manually waking the controller and then reloading the integration clears the issue however it appears as if some kind of “ping” or keep awake is required to prevent the controller going into sleep mode
What version of Home Assistant Core has the issue?
2023.10
What was the last working version of Home Assistant Core?
No response
What type of installation are you running?
Home Assistant OS
Integration causing the issue
IKEA Idasen Desk
Link to integration documentation on our website
No response
Diagnostics information
No response
Example YAML snippet
No response
Anything in the logs that might be useful for us?
No response
Additional information
No response