-
Notifications
You must be signed in to change notification settings - Fork 30
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
Disconnecting lights Bug? - lightCollectionDidRemoveLight() not being called. #10
Comments
To partially answer my own issue, it seems if you listen to the networkContextDidDisconnect() and networkContextDidConnect() callbacks and then manually call mLIFXContext.resetAllCaches() when either is called you can get the system to make the lightCollectionDidRemoveLight() callback. However this only works if you have one bulb or if you're switching off the gateway bulb when you have more than one. If for example you have two bulbs and you switch off the non-gateway bulb then you won't get any lightCollectionDidRemoveLight() callback. Getting closer.... Some more detailed API docs would be soooooo helpful, come on LIFX, you listening??? |
Hi Cakey, Apologies for the slow reply, I'll definitely look into this as soon as I get a chance, there should indeed be a timeout on the light after it is hard powered off. Thanks very much for the feedback! EDIT: Sorry for the mistaken answer here, we did have a timeout built in for a long time, however it led to som UX issues where users could see bulbs jumping in and out of the available bulbs. We chose to remove the timeout until the comms are more reliable. |
To answer a few of the questions above: Because of the flakey coms, we do not currently time out lights that have been hard powered off, relying on a timeout causes lights to be removed and re-added when they miss a time out cycle. When the new firmware is released, we will be revisiting some of these decisions but for now the bulbs will not be removed from the collection once they have been seen. |
The Idle timeout continuing after the app has been close is a definite bug however. |
So I've now got working lights, a fudged listener to pick up new lights in the collection with the correct labels.
Can anyone explain what should happen when I physically switch off a light??
My expectation what that it would timeout in the library and I would get a lightCollectionDidRemoveLight() callback in the same way we get a callback when one is added.
However I'm not getting any callback to lightCollectionDidRemoveLight(), the only way I can seem to make a light vanish is to switch it off, wait a couple of minutes and then restart my app and then its gone from mLIFXContext.getAllLightsCollection().
I can see logcat messages from the system warning of "Idle timeout occured on UDP connection ...... disconnecting.....Connection state did change called. Getting those message about every 20 seconds after a short time after switchoff.
But it seems whatever I do mLIFXContext.getAllLightsCollection() is still returning the switched off bulb, even 10 minutes after power off. What I do see is a networkContextDidDisconnect() if only one bulb was switched on. With two bulbs I see networkContextDidDisconnect() and networkContextDidConnect() if I switch off the gateway bulb but still no damn DidRemoveLight().
So at the moment I'm stuck with bulbs that get added but never removed.
The text was updated successfully, but these errors were encountered: