LIFX / LIFXKit

The LIFX SDK for Objective-C.
MIT License
122 stars 76 forks source link

Public Refresh method #15

Open kylehowells opened 9 years ago

kylehowells commented 9 years ago

As far as I can tell there there is no API to refresh for more lights, it is just expected the API will continue to work.

I have noticed that in practice it loses lights after long periods of time. My OSX menu bar app starts with the computer and then sits there all day and night. Eventually I've noticed it will think there are 0 lights available and sending the -allLightCollection a set power ON or OFF message does nothing.

However, opening the iOS LIFX app on my phone causes a fresh to occur and everything to suddenly be seen again. The app also has a refresh button in the left side panel at the bottom. I presume this button is calling -[LFXNetworkContext scanNetworkForLightStates] which is marked as private.

That method, or simply a stub -refresh method that just calls that method as an internal implementation detail if you wish to abstract it, needs to be made public so that 3rd party apps are capable of providing the user with a 'refresh' button if the application falls out of sync with reality.

frakman1 commented 9 years ago

Agreed. I did NSTimer loop with the following:

    LFXNetworkContext *localNetworkContext = [[LFXClient sharedClient] localNetworkContext];

    for (LFXLight *aLight in localNetworkContext.allLightsCollection)
    {
         NSLog(@"%@",aLight);
    }

and it lists the same 3 bulbs forever even AFTER I've disconnected one from power!