Skip to content
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

Ability to determine there are no LIFX bulbs available #4

Open
yonilevy opened this issue Mar 29, 2014 · 9 comments
Open

Ability to determine there are no LIFX bulbs available #4

yonilevy opened this issue Mar 29, 2014 · 9 comments

Comments

@yonilevy
Copy link

There seems to be no way to determine there are no LIFX bulbs available in the network. Obviously this can't be done without a timeout, but would be nice if you could provide such functionality with your library as you'd probably choose a better minimum timeout than I would. Also it's a bit weird that the LIFX Browser demo app suffers from this behaviour (is stuck in "searching" forever).

@yonilevy
Copy link
Author

Another related issue: let's say I have 2 light bulbs connected (correctly detected by the library), and I turn one off. IIUC the library won't tell me that through the
- (void)lightCollection:(LFXLightCollection *)lightCollection didRemoveLight:(LFXLight *)light
API (or in any other way), although I would expect it to. This is related to timing out as well: you seem to be scanning the network every 30 seconds for light state, perhaps you could consider lights not responding within X seconds as being removed from the network.

@nsforge
Copy link

nsforge commented Apr 2, 2014

@yonilevy on the first issue: the exact way in which each specific app manages or responds to a LIFX discovery timeout may be quite different, so we've left it out of the SDK for now, but we may add it in the future.

On the second issue: there is a .reachability on LFXLight which is intended to be used for this purpose. There currently isn't an observer callback for when .reachability changes, but that's something that we plan on implementing in the LFXLightObserver protocol.

@ArquintL
Copy link

@nsforge as you suggested, I check every second the reachability of all the lights. If you power on a bulb (with the wall switch), the SDK detects the new bulb immediately (when the bulb is connected to WiFi and blinks), but when I turn it off with the wall switch, then the reachability changes only after 28 seconds.

@nsforge
Copy link

nsforge commented Apr 20, 2014

Due to the way the LIFX network currently works, this is the best (and fastest) way to find out if a device is reachable or not. We may be able to improve the speed of this in the future, but it depends on a complex combination of network architecture, firmware and client code.

Is there a specific reason you want LFXLight.reachability to trigger straight away? Do you have a specific feature that depends on it, or is it just that you'd like your UI to update instantaneously?

@ArquintL
Copy link

@nsforge thank you for your fast answer! I use the reachability of the lights just for the UI (to let the user know how many lights are connected), so it's not that important, I just wanted to know if this is normal/expected

@kuzmycz
Copy link

kuzmycz commented Apr 21, 2014

I think it is necessary to have an event triggered when the reachability of an item changed. Polling the reachability of a light can impact battery life of devices. I currently have a timer checking every 20 seconds and this is sufficient for my needs; however, I would prefer an event via either a callback or message.

@daz
Copy link

daz commented May 2, 2014

I'm seeing the same as @LArquint when you turn a light off, it's 23 - 28 seconds before reachability is update to off.

A problem I'm seeing is turning the light back on after it's removed, I can't seem to pick it up again. I tried looping though lifxNetworkContext.allLightsCollection.lights but it doesn't seem to change even after a light is removed - same count, same lights. Is there a way to refresh lifxNetworkContext?

@daz
Copy link

daz commented May 5, 2014

How does the refresh button work on the official LIFX app?

@kylehowells
Copy link

@daz A private method on LFXNetworkContext I'm guessing #15

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants