how to switch on and off PHILPS HUE lights

孤街浪徒 提交于 2020-01-17 08:54:30

问题


I am using HUE-Emulator to view the changes.Emulator is running on port 80.

Currently I am only able to view the details using browser.(API calls)

Now I want to switch off and switch on the lights using my app.But my code doesn't detect the bridge. I am not using any physical device. I am running my app in simulator.

Code I am using to find Bridges

- (void)viewDidLoad {
[super viewDidLoad];

self.phHueSDK = [[PHHueSDK alloc] init];

[self.phHueSDK enableLogging:YES];

// Call startUpSDK which will initialize the SDK
[self.phHueSDK startUpSDK];

self.bridgeSearch = [[PHBridgeSearching alloc] initWithUpnpSearch:YES andPortalSearch:YES];

// Start search for bridges
[self.bridgeSearch startSearchWithCompletionHandler:^(NSDictionary *bridgesFound) {

    NSLog(@"sadsdsa %@",bridgesFound);   //Logs Null
}];

 }

Links to Screen shots of my emulator to show everything works fine.

Screenshot

Config I am getting:

http://pastebin.com/wzreYSng


回答1:


If you read the docs from the Hue Emulator, you will notice that BridgeSearch will work only when the bridge emulator is running on port 80.

The relevant part from the config you posted is as follows:

"config":{  
      "portalservices":false,
      "gateway":"192.168.2.1",
      "mac":"00:00:88:00:bb:ee",
      "swversion":1005215,
      "linkbutton":false,
      "ipaddress":"192.168.2.13:8000",
      "proxyport":0,
      "swupdate":{  
         "text":"",
         "notify":false,
         "updatestate":0,
         "url":""
      }

You can directly connect to the bridge emulator using the code:

[self.phHueSDK setBridgeToUseWithIpAddress:@"192.168.2.13:8000" macAddress:@"00:00:88:00:bb:ee"];

I would suggest you download the sample iOS application provided by PhilipsHue and try it out.



来源:https://stackoverflow.com/questions/29387614/how-to-switch-on-and-off-philps-hue-lights

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!