Linak desk controller

Hi all, heads up: noob question
I want to use the HACS Linak Desk Control card, which says it relies on the below integration by @j5lien

The page calls out that a dependency is an ESP32 device. Does anyone know if it needs to be a Bluetooth device? I assume yes…

Anyone here who has done this?..

Thanks!

2 Likes

All ESP32’s have bluetooth AFAIK.

I’ve been told the more recent ones have Bluetooth, earlier ones only have WiFi.

I just bought a board off eBay, should arrive before the weekend so I will be experimenting and learning more… I hope ESPHome makes the whole process even easier.

You may be thinking of the esp8266 which is an earlier and quite different model.

Indeed it needs to be a bluetooth device and won’t work with an ESP8266. This custom component requires an ESP32.

Thanks for your help and patience.

I got a device that identifies as ESP32-WROOM-32. I have configured it with ESPHome in HA and is up and running. part of the YAML is:
esphome:
name: bt_desk_bridge
platform: ESP32
board: esp32doit-devkit-v1

Assuming this is ok and the board is compatible, I have taken the config from j5lien’s github page and added it in my configuration.yaml

But i do get an error if i validate or try to restart:

Logger: homeassistant.loader
Source: custom_components/idasen_desk_controller/__init__.py:1
First occurred: 15:26:50 (16 occurrences)
Last logged: 15:34:37

Error loading custom_components.idasen_desk_controller. Make sure all dependencies are installed
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/loader.py", line 617, in _load_file
    module = importlib.import_module(path)
  File "/usr/local/lib/python3.8/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 783, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/config/custom_components/idasen_desk_controller/__init__.py", line 1, in <module>
    import esphome.codegen as cg
ModuleNotFoundError: No module named 'esphome.codegen' 

Folder structure is:

Am i missing the obvious?..
I setup the device and then i added the custom component afterwards. Do I need to recompile the code and flash the device again?

Also can you please clarify, the MAC address of the desk controller: you do mean the LINAK module’s mac address, right?

@IhorSyerkov could you please shed some light as I’m sure you have already done this? :wink:

Thanks in advance kind people!

It seems the custom component can’t load the esphome dependency, I don’t know why (my folder structure look like yours). You can try recompile and flash the device again.

Yes it is LINAK module’s mac address.

OK @j5lien, thanks for the advice.
I also figured out that the yaml needs to go in to the device’s yaml file, not the HA configuration.yaml file
So, I have a good, flashed device again, I can see the new entities in HA. Using the logs I found the mac address of my LINAK controller.
However the new problem is that it momentarily connects, gets some status, then all entities become unavailable :frowning: including the wifi connection to the ESP32…

Here’s the log dump:

[14:59:07][I][app:105]: ESPHome version 1.16.2 compiled on Mar 28 2021, 14:43:07
[14:59:07][C][wifi:443]: WiFi:
[14:59:07][C][wifi:303]:   SSID: [redacted]
[14:59:07][C][wifi:304]:   IP Address: 192.168.1.138
[14:59:07][C][wifi:306]:   BSSID: [redacted]
[14:59:07][C][wifi:307]:   Hostname: 'bt_desk_bridge'
[14:59:07][C][wifi:311]:   Signal strength: -58 dB ▂▄▆█
[14:59:07][C][wifi:315]:   Channel: 1
[14:59:07][C][wifi:316]:   Subnet: 255.255.255.0
[14:59:07][C][wifi:317]:   Gateway: 192.168.1.1
[14:59:07][C][wifi:318]:   DNS1: 202.142.142.142
[14:59:07][C][wifi:319]:   DNS2: 202.142.142.242
[14:59:07][C][logger:185]: Logger:
[14:59:07][C][logger:186]:   Level: DEBUG
[14:59:07][C][logger:187]:   Log Baud Rate: 115200
[14:59:07][C][logger:188]:   Hardware UART: UART0
[14:59:07][C][captive_portal:169]: Captive Portal:
[14:59:07][C][ota:029]: Over-The-Air Updates:
[14:59:07][C][ota:030]:   Address: bt_desk_bridge.local:3232
[14:59:07][W][ota:036]: Last Boot was an unhandled reset, will proceed to safe mode in 6 restarts
[14:59:07][C][api:095]: API Server:
[14:59:07][C][api:096]:   Address: bt_desk_bridge.local:6053
[14:59:07][C][idasen_desk_controller:096]: Idasen Desk Controller:
[14:59:07][C][idasen_desk_controller:097]:   Mac address: C1:8D:B2:E2:B3:DF
[14:59:07][C][idasen_desk_controller:098]:   Desk height 'Desk Height'
[14:59:07][C][idasen_desk_controller:098]:     Unit of Measurement: 'cm'
[14:59:07][C][idasen_desk_controller:098]:     Accuracy Decimals: 0
[14:59:07][C][idasen_desk_controller:098]:     Icon: 'mdi:arrow-up-down'
[14:59:07][C][idasen_desk_controller:099]:   Desk moving 'Desk Moving'
[14:59:07][C][idasen_desk_controller:099]:     Device Class: 'moving'
[14:59:07][C][idasen_desk_controller:100]:   Desk connection 'Desk Connection'
[14:59:07][C][idasen_desk_controller:100]:     Device Class: 'connectivity'
[14:59:07][C][idasen_desk_controller:101]:   Desk 'Desk'
[14:59:07][C][idasen_desk_controller:109]: Start scanning devices...
[14:59:07][C][idasen_desk_controller:052]: BLE Device found: Name: KW Desk, Address: c1:8d:b2:e2:b3:df, serviceUUID: 99fa0001-338a-1024-8a49-009c0215f78a, txPower: 4
[14:59:08][C][idasen_desk_controller:119]: Connecting client to device c1:8d:b2:e2:b3:df
[14:59:08][D][binary_sensor:036]: 'Desk Connection': Sending state ON
[14:59:08][C][idasen_desk_controller:129]: Retrieve input remote characteristic.
[14:59:10][C][idasen_desk_controller:134]: Retrieve output remote characteristic.
[14:59:10][C][idasen_desk_controller:137]: Register notification callback on output characteristic.
ERROR Error while reading incoming messages: Error while receiving data: [Errno 104] Connection reset by peer
WARNING Disconnected from API: Error while receiving data: [Errno 104] Connection reset by peer
INFO Connecting to bt_desk_bridge.local:6053 (192.168.1.138)
WARNING Couldn't connect to API (Timeout while waiting for message response!). Trying to reconnect in 1 seconds
INFO Connecting to bt_desk_bridge.local:6053 (192.168.1.138)
WARNING Couldn't connect to API (Timeout while waiting for message response!). Trying to reconnect in 1 seconds
INFO Connecting to bt_desk_bridge.local:6053 (192.168.1.138)
WARNING Couldn't connect to API (Timeout while waiting for message response!). Trying to reconnect in 2 seconds
INFO Connecting to bt_desk_bridge.local:6053 (192.168.1.138)
WARNING Couldn't connect to API (Timeout while waiting for message response!). Trying to reconnect in 3 seconds

Have you try to activate wifi fast connect option ?
I also experienced deconnection issue and it fixed it


Hello,

I have some WiFi problems too. I already tried Fast Connection (and other options). Unfortunately without success so far.

Via the USB interface, I can see from the log that the communication with the table works correctly.

However, the WiFi does not seem to work. Via the USB log interface I can see that the connection to the WiFi was established. But a connection from the home-assitant can only be established for a short time (inclusion of the ESP32 is possible). Then there is a kind of reboot loop. The ESP32 constantly establishes a new connection to the WiFi.

Without the idasen_desk_controller the WiFi works again without any problems. So a WiFi related hardware problem can probably be ruled out.

It looks like my boards can’t run WiFi and Bluetooth together very well. I have a NodeMCU ESP32 and a AZ-Delivery ESP-32 Dev Kit C V4. Both with the same behavior.

@j5lien: If you could please tell me which board you are using, I would buy that one and test if the board can be blamed for these connection problems.

I use a NodeMCU ESP32 board.

When using the USB log interface, do you see any crashes ?

Not really. At least I don’t see any relevant information. I’ve attached a log for you. Maybe you can see more.

In the log file you can see that every time the API is accessed (or something else?) the WiFi reboots.

At 17:54:28 I pressed the reset button on the ESP32.

Do you have a tip what I could try next? :wink:

Log

INFO Reading configuration config/test.yaml...
INFO Generating C++ source...
INFO Compiling app...
INFO Running:  platformio run -d config/test
Processing test (board: esp32dev; framework: arduino; platform: [email protected])
--------------------------------------------------------------------------------
HARDWARE: ESP32 240MHz, 320KB RAM, 4MB Flash
PACKAGES: 
 - framework-arduinoespressif32 3.10004.210126 (1.0.4) 
 - tool-esptoolpy 1.20600.0 (2.6.0) 
 - toolchain-xtensa32 2.50200.97 (5.2.0)
