michielpost / Q42.HueApi

C# helper library to talk to the Philips Hue bridge
MIT License
411 stars 114 forks source link

README.md has a bug #167

Closed kundelstein closed 5 years ago

kundelstein commented 5 years ago

README.md has a bug in example implementation:

command.Alert = Alerts.Once; should be: command.Alert = Alert.Once;

command.Effect = Effects.ColorLoop; should be command.Effect = Effect.ColorLoop;

Also it is very unclear how one should Register the Application with: var appKey = await client.RegisterAsync("mypersonalappname", "mydevicename"); It will throw exception right away as button on the bridge was not pressed. What is intended use case scenario with this? I think it should be at least mentioned here (I know I'm a bit stupid, in original Philips implementation it is done by callbacks, here I have no clue).

michielpost commented 5 years ago

Ok, thanks. I fixed it and added a comment that it will throw an exception if you did not press the bridge button.

kundelstein commented 5 years ago

Thanks, looks great! BTW. Is this the correct way of handling the press? If so - is there any way to get a feedback that user pressed the button (so we don't have to wait any longer)? (sorry for asking here, not sure where I supposed to ask):

  1. create the client (LocalHueClient)
  2. wait for the user to press the button
  3. call RegisterAsync
michielpost commented 5 years ago

yes, but you don't know when the user has pressed the button. So you have to fix that yourself in your app UI. For example you can make a button in your app that says press this button after you pressed the bridge button. Or you can call RegisterAsync every 5 seconds untill it succeeds. Different ways to handle this and it's up to the app to make a nice implementation.

kundelstein commented 5 years ago

Thank you for your answer!