mirror of
https://github.com/openhab/openhab-addons.git
synced 2025-01-10 07:02:02 +01:00
[hue] Recognise grouped_motion
and smart_scene
resources (#17905)
Signed-off-by: Andrew Fiddian-Green <software@whitebear.ch>
This commit is contained in:
parent
9544767641
commit
856fa74459
@ -41,6 +41,7 @@ public enum ResourceType {
|
||||
GEOFENCE_CLIENT,
|
||||
GEOLOCATION,
|
||||
GROUPED_LIGHT,
|
||||
GROUPED_MOTION,
|
||||
HOMEKIT,
|
||||
LIGHT,
|
||||
LIGHT_LEVEL,
|
||||
|
@ -765,7 +765,7 @@ public class Clip2ThingHandler extends BaseThingHandler {
|
||||
* @param fullResources the full list of resources of the given type.
|
||||
*/
|
||||
public void onResourcesList(ResourceType resourceType, List<Resource> fullResources) {
|
||||
if (resourceType == ResourceType.SCENE) {
|
||||
if (SUPPORTED_SCENE_TYPES.contains(resourceType)) {
|
||||
updateSceneContributors(fullResources);
|
||||
} else {
|
||||
fullResources.stream().filter(r -> resourceId.equals(r.getId())).findAny()
|
||||
|
@ -914,4 +914,21 @@ class Clip2DtoTest {
|
||||
assertNotNull(list);
|
||||
assertEquals(2, list.size());
|
||||
}
|
||||
|
||||
@Test
|
||||
void testGroupedMotion() {
|
||||
String json = load(ResourceType.GROUPED_MOTION.name().toLowerCase());
|
||||
Resources resources = GSON.fromJson(json, Resources.class);
|
||||
assertNotNull(resources);
|
||||
List<Resource> list = resources.getResources();
|
||||
assertNotNull(list);
|
||||
assertEquals(1, list.size());
|
||||
Resource item = list.get(0);
|
||||
assertEquals(ResourceType.GROUPED_MOTION, item.getType());
|
||||
Boolean enabled = item.getEnabled();
|
||||
assertNotNull(enabled);
|
||||
assertTrue(enabled);
|
||||
assertEquals(OnOffType.ON, item.getMotionState());
|
||||
assertEquals(new DateTimeType("2024-12-13T11:01:25.156Z"), item.getMotionLastUpdatedState(ZoneId.of("UTC")));
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,21 @@
|
||||
{
|
||||
"errors": [],
|
||||
"data": [
|
||||
{
|
||||
"id": "aab07fb5-b0c1-400b-828f-a9e0a05394f9",
|
||||
"id_v1": "/sensors/5",
|
||||
"enabled": true,
|
||||
"motion": {
|
||||
"motion_report": {
|
||||
"changed": "2024-12-13T11:01:25.156Z",
|
||||
"motion": true
|
||||
}
|
||||
},
|
||||
"owner": {
|
||||
"rid": "bb9b4bb4-b0c8-4b6a-8dc0-85add8f77964",
|
||||
"rtype": "bridge_home"
|
||||
},
|
||||
"type": "grouped_motion"
|
||||
}
|
||||
]
|
||||
}
|
Loading…
Reference in New Issue
Block a user