question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Incorrect debug message / behavior: "Tried enabling notifications for Characteristic which does not allow notify"

See original GitHub issue

Some minutes after closing the Home app on my iPhone, I noticed a huge batch of debug messages coming from HAP-NodeJS:Accessory. They all start with Tried enabling notifications for Characteristic which does not allow notify.

The messages originate from this code block:

https://github.com/homebridge/HAP-NodeJS/blob/88f235ff27739a1dc3487c0fe351d1dbf892c308/src/lib/Accessory.ts#L1632-L1635

To check if this is actually a bug in Apple’s Home app that tries to get notified about changes of characteristics that do not allow notify, I added data.ev to the debug output in this block. It’s always falsy, so the message is incorrect - the controller does not want to enable any notifications here, but disable them (or keep them disabled, as they were never enabled in the first place).

In addition to the debug message being wrong, I also think that sending back the error HAPStatus.NOTIFICATION_NOT_SUPPORTED is not required by the HAP specification if data.ev is falsy (at least I didn’t find any sentence that supports the error response in this case), and as these requests are coming from the official Home app on my iPhone, I assume that Apple does not consider this to be a case in which an error should be sent back.

I therefore suggest prepending data.ev && to the existing condition !characteristic.props.perms.includes(Perms.NOTIFY) to only trigger the block if data.ev is truthy.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
Superegcommented, Jan 8, 2021

Seems like this happens most overtly for any characteristics of the AccessoryInformation service (but also HoldPosition, might just be all characteristics without notify permissions). I’ll create a patch that properly silences this warning in such scenarios.

0reactions
hippotasticcommented, Jan 10, 2021

Thank you! I can confirm that your patch solves my issue. 👍

Read more comments on GitHub >

github_iconTop Results From Across the Web

BLE Client: not able to write data into characteristics · Issue #337
The scenario is the following: Mobile app(hereafter Client) connects to the BLE device. The client enables notifications on the device (plugin ...
Read more >
OnCharacteristicChanged is not fired in BLE notications
The device needs bonding and can notify characteristics value changes. I have BLE native implementations for iOS and Android smartphones. The ...
Read more >
BLE enableNotification works on iOS but not Android - Evothings
Using easyble, after calling, device.enableNotification(MY_UUID,win,fail) I get notifications on iOS but not on Android.
Read more >
CC2640R2F: Still can send Indication even if the characteristic ...
My customer uses CC2640R2F with SDK version 3.30. BLE 4.2. In Simple Peripheral project, a characteristic is defined "GATT_PROP_NOTIFY"(char 4).
Read more >
iOS says BLE Characteristic is not notifying - Stack Overflow
notifying = no in the debug description indicates that you have not enabled notifications for this characteristic (i.e. its isNotifying ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found