fsievers22 / esphome-ble-remote

ESPHome external component for a BLE HID client
MIT License
25 stars 10 forks source link

ESP-IDF Issue - Max Notification Reached, registration failed #17

Open benedikt-bartscher opened 1 year ago

benedikt-bartscher commented 1 year ago

First of all, thank you for this awesome esphome component. I tried to pair with "Alexa Remote Pro" but while reading the characteristics it fails with this error:

E (18960) BT_APPL: Max Notification Reached, registration failed.

which is caused by https://github.com/espressif/esp-idf/issues/6376. I think there is not much we can do in this repo, i just wanted to keep track of the issue.

Bretthansenpc commented 1 year ago

What esp are you using? I've been using a fire remote pro with this since it released. Although I stayed with a previous revision because the new version didn't recognize the difference between the newest buttons and 4 on the bottom.

benedikt-bartscher commented 1 year ago

I am using a LILYGO TTGO T-Internet-POE ESP32-WROOM. I will try some other remotes later. This is the remote i ordered: https://www.amazon.de/dp/B09SVVVG16?psc=1

Bretthansenpc commented 1 year ago

How much PSRAM is on that? That's the same remote I have and mine works great I only have 1.3 megabytes of psram on mine

Bretthansenpc commented 1 year ago

If I remember correctly the wrooms don't have internal psram. And I just checked that version it has no psram at all so that is why it runs out and panics

benedikt-bartscher commented 1 year ago

Thank you for pointing me to psram. I just ordered some esp32-wrover modules which seem to have internal psram. I will report my results if they arrive

benedikt-bartscher commented 1 year ago

I just flashed my new board with internal psram. I still get the error msg: E (18960) BT_APPL: Max Notification Reached, registration failed. However pairing works fine and all keycodes get logged if i press buttons.

Another thing i noticed: The "Last event value" entity only changes from 0 (idle) to 1 (any btn pressed). Shouldn't it show the last pressed key?

For reference, here is my full log:

INFO Reading configuration /config/bleproxy-lr.yaml...
INFO Starting log output from 10.11.113.11 using esphome API
INFO Successfully connected to 10.11.113.11
[14:25:47][I][app:102]: ESPHome version 2023.4.1 compiled on Apr 24 2023, 14:24:36
[14:25:47][I][app:104]: Project esphome.bluetooth-proxy version 1.0
[14:25:47][C][logger:294]: Logger:
[14:25:47][C][logger:295]:   Level: DEBUG
[14:25:47][C][logger:296]:   Log Baud Rate: 115200
[14:25:47][C][logger:297]:   Hardware UART: UART0
[14:25:47][C][safe_mode.button:022]: Safe Mode Button 'bleproxy-lr Safe Mode Boot'
[14:25:47][C][safe_mode.button:022]:   Icon: 'mdi:restart-alert'
[14:25:47][C][esp32_ble:218]: ESP32 BLE:
[14:25:47][C][esp32_ble:220]:   MAC address: 24:D7:EB:55:86:2E
[14:25:47][C][esp32_ble_tracker:591]: BLE Tracker:
[14:25:47][C][esp32_ble_tracker:592]:   Scan Duration: 300 s
[14:25:47][C][esp32_ble_tracker:593]:   Scan Interval: 1100.0 ms
[14:25:47][C][esp32_ble_tracker:594]:   Scan Window: 1100.0 ms
[14:25:47][C][esp32_ble_tracker:595]:   Scan Type: ACTIVE
[14:25:47][C][esp32_ble_tracker:596]:   Continuous Scanning: True
[14:25:47][C][ble_client:027]: BLE Client:
[14:25:47][C][ble_client:028]:   Address: 6C:0C:9A:E9:D4:3F
[14:25:47][C][ble_client_hid:030]: BLE Client HID:
[14:25:47][C][ble_client_hid:032]:   MAC address        : 6C:0C:9A:E9:D4:3F
[14:25:47][C][ethernet:179]: Ethernet:
[14:25:47][C][ethernet:306]:   IP Address: 10.11.113.11
[14:25:47][C][ethernet:307]:   Hostname: 'bleproxy-lr-55862c'
[14:25:47][C][ethernet:308]:   Subnet: 255.255.255.0
[14:25:47][C][ethernet:309]:   Gateway: 10.11.113.254
[14:25:47][C][ethernet:318]:   DNS1: 10.11.113.1
[14:25:47][C][ethernet:319]:   DNS2: 0.0.0.0
[14:25:47][C][ethernet:327]:   MAC Address: 24:D7:EB:55:86:2F
[14:25:47][C][ethernet:332]:   Is Full Duplex: YES
[14:25:47][C][ethernet:337]:   Link Speed: 100
[14:25:47][C][ethernet:182]:   Power Pin: 5
[14:25:47][C][ethernet:184]:   MDC Pin: 23
[14:25:47][C][ethernet:185]:   MDIO Pin: 18
[14:25:47][C][ethernet:186]:   Type: IP101
[14:25:47][C][ethernet:187]:   PHY addr: 1
[14:25:47][C][ota:093]: Over-The-Air Updates:
[14:25:47][C][ota:094]:   Address: 10.11.113.11:3232
[14:25:47][C][api:138]: API Server:
[14:25:47][C][api:139]:   Address: 10.11.113.11:6053
[14:25:47][C][api:143]:   Using noise encryption: NO
[14:25:49][D][esp32_ble_client:048]: [0] [6C:0C:9A:E9:D4:3F] Found device
[14:25:49][D][esp32_ble_tracker:214]: Pausing scan to make connection...
[14:25:49][I][esp32_ble_client:064]: [0] [6C:0C:9A:E9:D4:3F] 0x00 Attempting BLE connection
[14:25:49][I][esp32_ble_client:265]: [0] [6C:0C:9A:E9:D4:3F] auth complete. remote BD_ADDR: 6c0c9ae9d43f
[14:25:50][D][api:102]: Accepted 10.11.3.3
[14:25:50][D][api.connection:961]: Home Assistant 2023.4.4 (10.11.3.3): Connected successfully
[14:25:51][D][ble_client_hid:131]: GATT HID service found on device 6C:0C:9A:E9:D4:3F
[14:25:51][I][esp32_ble_client:196]: [0] [6C:0C:9A:E9:D4:3F] Connected
[14:25:51][D][ble_client_hid:145]: GATTC search finished with status code 0
[14:25:51][D][esp32_ble_tracker:246]: Starting scan...
[14:25:51][D][ble_client_hid:036]: Reading client characteristics
[14:25:51][D][ble_client_hid:070]: Found 9 characteristics
[14:25:51][D][ble_client_hid:300]: Parse HID Report Map
[14:25:51][D][hid_parser:041]: Report Map:
[14:25:51][D][hid_parser:060]: 5, 1
[14:25:51][D][hid_parser:060]: 9, 6
[14:25:51][D][hid_parser:060]: A1, 1
[14:25:51][D][hid_parser:060]: 5, 7
[14:25:51][D][hid_parser:060]: 85, 1
[14:25:51][D][hid_parser:060]: 95, 3
[14:25:51][D][hid_parser:060]: 75, 8
[14:25:51][D][hid_parser:060]: 15, 0
[14:25:51][D][hid_parser:060]: 25, FF
[14:25:51][D][hid_parser:060]: 19, 0
[14:25:51][D][hid_parser:060]: 29, FF
[14:25:51][D][hid_parser:060]: 81, 0
[14:25:51][D][hid_parser:065]: C0
[14:25:51][D][hid_parser:060]: 5, C
[14:25:51][D][hid_parser:060]: 9, 1
[14:25:51][D][hid_parser:060]: A1, 1
[14:25:51][D][hid_parser:060]: 85, 2
[14:25:51][D][hid_parser:060]: 95, 2
[14:25:51][D][hid_parser:060]: 75, 10
[14:25:51][D][hid_parser:060]: 15, 0
[14:25:51][D][hid_parser:055]: 26, 9C, 2
[14:25:51][D][hid_parser:060]: 19, 0
[14:25:51][D][hid_parser:055]: 2A, 9C, 2
[14:25:51][D][hid_parser:060]: 81, 0
[14:25:51][D][hid_parser:065]: C0
[14:25:51][D][hid_parser:055]: 6, FF, 0
[14:25:51][D][hid_parser:060]: 9, 0
[14:25:51][D][hid_parser:060]: A1, 1
[14:25:51][D][hid_parser:060]: 85, F0
[14:25:51][D][hid_parser:060]: 95, 50
[14:25:51][D][hid_parser:060]: 75, 8
[14:25:51][D][hid_parser:060]: 15, 0
[14:25:51][D][hid_parser:060]: 25, FF
[14:25:51][D][hid_parser:060]: 81, 0
[14:25:51][D][hid_parser:060]: 85, F1
[14:25:51][D][hid_parser:060]: 95, 3
[14:25:51][D][hid_parser:060]: 75, 8
[14:25:51][D][hid_parser:060]: 9, 0
[14:25:51][D][hid_parser:060]: 81, 2
[14:25:51][D][hid_parser:060]: 85, F2
[14:25:51][D][hid_parser:060]: 95, 1
[14:25:51][D][hid_parser:060]: 75, 8
[14:25:51][D][hid_parser:060]: 9, 0
[14:25:51][D][hid_parser:060]: 91, 2
[14:25:51][D][hid_parser:060]: 85, F3
[14:25:51][D][hid_parser:060]: 95, A
[14:25:51][D][hid_parser:060]: 75, 8
[14:25:51][D][hid_parser:060]: 9, 0
[14:25:51][D][hid_parser:060]: 91, 2
[14:25:51][D][hid_parser:060]: 85, EF
[14:25:51][D][hid_parser:060]: 95, 3
[14:25:51][D][hid_parser:060]: 75, 8
[14:25:51][D][hid_parser:060]: 15, 0
[14:25:51][D][hid_parser:060]: 25, FF
[14:25:51][D][hid_parser:060]: 19, 0
[14:25:51][D][hid_parser:060]: 29, FF
[14:25:51][D][hid_parser:060]: 9, 1
[14:25:51][D][hid_parser:060]: 81, 0
[14:25:51][D][hid_parser:065]: C0
[14:25:51][D][hid_parser:060]: 5, C
[14:25:51][D][hid_parser:060]: 9, 1
[14:25:51][D][hid_parser:060]: A1, 1
[14:25:51][D][hid_parser:060]: 85, 3
[14:25:51][D][hid_parser:060]: 5, 1
[14:25:51][D][hid_parser:060]: 9, 6
[14:25:51][D][hid_parser:060]: A1, 2
[14:25:51][D][hid_parser:060]: 5, 6
[14:25:51][D][hid_parser:060]: 9, 20
[14:25:51][D][hid_parser:060]: 15, 0
[14:25:51][D][hid_parser:055]: 26, 64, 0
[14:25:51][D][hid_parser:060]: 75, 8
[14:25:51][D][hid_parser:060]: 95, 1
[14:25:51][D][hid_parser:060]: 81, 2
[14:25:51][D][hid_parser:065]: C0
[14:25:51][D][hid_parser:065]: C0
[14:25:51][D][hid_parser:178]: Usage page: 1
[14:25:51][D][hid_parser:112]: Parsing simple usage: 1, 6
[14:25:51][D][hid_parser:178]: Usage page: 7
[14:25:51][D][hid_parser:112]: Parsing simple usage: 7, 0
[14:25:51][D][hid_parser:112]: Parsing simple usage: 7, FF
[14:25:51][D][hid_parser:262]: Found input main item
[14:25:51][D][hid_parser:288]: Creating usage range with min: 0, max: 255, page: 7
[14:25:51][D][hid_parser:299]: Parsed input report item of type: array, report size: 8, report count: 3, report id: 1
[14:25:51][D][hid_parser:178]: Usage page: C
[14:25:51][D][hid_parser:112]: Parsing simple usage: C, 1
[14:25:51][D][hid_parser:112]: Parsing simple usage: C, 0
[14:25:51][D][hid_parser:112]: Parsing simple usage: C, 29C
[14:25:51][D][hid_parser:262]: Found input main item
[14:25:51][D][hid_parser:288]: Creating usage range with min: 0, max: 668, page: 12
[14:25:51][D][hid_parser:299]: Parsed input report item of type: array, report size: 16, report count: 2, report id: 2
[14:25:51][D][hid_parser:178]: Usage page: FF
[14:25:51][D][hid_parser:112]: Parsing simple usage: FF, 0
[14:25:51][D][hid_parser:262]: Found input main item
[14:25:51][D][hid_parser:288]: Creating usage range with min: 0, max: 0, page: 0
[14:25:51][D][hid_parser:299]: Parsed input report item of type: array, report size: 8, report count: 80, report id: 240
[14:25:51][D][hid_parser:112]: Parsing simple usage: FF, 0
[14:25:51][D][hid_parser:262]: Found input main item
[14:25:51][D][hid_parser:294]: Parsed input report item of type: variable, report size: 8, report count: 3, report id: 241
[14:25:51][D][hid_parser:112]: Parsing simple usage: FF, 0
[14:25:51][D][hid_parser:112]: Parsing simple usage: FF, 0
[14:25:51][D][hid_parser:112]: Parsing simple usage: FF, 0
[14:25:51][D][hid_parser:112]: Parsing simple usage: FF, FF
[14:25:51][D][hid_parser:112]: Parsing simple usage: FF, 1
[14:25:51][D][hid_parser:262]: Found input main item
[14:25:51][D][hid_parser:299]: Parsed input report item of type: array, report size: 8, report count: 3, report id: 239
[14:25:51][D][hid_parser:178]: Usage page: C
[14:25:51][D][hid_parser:112]: Parsing simple usage: C, 1
[14:25:51][D][hid_parser:178]: Usage page: 1
[14:25:51][D][hid_parser:112]: Parsing simple usage: 1, 6
[14:25:51][D][hid_parser:178]: Usage page: 6
[14:25:52][D][hid_parser:112]: Parsing simple usage: 6, 20
[14:25:52][D][hid_parser:262]: Found input main item
[14:25:52][D][hid_parser:294]: Parsed input report item of type: variable, report size: 8, report count: 1, report id: 3
[14:25:52][D][hid_parser:321]: Parsed report map with 8 input reports
[14:25:52][D][ble_client_hid:307]: Parse HID Report Map Done
[14:25:52][D][ble_client_hid:328]: Report ID for handle 48 is 1
[14:25:52][D][ble_client_hid:328]: Report ID for handle 52 is 240
[14:25:52][D][ble_client_hid:328]: Report ID for handle 56 is 242
[14:25:52][D][ble_client_hid:328]: Report ID for handle 59 is 2
[14:25:52][D][esp-idf:000]: E (37135) BT_APPL: Max Notification Reached, registration failed.

