PhilipsHue / PhilipsHueSDK-iOS-OSX

The Software Development Kit for Philips Hue on iOS and OS X (beta)
579 stars 168 forks source link

Updates on Groups require the the bridge to be restarted #15

Closed Muskelkatermann closed 10 years ago

Muskelkatermann commented 11 years ago

When I change the groupsettings with

I have to restart the bridge (By unplugging the powerconnection) to make my changes take effect. Changes in this case are creating and removing groups and adding are removing lights to a group.

Example: I have a group with Light 1 and 2 and i can set the group state like On/Off that works fine.

Now I change the group: group.lightIdentifiers = [NSArray arrayWithObjects:@"1",@"2",@"3", nil];

And Update the bridge: [bridgeSendAPI updateGroupWithGroup:group completionHandler:^(NSArray *errors) ...

The bridge is updated correctly, Light 3 was added to the Lights Array. I can see that by calling: http://192.168.2.110/api/2beb86671081cadfa6d605712c826cf/groups/3/

When I send On/Off statechanges to this group only Light 1 and 2 are controlled. After I restart the bridge by unplugging the powerconnection Light 3 is controlled too.

twam commented 11 years ago

I can create groups without any problems by

id<PHBridgeSendAPI> bridgeSendAPI = [[[PHOverallFactory alloc] init] bridgeSendAPI];
NSMutableArray *array = [NSMutableArray array];
[array addObject:@"1"];

[bridgeSendAPI createGroupWithName:@"test" lightIds:array completionHandler:^(NSString *groupIdentifier, NSArray *errors) {
    NSLog(@"Added group %@", groupIdentifier);
}];

but when I try to remove with removeGroupWithId nothing happens. Even the completion handler is never called. :(

twam commented 11 years ago

Now deletion also works. I was storing the bridgeSendAPI in a weak property of my object and that seemed to be the problem.

Muskelkatermann commented 11 years ago

Have you tried to use the group, like toggle the group's powerstate on and off?

I can create and edit the groups and change it's lightstate without problems. All changes i make to the groups are saved correctly in the bridge. But as long as I don't restart the bridge, the lights are not reacting to changes of the group's lightstate. Maybe there is an internal light / group assignment that is only updated when the bridge restarts?!?

kevintoms commented 11 years ago

Please not that using groups other than group 0 is not currently supported. See http://developers.meethue.com/2_groupsapi.html - section 2.1.1. If you are using other groups the functionality is undefined.

kevintoms commented 11 years ago

Please note that the bridge update to firmware that is being rolled out now, fixes this problem and groups other than 0 now work correctly.

twam commented 11 years ago

So the statement 'At present only a limited number of these APIs are supported in the firmware so only control of groups/0 is supported.' in the API documentation is no longer valid?

kevintoms commented 11 years ago

Yes it is only valid for the old bridge firmware. The API documentation will be updated to clarify this too.