问题
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