diyhue / diyHue

Main diyHue software repo
https://diyhue.org/
Other
1.55k stars 275 forks source link

Hue Entertainment not unbinding correctly when timed out #58

Closed vlad-the-compiler closed 5 years ago

vlad-the-compiler commented 5 years ago

Bug Description The Hue Entertainment support does not handle the case in which the device/application syncing the lights with an entertainment area crashes unexpectedly/stops syncing without explicitly telling the bridge emulator that it is about to stop gracefully. This results in the bridge emulator thinking that sync is still active, even if no more packets are sent. This breaks functionality with the Hue Sync app for Windows across restarts.

Steps To Reproduce

  1. Download Hue Sync for Windows
  2. Start synchronizing with an Entertainment Area
  3. Restart PC without stopping sync manually via the Hue Sync app
  4. Notice how Hue Sync now states that the bridge is unreachable, and that someone else(really us, but the session hasn't been cleared) is syncing with our Entertainment Area
  5. On the Pi, sudo systemctl restart hue-emulator.service in order to clear the entertainment session state
  6. Hue Sync is now able to properly connect

This issue does not happen if the user goes into the Hue Sync app and manually disables sycing before shutting the computer down/restarting.

Expected behavior When a Hue Entertainment host connects to the emulator and starts syncing, a "session timer" should be started, with a timeout of a few seconds that resets when packets are received. If the timeout is reached, the session should be cleared, thus handling the case in which the host has suffered a force close/crash. As of now, the Hue Sync app either needs to be manually closed before shutting down, or the emulator needs to be restarted after every non-graceful shutdown of a Hue Entertainment-enabled app.

mariusmotea commented 5 years ago

Well know issue. Restart hue-emulator service to fix this. So far i don't have a methot to detect broadcast status

vlad-the-compiler commented 5 years ago

I think I fixed it. Did some testing and it sure works correctly now when the computer shuts down and the stream stops without notice.