Fixes #897 by adding just enough functionality to support aiohue's (ab)use of a geofence_client resource - creating one with a POST and periodically updating it with a PUT, generating an event for the event stream each time.
In testing I've found that the event stream isn't very reliable at passing messages through to the client - I'm not sure if that's an artefact of my dev environment, but it does eventually settle down if left running for a few minutes.
One addition I'm not sure about is returning an HTTP 500 error to clients when presented with resources through POST or PUT that diyHue doesn't support, rather than either silently failing or (as was happening in #897) dumping stack traces to the logs. Experience tells me that's usually a better way to handle it, but if any current diyHue clients are relying on the existing behaviour this might cause problems. Happy to back out that part of these changes if you'd prefer.
Fixes #897 by adding just enough functionality to support aiohue's (ab)use of a
geofence_client
resource - creating one with aPOST
and periodically updating it with aPUT
, generating an event for the event stream each time.In testing I've found that the event stream isn't very reliable at passing messages through to the client - I'm not sure if that's an artefact of my dev environment, but it does eventually settle down if left running for a few minutes.
One addition I'm not sure about is returning an HTTP 500 error to clients when presented with resources through
POST
orPUT
that diyHue doesn't support, rather than either silently failing or (as was happening in #897) dumping stack traces to the logs. Experience tells me that's usually a better way to handle it, but if any current diyHue clients are relying on the existing behaviour this might cause problems. Happy to back out that part of these changes if you'd prefer.