[14:25:52][W][esp32_ble_tracker:119]: Too many BLE events to process. Some devices may not show up.
[14:25:55][D][ble_client_hid:184]: Received HID input report from handle 48
[14:25:55][D][hid_parser:350]: Parsing HID report with report ID (1)
[14:25:55][D][hid_parser:448]: HIDReportItemValue(usage_page: 7, usage: 79, value: 1)
[14:25:55][D][text_sensor:064]: '': Sending state 'Keyboard RightArrow'
[14:25:55][D][sensor:110]: 'bleproxy-lr Last Event Value': Sending state 1.00000  with 0 decimals of accuracy
[14:25:55][D][ble_client_hid:207]: Send HID event to HomeAssistant: usage: Keyboard RightArrow, value: 1
[14:25:55][D][ble_client_hid:184]: Received HID input report from handle 48
[14:25:55][D][hid_parser:350]: Parsing HID report with report ID (1)
[14:25:55][D][hid_parser:442]: HIDReportItemValue(usage_page: 7, usage: 79, value: 0)
[14:25:55][D][text_sensor:064]: '': Sending state 'Keyboard RightArrow'
[14:25:55][D][sensor:110]: 'bleproxy-lr Last Event Value': Sending state 0.00000  with 0 decimals of accuracy
[14:25:55][D][ble_client_hid:207]: Send HID event to HomeAssistant: usage: Keyboard RightArrow, value: 0
[14:25:57][D][ble_client_hid:184]: Received HID input report from handle 48
[14:25:57][D][hid_parser:350]: Parsing HID report with report ID (1)
[14:25:57][D][hid_parser:448]: HIDReportItemValue(usage_page: 7, usage: 80, value: 1)
[14:25:57][D][text_sensor:064]: '': Sending state 'Keyboard LeftArrow'
[14:25:57][D][sensor:110]: 'bleproxy-lr Last Event Value': Sending state 1.00000  with 0 decimals of accuracy
[14:25:57][D][ble_client_hid:207]: Send HID event to HomeAssistant: usage: Keyboard LeftArrow, value: 1
[14:25:57][D][ble_client_hid:184]: Received HID input report from handle 48
[14:25:57][D][hid_parser:350]: Parsing HID report with report ID (1)
[14:25:57][D][hid_parser:442]: HIDReportItemValue(usage_page: 7, usage: 80, value: 0)
[14:25:57][D][text_sensor:064]: '': Sending state 'Keyboard LeftArrow'
[14:25:57][D][sensor:110]: 'bleproxy-lr Last Event Value': Sending state 0.00000  with 0 decimals of accuracy
[14:25:57][D][ble_client_hid:207]: Send HID event to HomeAssistant: usage: Keyboard LeftArrow, value: 0
fsievers22 commented 1 year ago

Thanks for your feedback. The last pressed key should be shown in a text_sensor but apparently it does not work currently. I will try to fix it as soon as possible.

The error about max notifications reached seems to be from the underlying software stack and probably the remote would like to register more characteristics for notification than the esp32 can handle. I don't think I can do anything about that.

benedikt-bartscher commented 1 year ago

You are welcome. I will open a seperate issue for text_sensor not working with the latest esphome.

About the error with the max notifications: I know this is not an issue with this repo/code, thats what i mentioned in the first comment of this issue: "I think there is not much we can do in this repo, i just wanted to keep track of the issue.". You can leave it open to keep track of it or just close it if you want.