jlusiardi / homekit_python

A python implementation to work as both HomeKit controller and accessory.
Apache License 2.0
223 stars 41 forks source link

Is there a way to generate the -f ${PAIRINGDATAFILE} for existing devices? #179

Closed earlthesquirrel closed 4 years ago

earlthesquirrel commented 4 years ago

I'd like to remove a device and was trying to figure out the PAIRINGDATAFILE. Since the device was added using a different mechanism, I don't have a file to start with.

I'm trying to reset a device that hasn't unpaired correctly... which this package would be great for.

Jc2k commented 4 years ago

Can you give some more context about whats happened?

In general the answer is no - the pairing data file contains the results of a cryptographic exchange and includes the only copy of the only private key the accessory trusts.

earlthesquirrel commented 4 years ago

I have a device (a motion sensor) installed based on a Particle. The device doesn't show up in the negative home app (I deleted from there) but using python3 -m homekit.discover it shows up as paired. (I have a couple devices that have gotten into this state... the Particle has been what I've been using to test with, to try to figure out what's not happening properly when the device is removed from the native Home app.

jlusiardi commented 4 years ago

Hi @earlthesquirrel,

each HomeKit accessory has its more or less unique way to reset it (and by that remove all pairings). E.g. I have OSRAM SMART+ Classic E27 Multicolor (BLE) which must be turned on and of with a special pattern. Look into the manual for the device. HTH.

Joachim

earlthesquirrel commented 4 years ago

Well one product my company produces (so the manual is what we write :-) ) So, trying to figure out if something is left over in the Homekit DB, etc.
This particle based motion sensor is something that I've been able to get into the same state... which made it useful for debugging.. the question is now how to clear this info..

jlusiardi commented 4 years ago

I do not exactly know this particle or the software you are running on it but there should be some kind of storare in flash/eeprom?

earlthesquirrel commented 4 years ago

It's a Particle photon (see : https://store.particle.io/?utm_term=&utm_campaign=Dynamic+Search+Ads+-+S8&utm_source=adwords&utm_medium=ppc&hsa_grp=67675299738&hsa_acc=5060272854&hsa_tgt=dsa-835611334005&hsa_kw=&hsa_src=g&hsa_mt=b&hsa_cam=1697512981&hsa_ver=3&hsa_ad=329939807759&hsa_net=adwords&gclid=EAIaIQobChMItO_pq-if6AIVAuiGCh3xQQrhEAAYASAAEgLjivD_BwE) The SW I've based this off of is : https://github.com/ljezny/Particle-HAP.

earlthesquirrel commented 4 years ago

I could try changing the pairing code in my code... not sure if that would do it... Just wanted to make sure no left over data was orphaned...

jlusiardi commented 4 years ago

https://github.com/ljezny/Particle-HAP/blob/master/src/HKPersistor.cpp#L19 suggests it is stored in some kind of eeprom. Perhaps https://community.particle.io/t/how-to-do-a-factory-reset/2579 might help, but you need to reinstall the homekit code again.

jlusiardi commented 4 years ago

Hello @earlthesquirrel is there anything more we can do here?

jlusiardi commented 4 years ago

I do not think we can do much here