如何打开和关闭PHILPS HUE灯 [英] how to switch on and off PHILPS HUE lights
问题描述
我正在使用 HUE-Emulator 来查看更改.仿真器在
I am using HUE-Emulator to view the changes.Emulator is running on port 80
.
目前,我只能使用浏览器查看详细信息.(API调用)
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.
我得到的配置:
推荐答案
如果您从Hue仿真器阅读文档,您会注意到BridgeSearch仅在桥仿真器在端口80上运行时才有效.
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"];
我建议您下载提供的示例iOS应用程序由PhilipsHue进行尝试.
I would suggest you download the sample iOS application provided by PhilipsHue and try it out.
这篇关于如何打开和关闭PHILPS HUE灯的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!