Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Link Service.AccessoryInformation to the accessory's one to keep it to date #2207

Closed

Conversation

afharo
Copy link
Contributor

@afharo afharo commented Apr 27, 2019

A plugin I'm maintaining needs to perform some asynchronous operations before grabbing the SerialNumber or the FirmwareRevision.

I was trying to update the parameters via myAccessoryInformation.setCharacteristics calls but nothing was working and found we are copying the values to the Service.AccessoryInformation instantiated by HAP.

This MR intends to keep the HAP instance updated with any updates from the accessory itself.

I know the SerialNumber won't change over time, but the Firmware might because of updates :)

@tobekas
Copy link

tobekas commented Jun 25, 2019

But note that Name, Model, Manufacurer and SerialNumber must be persistent during the lifetime of the accessory. (by spec)
This may be the reason why these values are copied... Bit since Firmware/Hardware Revision May chance, this issue still has its raison d’être.

@afharo
Copy link
Contributor Author

afharo commented Aug 28, 2019

@nfarina What are your thoughts about these changes?

@nfarina
Copy link
Contributor

nfarina commented Sep 4, 2019

Oh man, it's been a long while since I thought about this aspect of HAP - maybe @KhaosT would have a quicker reaction to it?

@BewhiskeredBard
Copy link

I'd also like to be able to update the FirmwareRevision dynamically.

@Sunoo
Copy link

Sunoo commented Jan 21, 2020

Any chance of getting this resolved? Being able to update Firmware Revision would be very nice.

EDIT: I just tried this pull request locally, and it doesn’t seem to get updating Firmware Revision to work either.

@Supereg
Copy link
Member

Supereg commented Apr 3, 2020

To answer some questions:
As of the HAP spec, after a firmware upgrade the config number (cn) MUST change in the bonjour record. And only then HomeKit will grab the updated value of the characteristic. Maybe we can incorporate something like this into hap-nodejs so this will be possible. Though those values would only be grabbed from the /accessories call. HAP-NodeJS does not call any get handlers AFAIK when it receives such a request (would take too long) and would just grab the last value.
For anybody interested, would be good to know what you would expect from such a feature and how you would use that.

@Supereg
Copy link
Member

Supereg commented Apr 3, 2020

Some words to this PR:

It is strongly related to #2169 (and #2472). And in my opinion #2169 has a much nicer way of transferring all those listeners. As this PR would create just another listener and not just replaces it.

@afharo
Copy link
Contributor Author

afharo commented Apr 3, 2020

Thank you for your comments on this!

Though those values would only be grabbed from the /accessories call. HAP-NodeJS does not call any get handlers AFAIK when it receives such a request (would take too long) and would just grab the last value.

I recall testing it locally and seeing things like the SerialNumber and the FirmwareRevision updated to the right value from the device (once connected) instead of the default values from the initial Services initialization.

Maybe HAP-NodeJS has changed ever since and it doesn't work like that anymore, I'd have to test it again.

That said, I agree the solution in #2169 is better performance-wise. Closing this PR in favour of that one.

@afharo afharo closed this Apr 3, 2020
@afharo afharo deleted the Keep-AccessoryInformation-up-to-date branch April 3, 2020 17:03
@Supereg
Copy link
Member

Supereg commented Apr 3, 2020

Okay I think some misinformation spread my be. Seems like indeed HAP calls read handlers for
manufacturer, model, name, serial-number, firmware.revision and hardware-revision

@Supereg
Copy link
Member

Supereg commented Apr 3, 2020

and probably all the other characteristics if they are configured

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants