如何打开和关闭飞利浦HUE灯



我正在使用HUE Emulator查看更改。Emulator正在port 80上运行。

目前我只能使用浏览器查看详细信息。(API调用)

现在我想使用我的应用程序来关闭和打开灯。但我的代码没有检测到桥。我没有使用任何物理设备。我正在模拟器中运行我的应用程序。

我用来查找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
}];
 }

链接到我的模拟器的屏幕截图,以显示一切工作正常。

屏幕截图

我得到的配置:

http://pastebin.com/wzreYSng

如果您从Hue Emulator中读取文档,您会注意到BridgeSearch只有在桥接模拟器在端口80上运行时才能工作。

您发布的配置中的相关部分如下:

"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":""
      }

您可以使用以下代码直接连接到网桥模拟器:

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

我建议您下载PhilipsHue提供的示例iOS应用程序并尝试一下。

最新更新