Library Manager: Installing Hash
Warning! Could not find the package with 'Hash' requirements for your system 'darwin_x86_64'
Dependency Graph
|-- <AsyncTCP-esphome> 1.1.1
|-- <ESPmDNS> 1.0
|   |-- <WiFi> 1.0
|-- <ESP32 BLE Arduino> 1.0.1
|-- <Update> 1.0
|-- <WiFi> 1.0
Retrieving maximum program size .pioenvs/test/firmware.elf
Checking size .pioenvs/test/firmware.elf
RAM:   [==        ]  18.5% (used 60724 bytes from 327680 bytes)
Flash: [========  ]  82.0% (used 1505006 bytes from 1835008 bytes)
========================= [SUCCESS] Took 2.20 seconds =========================
INFO Successfully compiled program.
INFO Running:  platformio run -d config/test -t upload --upload-port /dev/cu.usbserial-0001
Processing test (board: esp32dev; framework: arduino; platform: [email protected])
--------------------------------------------------------------------------------
HARDWARE: ESP32 240MHz, 320KB RAM, 4MB Flash
PACKAGES: 
 - framework-arduinoespressif32 3.10004.210126 (1.0.4) 
 - tool-esptoolpy 1.20600.0 (2.6.0) 
 - tool-mkspiffs 2.230.0 (2.30) 
 - toolchain-xtensa32 2.50200.97 (5.2.0)
Library Manager: Installing Hash
Warning! Could not find the package with 'Hash' requirements for your system 'darwin_x86_64'
Dependency Graph
|-- <AsyncTCP-esphome> 1.1.1
|-- <ESPmDNS> 1.0
|   |-- <WiFi> 1.0
|-- <ESP32 BLE Arduino> 1.0.1
|-- <Update> 1.0
|-- <WiFi> 1.0
Retrieving maximum program size .pioenvs/test/firmware.elf
Checking size .pioenvs/test/firmware.elf
RAM:   [==        ]  18.5% (used 60724 bytes from 327680 bytes)
Flash: [========  ]  82.0% (used 1505006 bytes from 1835008 bytes)
Configuring upload protocol...
AVAILABLE: esp-prog, espota, esptool, iot-bus-jtag, jlink, minimodule, olimex-arm-usb-ocd, olimex-arm-usb-ocd-h, olimex-arm-usb-tiny-h, olimex-jtag-tiny, tumpa
CURRENT: upload_protocol = esptool
Looking for upload port...
Use manually specified: /dev/cu.usbserial-0001
Uploading .pioenvs/test/firmware.bin
Serial port /dev/cu.usbserial-0001
Connecting.....
Chip is ESP32D0WDQ6 (revision 1)
Features: WiFi, BT, Dual Core, 240MHz, VRef calibration in efuse, Coding Scheme None
MAC: 24:62:ab:fc:9a:1c
Uploading stub...
Running stub...
Stub running...
Configuring flash size...
Auto-detected Flash size: 4MB
Compressed 15872 bytes to 10319...

Writing at 0x00001000... (100 %)
Wrote 15872 bytes (10319 compressed) at 0x00001000 in 0.9 seconds (effective 138.8 kbit/s)...
Hash of data verified.
Compressed 3072 bytes to 144...

Writing at 0x00008000... (100 %)
Wrote 3072 bytes (144 compressed) at 0x00008000 in 0.0 seconds (effective 1438.8 kbit/s)...
Hash of data verified.
Compressed 8192 bytes to 47...

Writing at 0x0000e000... (100 %)
Wrote 8192 bytes (47 compressed) at 0x0000e000 in 0.0 seconds (effective 7312.1 kbit/s)...
Hash of data verified.
Compressed 1505120 bytes to 872774...

Writing at 0x00010000... (1 %)
Writing at 0x00014000... (3 %)
Writing at 0x00018000... (5 %)
Writing at 0x0001c000... (7 %)
Writing at 0x00020000... (9 %)
Writing at 0x00024000... (11 %)
Writing at 0x00028000... (12 %)
Writing at 0x0002c000... (14 %)
Writing at 0x00030000... (16 %)
Writing at 0x00034000... (18 %)
Writing at 0x00038000... (20 %)
Writing at 0x0003c000... (22 %)
Writing at 0x00040000... (24 %)
Writing at 0x00044000... (25 %)
Writing at 0x00048000... (27 %)
Writing at 0x0004c000... (29 %)
Writing at 0x00050000... (31 %)
Writing at 0x00054000... (33 %)
Writing at 0x00058000... (35 %)
Writing at 0x0005c000... (37 %)
Writing at 0x00060000... (38 %)
Writing at 0x00064000... (40 %)
Writing at 0x00068000... (42 %)
Writing at 0x0006c000... (44 %)
Writing at 0x00070000... (46 %)
Writing at 0x00074000... (48 %)
Writing at 0x00078000... (50 %)
Writing at 0x0007c000... (51 %)
Writing at 0x00080000... (53 %)
Writing at 0x00084000... (55 %)
Writing at 0x00088000... (57 %)
Writing at 0x0008c000... (59 %)
Writing at 0x00090000... (61 %)
Writing at 0x00094000... (62 %)
Writing at 0x00098000... (64 %)
Writing at 0x0009c000... (66 %)
Writing at 0x000a0000... (68 %)
Writing at 0x000a4000... (70 %)
Writing at 0x000a8000... (72 %)
Writing at 0x000ac000... (74 %)
Writing at 0x000b0000... (75 %)
Writing at 0x000b4000... (77 %)
Writing at 0x000b8000... (79 %)
Writing at 0x000bc000... (81 %)
Writing at 0x000c0000... (83 %)
Writing at 0x000c4000... (85 %)
Writing at 0x000c8000... (87 %)
Writing at 0x000cc000... (88 %)
Writing at 0x000d0000... (90 %)
Writing at 0x000d4000... (92 %)
Writing at 0x000d8000... (94 %)
Writing at 0x000dc000... (96 %)
Writing at 0x000e0000... (98 %)
Writing at 0x000e4000... (100 %)
Wrote 1505120 bytes (872774 compressed) at 0x00010000 in 77.1 seconds (effective 156.1 kbit/s)...
Hash of data verified.

