Closed vmorris1959 closed 6 years ago
The app keeps that information internally. On bridge level there is no link between a group and a sensor. A Group only contains lights.
If the Phillips Hue app keeps that info internally, how come when opening the native Home app it knows what rooms the sensors belong to?
You are right indeed, my assumption was wrong. After doing some research: the app is using resource links for that. The resource link (which is a resource on the bridge) contains all the resources that have a relation with each other. By going through all the resource links the app can figure out all the relations between the groups/scenes/schedules/sensors
The following code: let links = mybridge.bridgeState.getDevicesOf(.resourceLink) returns an empty array, that means Phillips Hue app is not using those resource links.
You're using the wrong method: myBridge.bridgeState.getResources should be used instead. A resource link is a resource, not a device.
That's true, my bad. getResources does return some links. Thanks.
Using the Phillips Hue app you can assign sensors to rooms (represented in the SDK by PHSGroup) but the SDK offers no way to know where the sensors are currently assign to.
I suggest adding a property sensorIdentifiers to get the ids of the sensors in the same way it has lightIdentifiers for lights.
Am I missing anything here? Any ideas?