Incorrect debug message / behavior: "Tried enabling notifications for Characteristic which does not allow notify"
See original GitHub issueSome 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:
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:
- Created 3 years ago
- Comments:6 (6 by maintainers)
Top GitHub Comments
Seems like this happens most overtly for any characteristics of the
AccessoryInformation
service (but alsoHoldPosition
, might just be all characteristics without notify permissions). I’ll create a patch that properly silences this warning in such scenarios.Thank you! I can confirm that your patch solves my issue. 👍