etwmc / Personal-HomeKit-HAP

This project will provide source code to build a HomeKit support accessories.
MIT License
236 stars 84 forks source link

Sending updated value question. #63

Open efeion opened 8 years ago

efeion commented 8 years ago

Hello, I have had good success so far with getting an accessory setup. Initial values are displayed and controls sent from my iPhone are working. The thing I am now stuck on is how to notify that there was an update on the accessory? It does not seem like the home app polls for it at any regular interval so the values do not update on their own. I see there is a updateValueFromDeviceEnd() function which sounded promising, but that does not seem to cause any update on my iPhone. Is there a proper way to handle when the accessory has an updated value?

etwmc commented 8 years ago
  1. Maybe you need to uncomment line 199 in PHKNetwork.cpp (I have no idea how it runs now, so it becomes a brute force hacking again)
  2. It's a push notification, so it require server end to notify
  3. in ideal world, you just call updateValueFromDeviceEnd() when the value change, and the notification will push it to all connected clients, but if PHKNetwork.cpp has an encryption problem, iOS will drop the packet and start reconnect. (Sorry for taking so long, currently focusing on job hunting)