Leaving...
Hard resetting via RTS pin...
========================= [SUCCESS] Took 84.33 seconds =========================
INFO Successfully uploaded program.
INFO Starting log output from /dev/cu.usbserial-0001 with baud rate 115200
[17:53:16]:1044
[17:53:16]load:\x82\xba‚\x82\x82bb\x95\xb9\xe98896
[17:53:16]load:0x40080400,len:5828
[17:53:16]entry 0x400806ac
[17:53:16][I][logger:166]: Log initialized
[17:53:16][C][ota:366]: There have been 0 suspected unsuccessful boot attempts.
[17:53:17][I][app:029]: Running through setup()...
[17:53:17][C][wifi:033]: Setting up WiFi...
[17:53:17][I][wifi:194]: WiFi Connecting to 'PlakPort!'...
[17:53:19][I][wifi:457]: WiFi Connected!
[17:53:19][C][wifi:303]:   SSID: [redacted]
[17:53:19][C][wifi:304]:   IP Address: 192.168.1.141
[17:53:19][C][wifi:306]:   BSSID: [redacted]
[17:53:19][C][wifi:307]:   Hostname: 'test'
[17:53:19][C][wifi:311]:   Signal strength: -62 dB ▂▄▆█
[17:53:19][C][wifi:315]:   Channel: 1
[17:53:19][C][wifi:316]:   Subnet: 255.255.255.0
[17:53:19][C][wifi:317]:   Gateway: 192.168.1.1
[17:53:19][C][wifi:318]:   DNS1: 192.168.1.190
[17:53:19][C][wifi:319]:   DNS2: 0.0.0.0
[17:53:19][C][ota:029]: Over-The-Air Updates:
[17:53:19][C][ota:030]:   Address: test.local:3232
[17:53:19][C][api:022]: Setting up Home Assistant API server...
[17:53:19][C][idasen_desk_controller:077]: Setting up Idasen Desk Controller...
[17:53:19][D][binary_sensor:036]: 'Desk Connection': Sending state OFF
[17:53:20][I][app:059]: setup() finished successfully!
[17:53:20][I][app:105]: ESPHome version 1.16.2 compiled on Apr  5 2021, 17:50:56
[17:53:20][C][wifi:443]: WiFi:
[17:53:20][C][wifi:303]:   SSID: [redacted]
[17:53:20][C][wifi:304]:   IP Address: 192.168.1.141
[17:53:20][C][wifi:306]:   BSSID: [redacted]
[17:53:20][C][wifi:307]:   Hostname: 'test'
[17:53:20][C][wifi:311]:   Signal strength: -62 dB ▂▄▆█
[17:53:20][C][wifi:315]:   Channel: 1
[17:53:20][C][wifi:316]:   Subnet: 255.255.255.0
[17:53:20][C][wifi:317]:   Gateway: 192.168.1.1
[17:53:20][C][wifi:318]:   DNS1: 192.168.1.190
[17:53:20][C][wifi:319]:   DNS2: 0.0.0.0
[17:53:20][C][logger:185]: Logger:
[17:53:20][C][logger:186]:   Level: DEBUG
[17:53:20][C][logger:187]:   Log Baud Rate: 115200
[17:53:20][C][logger:188]:   Hardware UART: UART0
[17:53:20][C][ota:029]: Over-The-Air Updates:
[17:53:20][C][ota:030]:   Address: test.local:3232
[17:53:20][C][api:095]: API Server:
[17:53:20][C][api:096]:   Address: test.local:6053
[17:53:20][C][idasen_desk_controller:096]: Idasen Desk Controller:
[17:53:20][C][idasen_desk_controller:097]:   Mac address: D5:87:C1:46:3C:ED
[17:53:20][C][idasen_desk_controller:098]:   Desk height 'Desk Height'
[17:53:20][C][idasen_desk_controller:098]:     Unit of Measurement: 'cm'
[17:53:20][C][idasen_desk_controller:098]:     Accuracy Decimals: 0
[17:53:20][C][idasen_desk_controller:098]:     Icon: 'mdi:arrow-up-down'
[17:53:20][C][idasen_desk_controller:099]:   Desk moving 'Desk Moving'
[17:53:20][C][idasen_desk_controller:099]:     Device Class: 'moving'
[17:53:20][C][idasen_desk_controller:100]:   Desk connection 'Desk Connection'
[17:53:20][C][idasen_desk_controller:100]:     Device Class: 'connectivity'
[17:53:20][C][idasen_desk_controller:101]:   Desk 'Desk'
[17:53:21][C][idasen_desk_controller:109]: Start scanning devices...
[17:53:21][C][idasen_desk_controller:052]: BLE Device found: Name: LinakUpstairsOffi, Address: d5:87:c1:46:3c:ed, serviceUUID: 99fa0001-338a-1024-8a49-009c0215f78a, txPower: 4
[17:53:21][C][idasen_desk_controller:119]: Connecting client to device d5:87:c1:46:3c:ed
[17:53:21][D][binary_sensor:036]: 'Desk Connection': Sending state ON
[17:53:21][C][idasen_desk_controller:129]: Retrieve input remote characteristic.
[17:53:23][E][BLERemoteCharacteristic.cpp:274] retrieveDescriptors(): esp_ble_gattc_get_all_descr: Unknown
[17:53:23][E][BLERemoteCharacteristic.cpp:274] retrieveDescriptors(): esp_ble_gattc_get_all_descr: Unknown
[17:53:23][E][BLERemoteCharacteristic.cpp:274] retrieveDescriptors(): esp_ble_gattc_get_all_descr: Unknown
[17:53:23][E][BLERemoteCharacteristic.cpp:274] retrieveDescriptors(): esp_ble_gattc_get_all_descr: Unknown
[17:53:23][C][idasen_desk_controller:134]: Retrieve output remote characteristic.
[17:53:23][E][BLERemoteCharacteristic.cpp:274] retrieveDescriptors(): esp_ble_gattc_get_all_descr: Unknown
[17:53:23][E][BLERemoteCharacteristic.cpp:274] retrieveDescriptors(): esp_ble_gattc_get_all_descr: Unknown
[17:53:23][C][idasen_desk_controller:137]: Register notification callback on output characteristic.
[17:53:23][C][idasen_desk_controller:143]: Retrieve control remote characteristic.
[17:53:23][E][BLERemoteCharacteristic.cpp:274] retrieveDescriptors(): esp_ble_gattc_get_all_descr: Unknown
[17:53:23][C][idasen_desk_controller:148]: Success connecting client to device
[17:53:28][D][binary_sensor:036]: 'Desk Moving': Sending state OFF
[17:53:28][D][sensor:092]: 'Desk Height': Sending state 19.00000 cm with 0 decimals of accuracy
[17:53:28][D][cover:152]: 'Desk' - Publishing:
[17:53:28][D][cover:155]:   Position: 29%
[17:53:28][D][cover:168]:   Current Operation: IDLE
[17:53:34][D][binary_sensor:036]: 'Desk Moving': Sending state ON
[17:53:34][D][sensor:092]: 'Desk Height': Sending state 20.00000 cm with 0 decimals of accuracy
[17:53:34][D][cover:152]: 'Desk' - Publishing:
[17:53:34][D][cover:155]:   Position: 31%
[17:53:34][D][cover:168]:   Current Operation: IDLE
[17:53:35][D][sensor:092]: 'Desk Height': Sending state 21.00000 cm with 0 decimals of accuracy
[17:53:35][D][cover:152]: 'Desk' - Publishing:
[17:53:35][D][cover:155]:   Position: 32%
[17:53:35][D][cover:168]:   Current Operation: IDLE
[17:53:35][D][sensor:092]: 'Desk Height': Sending state 22.00000 cm with 0 decimals of accuracy
[17:53:35][D][cover:152]: 'Desk' - Publishing:
[17:53:35][D][cover:155]:   Position: 34%
[17:53:35][D][cover:168]:   Current Operation: IDLE
[17:53:35][D][sensor:092]: 'Desk Height': Sending state 23.00000 cm with 0 decimals of accuracy
[17:53:35][D][cover:152]: 'Desk' - Publishing:
[17:53:35][D][cover:155]:   Position: 35%
[17:53:35][D][cover:168]:   Current Operation: IDLE
[17:53:35][D][sensor:092]: 'Desk Height': Sending state 24.00000 cm with 0 decimals of accuracy
[17:53:35][D][cover:152]: 'Desk' - Publishing:
[17:53:35][D][cover:155]:   Position: 37%
[17:53:35][D][cover:168]:   Current Operation: IDLE
[17:53:36][D][binary_sensor:036]: 'Desk Moving': Sending state OFF
[17:53:36][D][binary_sensor:036]: 'Desk Moving': Sending state ON
[17:53:36][D][sensor:092]: 'Desk Height': Sending state 23.00000 cm with 0 decimals of accuracy
[17:53:36][D][cover:152]: 'Desk' - Publishing:
[17:53:36][D][cover:155]:   Position: 35%
[17:53:36][D][cover:168]:   Current Operation: IDLE
[17:53:37][D][sensor:092]: 'Desk Height': Sending state 22.00000 cm with 0 decimals of accuracy
[17:53:37][D][cover:152]: 'Desk' - Publishing:
[17:53:37][D][cover:155]:   Position: 34%
[17:53:37][D][cover:168]:   Current Operation: IDLE
[17:53:37][D][sensor:092]: 'Desk Height': Sending state 21.00000 cm with 0 decimals of accuracy
[17:53:37][D][cover:152]: 'Desk' - Publishing:
[17:53:37][D][cover:155]:   Position: 32%
[17:53:37][D][cover:168]:   Current Operation: IDLE
[17:53:37][D][sensor:092]: 'Desk Height': Sending state 20.00000 cm with 0 decimals of accuracy
[17:53:37][D][cover:152]: 'Desk' - Publishing:
[17:53:37][D][cover:155]:   Position: 31%
[17:53:37][D][cover:168]:   Current Operation: IDLE
[17:53:38][D][sensor:092]: 'Desk Height': Sending state 19.00000 cm with 0 decimals of accuracy
[17:53:38][D][cover:152]: 'Desk' - Publishing:
[17:53:38][D][cover:155]:   Position: 29%
[17:53:38][D][cover:168]:   Current Operation: IDLE
[17:53:38][D][binary_sensor:036]: 'Desk Moving': Sending state OFF
[17:53:45][D][api.connection:604]: Client 'Home Assistant 2021.3.4 (192.168.1.93)' connected successfully!
[17:53:51][D][api:067]: Disconnecting Home Assistant 2021.3.4 (192.168.1.93)
[17:53:54][W][wifi_esp32:386]: Event: Disconnected ssid='PlakPort!' bssid=[redacted] reason='Beacon Timeout'
[17:53:54][W][wifi:100]: WiFi Connection lost... Reconnecting...
[17:53:54][W][wifi:522]: Restarting WiFi adapter...
[17:53:54][I][wifi:194]: WiFi Connecting to 'PlakPort!'...
[17:53:54][I][wifi:457]: WiFi Connected!
[17:53:54][C][wifi:303]:   SSID: [redacted]
[17:53:54][C][wifi:304]:   IP Address: 192.168.1.141
[17:53:54][C][wifi:306]:   BSSID: [redacted]
[17:53:54][C][wifi:307]:   Hostname: 'test'
[17:53:54][C][wifi:311]:   Signal strength: -67 dB ▂▄▆█
[17:53:54][C][wifi:315]:   Channel: 1
[17:53:54][C][wifi:316]:   Subnet: 255.255.255.0
[17:53:54][C][wifi:317]:   Gateway: 192.168.1.1
[17:53:54][C][wifi:318]:   DNS1: 192.168.1.190
[17:53:54][C][wifi:319]:   DNS2: 0.0.0.0
[17:54:28][W][wifi_esp32:386]: Event: Disconnected ssid='PlakPort!' bssid=[redacted] reason='Beacon Timeout'
[17:54:28][W][wifi:100]: WiFi Connection lost... Reconnecting...
[17:54:28][W][wifi:522]: Restarting WiFi adapter...
[17:54:28][I][wifi:194]: WiFi Connecting to 'PlakPort!'...
[17:54:28][D][esp-idf:000]: E (71471) phy_init: failed to allocate memory for RF calibration data
[17:54:28]
[17:54:28]abort() was called at PC 0x400ebaad on core 0
[17:54:28]
[17:54:28]Backtrace: 0x4009217c:0x3ffd28c0 0x400923ad:0x3ffd28e0 0x400ebaad:0x3ffd2900 0x4010a884:0x3ffd2930 0x4010a987:0x3ffd2960 0x4010aca6:0x3ffd2990 0x40106f56:0x3ffd29c0 0x400952cb:0x3ffd29e0 0x4008e8c5:0x3ffd2a20
WARNING Found stack trace! Trying to decode it
INFO Need to fetch platformio IDE-data, please stand by
INFO Running:  platformio run -d config/test -t idedata
WARNING Decoded 0x4009217c: invoke_abort at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/esp32/panic.c:707
WARNING Decoded 0x400923ad: abort at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/esp32/panic.c:707
WARNING Decoded 0x400ebaad: esp_phy_load_cal_and_init at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/esp32/phy_init.c:579 (discriminator 2)
WARNING Decoded 0x4010a884: wifi_rf_phy_enable
WARNING Decoded 0x4010a987: wifi_hw_start
WARNING Decoded 0x4010aca6: wifi_start_process
WARNING Decoded 0x40106f56: ieee80211_ioctl_process
WARNING Decoded 0x400952cb: ppTask
WARNING Decoded 0x4008e8c5: vPortTaskWrapper at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/freertos/port.c:355 (discriminator 1)
[17:54:29]
[17:54:29]Rebooting...
[17:54:29]ets Jun  8 2016 00:22:57
[17:54:29]
[17:54:29]rst:0xc (SW_CPU_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
[17:54:29]configsip: 0, SPIWP:0xee
[17:54:29]clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
[17:54:29]mode:DIO, clock div:2
[17:54:29]load:0x3fff0018,len:4
[17:54:29]load:0x3fff001c,len:1044
[17:54:29]load:0x40078000,len:8896
[17:54:29]load:0x40080400,len:5828
[17:54:29]entry 0x400806ac
[17:54:29][I][logger:166]: Log initialized
[17:54:29][C][ota:366]: There have been 1 suspected unsuccessful boot attempts.
[17:54:29][I][app:029]: Running through setup()...
[17:54:29][C][wifi:033]: Setting up WiFi...
[17:54:29][I][wifi:194]: WiFi Connecting to 'PlakPort!'...
[17:54:29][I][wifi:457]: WiFi Connected!
[17:54:29][C][wifi:303]:   SSID: [redacted]
[17:54:29][C][wifi:304]:   IP Address: 192.168.1.141
[17:54:29][C][wifi:306]:   BSSID: [redacted]
[17:54:29][C][wifi:307]:   Hostname: 'test'
[17:54:29][C][wifi:311]:   Signal strength: -68 dB ▂▄▆█
[17:54:29][C][wifi:315]:   Channel: 1
[17:54:29][C][wifi:316]:   Subnet: 255.255.255.0
[17:54:29][C][wifi:317]:   Gateway: 192.168.1.1
[17:54:29][C][wifi:318]:   DNS1: 192.168.1.190
[17:54:29][C][wifi:319]:   DNS2: 0.0.0.0
[17:54:29][C][ota:029]: Over-The-Air Updates:
[17:54:29][C][ota:030]:   Address: test.local:3232
[17:54:29][C][api:022]: Setting up Home Assistant API server...
[17:54:29][C][idasen_desk_controller:077]: Setting up Idasen Desk Controller...
[17:54:29][D][binary_sensor:036]: 'Desk Connection': Sending state OFF
[17:54:30][I][app:059]: setup() finished successfully!
[17:54:30][I][app:105]: ESPHome version 1.16.2 compiled on Apr  5 2021, 17:50:56
[17:54:30][C][wifi:443]: WiFi:
[17:54:30][C][wifi:303]:   SSID: [redacted]
[17:54:30][C][wifi:304]:   IP Address: 192.168.1.141
[17:54:30][C][wifi:306]:   BSSID: [redacted]
[17:54:30][C][wifi:307]:   Hostname: 'test'
[17:54:30][C][wifi:311]:   Signal strength: -65 dB ▂▄▆█
[17:54:30][C][wifi:315]:   Channel: 1
[17:54:30][C][wifi:316]:   Subnet: 255.255.255.0
[17:54:30][C][wifi:317]:   Gateway: 192.168.1.1
[17:54:30][C][wifi:318]:   DNS1: 192.168.1.190
[17:54:30][C][wifi:319]:   DNS2: 0.0.0.0
[17:54:30][C][logger:185]: Logger:
[17:54:30][C][logger:186]:   Level: DEBUG
[17:54:30][C][logger:187]:   Log Baud Rate: 115200
[17:54:30][C][logger:188]:   Hardware UART: UART0
[17:54:30][C][ota:029]: Over-The-Air Updates:
[17:54:30][C][ota:030]:   Address: test.local:3232
[17:54:30][C][api:095]: API Server:
[17:54:30][C][api:096]:   Address: test.local:6053
[17:54:30][C][idasen_desk_controller:096]: Idasen Desk Controller:
[17:54:30][C][idasen_desk_controller:097]:   Mac address: D5:87:C1:46:3C:ED
[17:54:30][C][idasen_desk_controller:098]:   Desk height 'Desk Height'
[17:54:30][C][idasen_desk_controller:098]:     Unit of Measurement: 'cm'
[17:54:30][C][idasen_desk_controller:098]:     Accuracy Decimals: 0
[17:54:30][C][idasen_desk_controller:098]:     Icon: 'mdi:arrow-up-down'
[17:54:30][C][idasen_desk_controller:099]:   Desk moving 'Desk Moving'
[17:54:30][C][idasen_desk_controller:099]:     Device Class: 'moving'
[17:54:30][C][idasen_desk_controller:100]:   Desk connection 'Desk Connection'
[17:54:30][C][idasen_desk_controller:100]:     Device Class: 'connectivity'
[17:54:30][C][idasen_desk_controller:101]:   Desk 'Desk'
[17:54:31][C][idasen_desk_controller:109]: Start scanning devices...
[17:54:31][C][idasen_desk_controller:052]: BLE Device found: Name: , Address: 51:07:8f:91:30:c2, manufacturer data: 060001092002a910945ba73620197cc83c12d8be537aaf0f449fa2c901
[17:54:31][C][idasen_desk_controller:052]: BLE Device found: Name: LinakUpstairsOffi, Address: d5:87:c1:46:3c:ed, txPower: -8
[17:54:31][C][idasen_desk_controller:119]: Connecting client to device d5:87:c1:46:3c:ed
[17:54:32][D][binary_sensor:036]: 'Desk Connection': Sending state ON
[17:54:32][C][idasen_desk_controller:129]: Retrieve input remote characteristic.
[17:54:34][E][BLERemoteCharacteristic.cpp:274] retrieveDescriptors(): esp_ble_gattc_get_all_descr: Unknown
[17:54:34][E][BLERemoteCharacteristic.cpp:274] retrieveDescriptors(): esp_ble_gattc_get_all_descr: Unknown
[17:54:34][E][BLERemoteCharacteristic.cpp:274] retrieveDescriptors(): esp_ble_gattc_get_all_descr: Unknown
[17:54:34][E][BLERemoteCharacteristic.cpp:274] retrieveDescriptors(): esp_ble_gattc_get_all_descr: Unknown
[17:54:34][C][idasen_desk_controller:134]: Retrieve output remote characteristic.
[17:54:34][E][BLERemoteCharacteristic.cpp:274] retrieveDescriptors(): esp_ble_gattc_get_all_descr: Unknown
[17:54:34][E][BLERemoteCharacteristic.cpp:274] retrieveDescriptors(): esp_ble_gattc_get_all_descr: Unknown
[17:54:34][C][idasen_desk_controller:137]: Register notification callback on output characteristic.
[17:54:34][C][idasen_desk_controller:143]: Retrieve control remote characteristic.
[17:54:34][E][BLERemoteCharacteristic.cpp:274] retrieveDescriptors(): esp_ble_gattc_get_all_descr: Unknown
[17:54:34][C][idasen_desk_controller:148]: Success connecting client to device
[17:54:39][D][binary_sensor:036]: 'Desk Moving': Sending state OFF
[17:54:51][W][wifi_esp32:386]: Event: Disconnected ssid='PlakPort!' bssid=[redacted] reason='Beacon Timeout'
[17:55:34][D][binary_sensor:036]: 'Desk Connection': Sending state OFF
[17:56:22]ets Jun  8 2016 00:22:57
[17:56:22]
[17:56:22]rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
[17:56:22]configsip: 0, SPIWP:0xee
[17:56:22]clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
[17:56:22]mode:DIO, clock div:2
[17:56:22]load:0x3fff0018,len:4
[17:56:22]load:0x3fff001c,len:1044
[17:56:22]load:0x40078000,len:8896
[17:56:22]load:0x40080400,len:5828
[17:56:22]entry 0x400806ac
[17:56:23][I][logger:166]: Log initialized
[17:56:23][C][ota:366]: There have been 2 suspected unsuccessful boot attempts.
[17:56:23][I][app:029]: Running through setup()...
[17:56:23][C][wifi:033]: Setting up WiFi...
[17:56:23][I][wifi:194]: WiFi Connecting to 'PlakPort!'...
[17:56:24][I][wifi:457]: WiFi Connected!
[17:56:24][C][wifi:303]:   SSID: [redacted]
[17:56:24][C][wifi:304]:   IP Address: 192.168.1.141
[17:56:24][C][wifi:306]:   BSSID: [redacted]
[17:56:24][C][wifi:307]:   Hostname: 'test'
[17:56:24][C][wifi:311]:   Signal strength: -65 dB ▂▄▆█
[17:56:24][C][wifi:315]:   Channel: 1
[17:56:24][C][wifi:316]:   Subnet: 255.255.255.0
[17:56:24][C][wifi:317]:   Gateway: 192.168.1.1
[17:56:24][C][wifi:318]:   DNS1: 192.168.1.190
[17:56:24][C][wifi:319]:   DNS2: 0.0.0.0
[17:56:24][C][ota:029]: Over-The-Air Updates:
[17:56:24][C][ota:030]:   Address: test.local:3232
[17:56:24][W][ota:036]: Last Boot was an unhandled reset, will proceed to safe mode in 8 restarts
[17:56:24][C][api:022]: Setting up Home Assistant API server...
[17:56:24][C][idasen_desk_controller:077]: Setting up Idasen Desk Controller...
[17:56:24][D][binary_sensor:036]: 'Desk Connection': Sending state OFF
[17:56:25][I][app:059]: setup() finished successfully!
[17:56:25][I][app:105]: ESPHome version 1.16.2 compiled on Apr  5 2021, 17:50:56
[17:56:25][C][wifi:443]: WiFi:
[17:56:25][C][wifi:303]:   SSID: [redacted]
[17:56:25][C][wifi:304]:   IP Address: 192.168.1.141
[17:56:25][C][wifi:306]:   BSSID: [redacted]
[17:56:25][C][wifi:307]:   Hostname: 'test'
[17:56:25][C][wifi:311]:   Signal strength: -65 dB ▂▄▆█
[17:56:25][C][wifi:315]:   Channel: 1
[17:56:25][C][wifi:316]:   Subnet: 255.255.255.0
[17:56:25][C][wifi:317]:   Gateway: 192.168.1.1
[17:56:25][C][wifi:318]:   DNS1: 192.168.1.190
[17:56:25][C][wifi:319]:   DNS2: 0.0.0.0
[17:56:25][C][logger:185]: Logger:
[17:56:25][C][logger:186]:   Level: DEBUG
[17:56:25][C][logger:187]:   Log Baud Rate: 115200
[17:56:25][C][logger:188]:   Hardware UART: UART0
[17:56:25][C][ota:029]: Over-The-Air Updates:
[17:56:25][C][ota:030]:   Address: test.local:3232
[17:56:25][W][ota:036]: Last Boot was an unhandled reset, will proceed to safe mode in 8 restarts
[17:56:25][C][api:095]: API Server:
[17:56:25][C][api:096]:   Address: test.local:6053
[17:56:25][C][idasen_desk_controller:096]: Idasen Desk Controller:
[17:56:25][C][idasen_desk_controller:097]:   Mac address: D5:87:C1:46:3C:ED
[17:56:25][C][idasen_desk_controller:098]:   Desk height 'Desk Height'
[17:56:25][C][idasen_desk_controller:098]:     Unit of Measurement: 'cm'
[17:56:25][C][idasen_desk_controller:098]:     Accuracy Decimals: 0
[17:56:25][C][idasen_desk_controller:098]:     Icon: 'mdi:arrow-up-down'
[17:56:25][C][idasen_desk_controller:099]:   Desk moving 'Desk Moving'
[17:56:25][C][idasen_desk_controller:099]:     Device Class: 'moving'
[17:56:25][C][idasen_desk_controller:100]:   Desk connection 'Desk Connection'
[17:56:25][C][idasen_desk_controller:100]:     Device Class: 'connectivity'
[17:56:25][C][idasen_desk_controller:101]:   Desk 'Desk'
[17:56:26][C][idasen_desk_controller:109]: Start scanning devices...
[17:56:26][C][idasen_desk_controller:052]: BLE Device found: Name: , Address: 51:07:8f:91:30:c2, manufacturer data: 060001092002a910945ba73620197cc83c12d8be537aaf0f449fa2c901
[17:56:26][C][idasen_desk_controller:052]: BLE Device found: Name: LinakUpstairsOffi, Address: d5:87:c1:46:3c:ed, txPower: -8
[17:56:26][C][idasen_desk_controller:119]: Connecting client to device d5:87:c1:46:3c:ed
[17:56:26][D][binary_sensor:036]: 'Desk Connection': Sending state ON
[17:56:26][C][idasen_desk_controller:129]: Retrieve input remote characteristic.
[17:56:28][E][BLERemoteCharacteristic.cpp:274] retrieveDescriptors(): esp_ble_gattc_get_all_descr: Unknown
[17:56:28][E][BLERemoteCharacteristic.cpp:274] retrieveDescriptors(): esp_ble_gattc_get_all_descr: Unknown
[17:56:28][E][BLERemoteCharacteristic.cpp:274] retrieveDescriptors(): esp_ble_gattc_get_all_descr: Unknown
[17:56:28][E][BLERemoteCharacteristic.cpp:274] retrieveDescriptors(): esp_ble_gattc_get_all_descr: Unknown
[17:56:28][C][idasen_desk_controller:134]: Retrieve output remote characteristic.
[17:56:28][E][BLERemoteCharacteristic.cpp:274] retrieveDescriptors(): esp_ble_gattc_get_all_descr: Unknown
[17:56:28][E][BLERemoteCharacteristic.cpp:274] retrieveDescriptors(): esp_ble_gattc_get_all_descr: Unknown
[17:56:28][C][idasen_desk_controller:137]: Register notification callback on output characteristic.
[17:56:28][C][idasen_desk_controller:143]: Retrieve control remote characteristic.
[17:56:28][E][BLERemoteCharacteristic.cpp:274] retrieveDescriptors(): esp_ble_gattc_get_all_descr: Unknown
[17:56:28][C][idasen_desk_controller:148]: Success connecting client to device
[17:56:33][D][binary_sensor:036]: 'Desk Moving': Sending state OFF
[17:56:33][D][sensor:092]: 'Desk Height': Sending state 19.00000 cm with 0 decimals of accuracy
[17:56:33][D][cover:152]: 'Desk' - Publishing:
[17:56:33][D][cover:155]:   Position: 29%
[17:56:33][D][cover:168]:   Current Operation: IDLE
[17:56:39][D][api:067]: Disconnecting Home Assistant 2021.3.4 (192.168.1.93)
[17:56:42][W][wifi_esp32:386]: Event: Disconnected ssid='PlakPort!' bssid=[redacted] reason='Beacon Timeout'
[17:56:42][W][wifi:100]: WiFi Connection lost... Reconnecting...
[17:56:42][W][wifi:522]: Restarting WiFi adapter...
[17:56:42][I][wifi:194]: WiFi Connecting to 'PlakPort!'...
[17:56:42][I][wifi:457]: WiFi Connected!
[17:56:42][C][wifi:303]:   SSID: [redacted]
[17:56:42][C][wifi:304]:   IP Address: 192.168.1.141
[17:56:42][C][wifi:306]:   BSSID: [redacted]
[17:56:42][C][wifi:307]:   Hostname: 'test'
[17:56:42][C][wifi:311]:   Signal strength: -66 dB ▂▄▆█
[17:56:42][C][wifi:315]:   Channel: 1
[17:56:42][C][wifi:316]:   Subnet: 255.255.255.0
[17:56:42][C][wifi:317]:   Gateway: 192.168.1.1
[17:56:42][C][wifi:318]:   DNS1: 192.168.1.190
[17:56:42][C][wifi:319]:   DNS2: 0.0.0.0
[17:56:50][D][api:067]: Disconnecting aioesphomeapi (192.168.1.93)
[17:56:53][W][wifi_esp32:386]: Event: Disconnected ssid='PlakPort!' bssid=[redacted] reason='Beacon Timeout'
[17:56:53][W][wifi:100]: WiFi Connection lost... Reconnecting...
[17:56:53][W][wifi:522]: Restarting WiFi adapter...
[17:56:53][I][wifi:194]: WiFi Connecting to 'PlakPort!'...
[17:56:53][I][wifi:457]: WiFi Connected!
[17:56:53][C][wifi:303]:   SSID: [redacted]
[17:56:53][C][wifi:304]:   IP Address: 192.168.1.141
[17:56:53][C][wifi:306]:   BSSID: [redacted]
[17:56:53][C][wifi:307]:   Hostname: 'test'
[17:56:53][C][wifi:311]:   Signal strength: -69 dB ▂▄▆█
[17:56:53][C][wifi:315]:   Channel: 1
[17:56:53][C][wifi:316]:   Subnet: 255.255.255.0
[17:56:53][C][wifi:317]:   Gateway: 192.168.1.1
[17:56:53][C][wifi:318]:   DNS1: 192.168.1.190
[17:56:53][C][wifi:319]:   DNS2: 0.0.0.0
[17:57:09][D][api:067]: Disconnecting aioesphomeapi (192.168.1.93)
[17:57:12][W][wifi_esp32:386]: Event: Disconnected ssid='PlakPort!' bssid=[redacted] reason='Beacon Timeout'
[17:57:12][W][wifi:100]: WiFi Connection lost... Reconnecting...
[17:57:12][W][wifi:522]: Restarting WiFi adapter...
[17:57:12][I][wifi:194]: WiFi Connecting to 'PlakPort!'...
[17:57:13][I][wifi:457]: WiFi Connected!
[17:57:13][C][wifi:303]:   SSID: [redacted]
[17:57:13][C][wifi:304]:   IP Address: 192.168.1.141
[17:57:13][C][wifi:306]:   BSSID: [redacted]
[17:57:13][C][wifi:307]:   Hostname: 'test'
[17:57:13][C][wifi:311]:   Signal strength: -66 dB ▂▄▆█
[17:57:13][C][wifi:315]:   Channel: 1
[17:57:13][C][wifi:316]:   Subnet: 255.255.255.0
[17:57:13][C][wifi:317]:   Gateway: 192.168.1.1
[17:57:13][C][wifi:318]:   DNS1: 192.168.1.190
[17:57:13][C][wifi:319]:   DNS2: 0.0.0.0
[17:57:30][D][api:067]: Disconnecting aioesphomeapi (192.168.1.93)

How far away from the AP is the esp32?

It is in the next room. About 5-6m and a wall distance.

Also, @plakna 's logs show that the signal strength is very good… Where were you going with that question, I am curious!

Thank you @plakna, I am sorry you are having issues too but I m kind of happy that there’s more than one of us!..

My issue is similar in that:

  • without any wifi config on the ESP32, the bluetooth communication between the ESP32 and the desk is flawless! I can toggle the up/down switch and the ESP32 reports every single movement in the logs. Perfect.
  • with only WiFi config on the ESP32, the board retains a steady WiFi connection.
  • when you put the two together:
    – as the ESP32 reads device characteristics from the desk, something in the api communication with HA goes out of sync, disconnects, then tries to reconnect to HA and the WiFi and never actually succeeds.
    – I also observed a very hit and miss behaviour with adding the device to HA via ESPHome: even if I was entering the api password, it was reporting auth failures- - but eventually it went through. Very weird. But even after it adds the device and entities, the entities are unavailable

I noticed some timeout values in one of @j5lien 's .cpp files… I wonder if increasing some of them may give HA the time to properly wait and disconnect/reconnect?

I was going somewhere that is probably not relevant given the signal strength …

On a particular board the wifi and BT may conflict, perhaps try a different channel for wifi?

Hello,

I published a new version and I hope it will help with Wifi issue:

I also updated the Troubleshooting section, for example you can try to force the wifi option power_save_mode to none.

1 Like

Hi @j5lien,
thank you so much for looking into this. I have downoaded the new code, recompiled etc but still get the same issues. The bluetooth_callback true/false seems to be working ok based on the flag but the same behavious still occurs. Effectively, the device starts ok but after some reconnections due to timeout it never connects again.
I am attaching two sets of logs, one with callback set to true and another with set to false.
I think there are some API (from HA?) timeouts that throw the connection/reconnection logic out of sequence? Or can it be that the home wifi doesn’t like device connecting and disconnecting?..

The following is with callback set to false:

INFO Reading configuration /config/esphome/desk.yaml…

INFO Starting log output from 192.168.1.138 using esphome API

INFO Connecting to 192.168.1.138:6053 (192.168.1.138)

WARNING Initial connection failed. The ESP might not be connected to WiFi yet (Error connecting to 192.168.1.138: timed out). Re-Trying in 1 seconds

INFO Connecting to 192.168.1.138:6053 (192.168.1.138)

INFO Successfully connected to 192.168.1.138

[14:56:39][I][app:105]: ESPHome version 1.16.2 compiled on Apr 17 2021, 14:46:39

[14:56:39][C][wifi:443]: WiFi:

[14:56:39][C][wifi:303]: SSID: ‘xxx’[redacted]

[14:56:39][C][wifi:304]: IP Address: 192.168.1.138

[14:56:39][C][wifi:306]: BSSID: FC:EC:DA:B4:70:CA[redacted]

[14:56:39][C][wifi:307]: Hostname: ‘deskxx’

[14:56:39][C][wifi:311]: Signal strength: -52 dB ▂▄▆█

[14:56:39][C][wifi:315]: Channel: 1

[14:56:39][C][wifi:316]: Subnet: 255.255.255.0

[14:56:39][C][wifi:317]: Gateway: 192.168.1.1

[14:56:39][C][wifi:318]: DNS1: 0.0.0.0

[14:56:39][C][wifi:319]: DNS2: 0.0.0.0

[14:56:39][C][logger:185]: Logger:

[14:56:39][C][logger:186]: Level: DEBUG

[14:56:39][C][logger:187]: Log Baud Rate: 115200

[14:56:39][C][logger:188]: Hardware UART: UART0

[14:56:39][C][idasen_desk_controller:112]: Start scanning devices…

[14:56:39][C][idasen_desk_controller:053]: BLE Device found: Name: KW Desk, Address: c1:8d:b2:e2:b3:df, txPower: -8

[14:56:39][C][captive_portal:169]: Captive Portal:

[14:56:39][C][ota:029]: Over-The-Air Updates:

[14:56:39][C][ota:030]: Address: 192.168.1.138:3232

[14:56:39][C][ota:032]: Using Password.

[14:56:39][W][ota:036]: Last Boot was an unhandled reset, will proceed to safe mode in 3 restarts

[14:56:39][C][api:095]: API Server:

[14:56:39][C][api:096]: Address: 192.168.1.138:6053

[14:56:39][C][idasen_desk_controller:098]: Idasen Desk Controller:

[14:56:39][C][idasen_desk_controller:099]: Mac address: C1:8D:B2:E2:B3:DF

[14:56:39][C][idasen_desk_controller:100]: Bluetooth callback: false

[14:56:39][C][idasen_desk_controller:101]: Desk height ‘Desk Height’

[14:56:39][C][idasen_desk_controller:101]: Unit of Measurement: ‘cm’

[14:56:39][C][idasen_desk_controller:101]: Accuracy Decimals: 0

[14:56:39][C][idasen_desk_controller:101]: Icon: ‘mdi:arrow-up-down’

[14:56:39][C][idasen_desk_controller:102]: Desk moving ‘Desk Moving’

[14:56:39][C][idasen_desk_controller:102]: Device Class: ‘moving’

[14:56:39][C][idasen_desk_controller:103]: Desk connection ‘Desk Connection’

[14:56:39][C][idasen_desk_controller:103]: Device Class: ‘connectivity’

[14:56:39][C][idasen_desk_controller:104]: Desk ‘Desk’

[14:56:39][C][idasen_desk_controller:122]: Connecting client to device c1:8d:b2:e2:b3:df

[14:56:40][D][binary_sensor:036]: ‘Desk Connection’: Sending state ON

[14:56:40][C][idasen_desk_controller:132]: Retrieve input remote characteristic.

[14:56:42][C][idasen_desk_controller:137]: Retrieve output remote characteristic.

[14:56:42][C][idasen_desk_controller:148]: Retrieve control remote characteristic.

[14:56:42][C][idasen_desk_controller:153]: Success connecting client to device

WARNING Disconnected from API: Timeout while waiting for message response!

INFO Connecting to 192.168.1.138:6053 (192.168.1.138)

INFO Successfully connected to 192.168.1.138

[14:56:50][C][api:095]: API Server:

[14:56:50][C][api:096]: Address: 192.168.1.138:6053

[14:56:50][C][idasen_desk_controller:098]: Idasen Desk Controller:

[14:56:50][C][idasen_desk_controller:099]: Mac address: C1:8D:B2:E2:B3:DF

[14:56:50][C][idasen_desk_controller:100]: Bluetooth callback: false

[14:56:50][C][idasen_desk_controller:101]: Desk height ‘Desk Height’

[14:56:50][C][idasen_desk_controller:101]: Unit of Measurement: ‘cm’

[14:56:50][C][idasen_desk_controller:101]: Accuracy Decimals: 0

[14:56:50][C][idasen_desk_controller:101]: Icon: ‘mdi:arrow-up-down’

[14:56:50][C][idasen_desk_controller:102]: Desk moving ‘Desk Moving’

[14:56:50][C][idasen_desk_controller:102]: Device Class: ‘moving’

[14:56:50][C][idasen_desk_controller:103]: Desk connection ‘Desk Connection’

[14:56:50][C][idasen_desk_controller:103]: Device Class: ‘connectivity’

[14:56:50][C][idasen_desk_controller:104]: Desk ‘Desk’

[14:56:51][C][idasen_desk_controller:112]: Start scanning devices…

[14:56:51][C][idasen_desk_controller:053]: BLE Device found: Name: B4E5533FA02030AEE9, Address: f3:33:19:c8:61:d1, appearance: 0, manufacturer data: a705051001000000000000021900ca, serviceUUID: 0000fe07-0000-1000-8000-00805f9b34fb, txPower: 0

[14:56:51][C][idasen_desk_controller:053]: BLE Device found: Name: , Address: 51:21:9e:3e:73:19, manufacturer data: 4c0010073e1f80567ba238, txPower: 6

[14:56:51][C][idasen_desk_controller:053]: BLE Device found: Name: Color Light, Address: dc:2c:26:c7:ef:4c, appearance: 1408, manufacturer data: f60381dc2c26c7ef4c020800, serviceUUID: 00001828-0000-1000-8000-00805f9b34fb

[14:56:51][C][idasen_desk_controller:053]: BLE Device found: Name: KW Desk, Address: c1:8d:b2:e2:b3:df, txPower: -8

[14:56:51][C][idasen_desk_controller:122]: Connecting client to device c1:8d:b2:e2:b3:df

[14:56:52][D][binary_sensor:036]: ‘Desk Connection’: Sending state ON

[14:56:52][C][idasen_desk_controller:132]: Retrieve input remote characteristic.

ERROR Error while reading incoming messages: Error while receiving data: [Errno 104] Connection reset by peer

WARNING Disconnected from API: Error while receiving data: [Errno 104] Connection reset by peer

INFO Connecting to 192.168.1.138:6053 (192.168.1.138)

WARNING Couldn’t connect to API (Timeout while waiting for message response!). Trying to reconnect in 1 seconds

INFO Connecting to 192.168.1.138:6053 (192.168.1.138)

WARNING Couldn’t connect to API (Timeout while waiting for message response!). Trying to reconnect in 1 seconds

INFO Connecting to 192.168.1.138:6053 (192.168.1.138)

WARNING Couldn’t connect to API (Error connecting to 192.168.1.138: [Errno 111] Connection refused). Trying to reconnect in 2 seconds

INFO Connecting to 192.168.1.138:6053 (192.168.1.138)

WARNING Couldn’t connect to API (Error connecting to 192.168.1.138: [Errno 111] Connection refused). Trying to reconnect in 3 seconds

INFO Connecting to 192.168.1.138:6053 (192.168.1.138)

WARNING Couldn’t connect to API (Error connecting to 192.168.1.138: [Errno 111] Connection refused). Trying to reconnect in 5 seconds

INFO Connecting to 192.168.1.138:6053 (192.168.1.138)

WARNING Couldn’t connect to API (Error connecting to 192.168.1.138: [Errno 111] Connection refused). Trying to reconnect in 7 seconds

INFO Connecting to 192.168.1.138:6053 (192.168.1.138)

INFO Successfully connected to 192.168.1.138

[14:57:29][C][idasen_desk_controller:122]: Connecting client to device c1:8d:b2:e2:b3:df

[14:57:30][D][binary_sensor:036]: ‘Desk Connection’: Sending state ON

[14:57:30][C][idasen_desk_controller:132]: Retrieve input remote characteristic.

[14:57:32][C][idasen_desk_controller:137]: Retrieve output remote characteristic.

[14:57:32][C][idasen_desk_controller:148]: Retrieve control remote characteristic.

ERROR Error while reading incoming messages: Error while receiving data: [Errno 104] Connection reset by peer

WARNING Disconnected from API: Error while receiving data: [Errno 104] Connection reset by peer

INFO Connecting to 192.168.1.138:6053 (192.168.1.138)

WARNING Couldn’t connect to API (Timeout while waiting for message response!). Trying to reconnect in 1 seconds

INFO Connecting to 192.168.1.138:6053 (192.168.1.138)

INFO Successfully connected to 192.168.1.138

[14:57:47][C][idasen_desk_controller:112]: Start scanning devices…

[14:57:47][C][idasen_desk_controller:053]: BLE Device found: Name: , Address: 50:92:7e:52:84:1c, manufacturer data: 4c001007331f86e2a81328, txPower: 6

[14:57:47][C][idasen_desk_controller:053]: BLE Device found: Name: B4E5533FA02030AEE9, Address: f3:33:19:c8:61:d1, appearance: 0, manufacturer data: a705051001000000000000021900ca, serviceUUID: 0000fe07-0000-1000-8000-00805f9b34fb, txPower: 0

[14:57:47][C][idasen_desk_controller:053]: BLE Device found: Name: , Address: 58:c3:6e:77:b6:67, manufacturer data: 4c001007251f2b3d746a58, txPower: 8

[14:57:47][C][idasen_desk_controller:053]: BLE Device found: Name: , Address: 53:78:38:7c:f1:d7, manufacturer data: 4c001006081d4ba12118

[14:57:47][C][idasen_desk_controller:053]: BLE Device found: Name: , Address: 60:ba:69:15:db:ae, manufacturer data: 4c001006041d49f10308, txPower: 12

[14:57:47][C][idasen_desk_controller:053]: BLE Device found: Name: , Address: 49:2f:e8:11:b9:2d, manufacturer data: 4c0010050798cf31c1, txPower: 24

[14:57:48][C][idasen_desk_controller:053]: BLE Device found: Name: , Address: 78:b5:7c:e8:41:b8, manufacturer data: 4c001006451d84cb8718, txPower: 12

[14:57:48][C][idasen_desk_controller:053]: BLE Device found: Name: , Address: 5f:75:c3:33:bf:ef, manufacturer data: 4c001006071d8de3eb58, txPower: 6

[14:57:48][C][idasen_desk_controller:053]: BLE Device found: Name: KW Desk, Address: c1:8d:b2:e2:b3:df, txPower: -8

[14:57:48][C][idasen_desk_controller:122]: Connecting client to device c1:8d:b2:e2:b3:df

[14:57:49][D][binary_sensor:036]: ‘Desk Connection’: Sending state ON

[14:57:49][C][idasen_desk_controller:132]: Retrieve input remote characteristic.

[14:57:51][C][idasen_desk_controller:137]: Retrieve output remote characteristic.

[14:57:51][C][idasen_desk_controller:148]: Retrieve control remote characteristic.

ERROR Error while reading incoming messages: Error while receiving data: [Errno 104] Connection reset by peer

WARNING Disconnected from API: Error while receiving data: [Errno 104] Connection reset by peer

INFO Connecting to 192.168.1.138:6053 (192.168.1.138)

WARNING Couldn’t connect to API (Timeout while waiting for message response!). Trying to reconnect in 1 seconds

INFO Connecting to 192.168.1.138:6053 (192.168.1.138)

WARNING Couldn’t connect to API (Timeout while waiting for message response!). Trying to reconnect in 1 seconds

INFO Connecting to 192.168.1.138:6053 (192.168.1.138)

WARNING Couldn’t connect to API (Error connecting to 192.168.1.138: timed out). Trying to reconnect in 2 seconds

INFO Connecting to 192.168.1.138:6053 (192.168.1.138)

WARNING Couldn’t connect to API (Error connecting to 192.168.1.138: timed out). Trying to reconnect in 3 seconds

INFO Connecting to 192.168.1.138:6053 (192.168.1.138)

WARNING Couldn’t connect to API (Error connecting to 192.168.1.138: timed out). Trying to reconnect in 5 seconds

INFO Connecting to 192.168.1.138:6053 (192.168.1.138)

WARNING Couldn’t connect to API (Error connecting to 192.168.1.138: timed out). Trying to reconnect in 7 seconds

INFO Connecting to 192.168.1.138:6053 (192.168.1.138)

WARNING Couldn’t connect to API (Error connecting to 192.168.1.138: [Errno 113] No route to host). Trying to reconnect in 11 seconds

INFO Connecting to 192.168.1.138:6053 (192.168.1.138)

WARNING Couldn’t connect to API (Error connecting to 192.168.1.138: [Errno 113] No route to host). Trying to reconnect in 17 seconds

STOP

And this with callback set to true:

INFO Reading configuration /config/esphome/desk.yaml…

INFO Starting log output from 192.168.1.138 using esphome API

INFO Connecting to 192.168.1.138:6053 (192.168.1.138)

WARNING Initial connection failed. The ESP might not be connected to WiFi yet (Timeout while waiting for message response!). Re-Trying in 1 seconds

INFO Connecting to 192.168.1.138:6053 (192.168.1.138)

INFO Successfully connected to 192.168.1.138

[14:41:42][I][app:105]: ESPHome version 1.16.2 compiled on Apr 17 2021, 14:23:43

[14:41:42][C][wifi:443]: WiFi:

[14:41:42][C][wifi:303]: SSID: ‘xxx’[redacted]

[14:41:42][C][wifi:304]: IP Address: 192.168.1.138

[14:41:42][C][wifi:306]: BSSID: FC:EC:DA:B4:70:CA[redacted]

[14:41:42][C][wifi:307]: Hostname: ‘deskxx’

[14:41:42][C][wifi:311]: Signal strength: -35 dB ▂▄▆█

[14:41:42][C][wifi:315]: Channel: 1

[14:41:42][C][wifi:316]: Subnet: 255.255.255.0

[14:41:42][C][wifi:317]: Gateway: 192.168.1.1

[14:41:42][C][wifi:318]: DNS1: 0.0.0.0

[14:41:42][C][wifi:319]: DNS2: 0.0.0.0

[14:41:42][C][logger:185]: Logger:

[14:41:42][C][logger:186]: Level: DEBUG

[14:41:42][C][logger:187]: Log Baud Rate: 115200

[14:41:42][C][logger:188]: Hardware UART: UART0

[14:41:42][C][captive_portal:169]: Captive Portal:

[14:41:42][C][ota:029]: Over-The-Air Updates:

[14:41:42][C][ota:030]: Address: 192.168.1.138:3232

[14:41:42][C][ota:032]: Using Password.

[14:41:42][W][ota:036]: Last Boot was an unhandled reset, will proceed to safe mode in 8 restarts

[14:41:42][C][api:095]: API Server:

[14:41:42][C][api:096]: Address: 192.168.1.138:6053

[14:41:42][C][idasen_desk_controller:098]: Idasen Desk Controller:

[14:41:42][C][idasen_desk_controller:099]: Mac address: C1:8D:B2:E2:B3:DF

[14:41:42][C][idasen_desk_controller:100]: Bluetooth callback: true

[14:41:42][C][idasen_desk_controller:101]: Desk height ‘Desk Height’

[14:41:42][C][idasen_desk_controller:101]: Unit of Measurement: ‘cm’

[14:41:42][C][idasen_desk_controller:101]: Accuracy Decimals: 0

[14:41:42][C][idasen_desk_controller:101]: Icon: ‘mdi:arrow-up-down’

[14:41:42][C][idasen_desk_controller:102]: Desk moving ‘Desk Moving’

[14:41:42][C][idasen_desk_controller:102]: Device Class: ‘moving’

[14:41:42][C][idasen_desk_controller:103]: Desk connection ‘Desk Connection’

[14:41:42][C][idasen_desk_controller:103]: Device Class: ‘connectivity’

[14:41:42][C][idasen_desk_controller:104]: Desk ‘Desk’

[14:41:43][C][idasen_desk_controller:112]: Start scanning devices…

[14:41:43][C][idasen_desk_controller:053]: BLE Device found: Name: KW Desk, Address: c1:8d:b2:e2:b3:df, txPower: -8

[14:41:43][C][idasen_desk_controller:122]: Connecting client to device c1:8d:b2:e2:b3:df

[14:41:43][C][idasen_desk_controller:126]: Fail to connect to client

[14:41:43][D][api.connection:604]: Client ‘Home Assistant 2021.4.5 (192.168.1.128)’ connected successfully!

[14:41:45][C][idasen_desk_controller:122]: Connecting client to device c1:8d:b2:e2:b3:df

[14:41:46][D][binary_sensor:036]: ‘Desk Connection’: Sending state ON

[14:41:46][C][idasen_desk_controller:132]: Retrieve input remote characteristic.

[14:41:48][C][idasen_desk_controller:137]: Retrieve output remote characteristic.

[14:41:48][C][idasen_desk_controller:142]: Register notification callback on output characteristic.

WARNING Disconnected from API: Timeout while waiting for message response!

INFO Connecting to 192.168.1.138:6053 (192.168.1.138)

INFO Successfully connected to 192.168.1.138

[14:41:52][C][idasen_desk_controller:122]: Connecting client to device c1:8d:b2:e2:b3:df

[14:41:53][D][binary_sensor:036]: ‘Desk Connection’: Sending state ON

[14:41:53][C][idasen_desk_controller:132]: Retrieve input remote characteristic.

[14:41:55][C][idasen_desk_controller:137]: Retrieve output remote characteristic.

[14:41:55][C][idasen_desk_controller:142]: Register notification callback on output characteristic.

ERROR Error while reading incoming messages: Error while receiving data: [Errno 104] Connection reset by peer

WARNING Disconnected from API: Error while receiving data: [Errno 104] Connection reset by peer

INFO Connecting to 192.168.1.138:6053 (192.168.1.138)

WARNING Couldn’t connect to API (Timeout while waiting for message response!). Trying to reconnect in 1 seconds

INFO Connecting to 192.168.1.138:6053 (192.168.1.138)

WARNING Couldn’t connect to API (Error connecting to 192.168.1.138: timed out). Trying to reconnect in 1 seconds

INFO Connecting to 192.168.1.138:6053 (192.168.1.138)

INFO Successfully connected to 192.168.1.138

[14:42:15][C][idasen_desk_controller:122]: Connecting client to device c1:8d:b2:e2:b3:df

[14:42:16][D][binary_sensor:036]: ‘Desk Connection’: Sending state ON

[14:42:16][C][idasen_desk_controller:132]: Retrieve input remote characteristic.

[14:42:19][C][idasen_desk_controller:137]: Retrieve output remote characteristic.

[14:42:19][C][idasen_desk_controller:142]: Register notification callback on output characteristic.

ERROR Error while reading incoming messages: Error while receiving data: [Errno 104] Connection reset by peer

WARNING Disconnected from API: Error while receiving data: [Errno 104] Connection reset by peer

INFO Connecting to 192.168.1.138:6053 (192.168.1.138)

WARNING Couldn’t connect to API (Timeout while waiting for message response!). Trying to reconnect in 1 seconds

INFO Connecting to 192.168.1.138:6053 (192.168.1.138)

WARNING Couldn’t connect to API (Timeout while waiting for message response!). Trying to reconnect in 1 seconds

ERROR Error while reading incoming messages: Error while receiving data: [Errno 9] Bad file descriptor

WARNING Disconnected from API: Timeout while waiting for message response!

INFO Connecting to 192.168.1.138:6053 (192.168.1.138)

INFO Connecting to 192.168.1.138:6053 (192.168.1.138)

WARNING Couldn’t connect to API (Error connecting to 192.168.1.138: timed out). Trying to reconnect in 1 seconds

INFO Connecting to 192.168.1.138:6053 (192.168.1.138)

WARNING Couldn’t connect to API (Error connecting to 192.168.1.138: timed out). Trying to reconnect in 2 seconds

INFO Connecting to 192.168.1.138:6053 (192.168.1.138)

WARNING Couldn’t connect to API (Error connecting to 192.168.1.138: timed out). Trying to reconnect in 1 seconds

INFO Connecting to 192.168.1.138:6053 (192.168.1.138)

WARNING Couldn’t connect to API (Error connecting to 192.168.1.138: timed out). Trying to reconnect in 3 seconds

INFO Connecting to 192.168.1.138:6053 (192.168.1.138)

WARNING Couldn’t connect to API (Error connecting to 192.168.1.138: [Errno 9] Bad file descriptor). Trying to reconnect in 2 seconds

WARNING Couldn’t connect to API (Error connecting to 192.168.1.138: [Errno 9] Bad file descriptor). Trying to reconnect in 5 seconds

INFO Connecting to 192.168.1.138:6053 (192.168.1.138)

WARNING Couldn’t connect to API (Error connecting to 192.168.1.138: [Errno 113] No route to host). Trying to reconnect in 3 seconds

INFO Connecting to 192.168.1.138:6053 (192.168.1.138)

WARNING Couldn’t connect to API (Error connecting to 192.168.1.138: [Errno 113] No route to host). Trying to reconnect in 5 seconds

INFO Connecting to 192.168.1.138:6053 (192.168.1.138)

WARNING Couldn’t connect to API (Error connecting to 192.168.1.138: [Errno 113] No route to host). Trying to reconnect in 7 seconds

INFO Connecting to 192.168.1.138:6053 (192.168.1.138)

WARNING Couldn’t connect to API (Error connecting to 192.168.1.138: [Errno 113] No route to host). Trying to reconnect in 11 seconds

INFO Connecting to 192.168.1.138:6053 (192.168.1.138)

WARNING Couldn’t connect to API (Error connecting to 192.168.1.138: [Errno 113] No route to host). Trying to reconnect in 17 seconds

Just want to say, the newer integration with ESPHome’s BLE client and external_components feature is very nice. Got this working from stock ESPHome with nothing to install, just some Yaml config!

1 Like