diff --git a/bundles/org.openhab.binding.hue/src/main/java/org/openhab/binding/hue/internal/api/dto/clip2/enums/ResourceType.java b/bundles/org.openhab.binding.hue/src/main/java/org/openhab/binding/hue/internal/api/dto/clip2/enums/ResourceType.java index 5dcd2842ac9ab..426e36f95ef7a 100644 --- a/bundles/org.openhab.binding.hue/src/main/java/org/openhab/binding/hue/internal/api/dto/clip2/enums/ResourceType.java +++ b/bundles/org.openhab.binding.hue/src/main/java/org/openhab/binding/hue/internal/api/dto/clip2/enums/ResourceType.java @@ -41,6 +41,7 @@ public enum ResourceType { GEOFENCE_CLIENT, GEOLOCATION, GROUPED_LIGHT, + GROUPED_MOTION, HOMEKIT, LIGHT, LIGHT_LEVEL, diff --git a/bundles/org.openhab.binding.hue/src/main/java/org/openhab/binding/hue/internal/handler/Clip2ThingHandler.java b/bundles/org.openhab.binding.hue/src/main/java/org/openhab/binding/hue/internal/handler/Clip2ThingHandler.java index 947454f4fdd2b..285bf635a06bd 100644 --- a/bundles/org.openhab.binding.hue/src/main/java/org/openhab/binding/hue/internal/handler/Clip2ThingHandler.java +++ b/bundles/org.openhab.binding.hue/src/main/java/org/openhab/binding/hue/internal/handler/Clip2ThingHandler.java @@ -765,7 +765,7 @@ private void putResourceToCache(Resource resource) { * @param fullResources the full list of resources of the given type. */ public void onResourcesList(ResourceType resourceType, List fullResources) { - if (resourceType == ResourceType.SCENE) { + if (SUPPORTED_SCENE_TYPES.contains(resourceType)) { updateSceneContributors(fullResources); } else { fullResources.stream().filter(r -> resourceId.equals(r.getId())).findAny() diff --git a/bundles/org.openhab.binding.hue/src/test/java/org/openhab/binding/hue/internal/clip2/Clip2DtoTest.java b/bundles/org.openhab.binding.hue/src/test/java/org/openhab/binding/hue/internal/clip2/Clip2DtoTest.java index 78b33e3d9ba3f..6104c6fbe1005 100644 --- a/bundles/org.openhab.binding.hue/src/test/java/org/openhab/binding/hue/internal/clip2/Clip2DtoTest.java +++ b/bundles/org.openhab.binding.hue/src/test/java/org/openhab/binding/hue/internal/clip2/Clip2DtoTest.java @@ -914,4 +914,21 @@ void testBehaviorInstance() { 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 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"))); + } } diff --git a/bundles/org.openhab.binding.hue/src/test/resources/grouped_motion.json b/bundles/org.openhab.binding.hue/src/test/resources/grouped_motion.json new file mode 100644 index 0000000000000..9b052e2aa919b --- /dev/null +++ b/bundles/org.openhab.binding.hue/src/test/resources/grouped_motion.json @@ -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" + } + ] +}