diff --git a/bundles/org.smarthomej.binding.tuya/src/main/java/org/smarthomej/binding/tuya/internal/TuyaDiscoveryService.java b/bundles/org.smarthomej.binding.tuya/src/main/java/org/smarthomej/binding/tuya/internal/TuyaDiscoveryService.java index 5a706e60c8..1b5d365d01 100644 --- a/bundles/org.smarthomej.binding.tuya/src/main/java/org/smarthomej/binding/tuya/internal/TuyaDiscoveryService.java +++ b/bundles/org.smarthomej.binding.tuya/src/main/java/org/smarthomej/binding/tuya/internal/TuyaDiscoveryService.java @@ -19,6 +19,7 @@ import static org.smarthomej.binding.tuya.internal.TuyaBindingConstants.PROPERTY_MAC; import static org.smarthomej.binding.tuya.internal.TuyaBindingConstants.THING_TYPE_TUYA_DEVICE; +import java.util.Collection; import java.util.Date; import java.util.HashMap; import java.util.List; @@ -28,6 +29,7 @@ import java.util.concurrent.ScheduledFuture; import java.util.concurrent.TimeUnit; import java.util.stream.Collectors; +import java.util.stream.Stream; import org.eclipse.jdt.annotation.NonNullByDefault; import org.eclipse.jdt.annotation.Nullable; @@ -114,7 +116,12 @@ private void processDevice(DeviceListInfo device, TuyaOpenAPI api) { .withRepresentationProperty(CONFIG_DEVICE_ID).withProperties(properties).build(); api.getDeviceSchema(device.id).thenAccept(schema -> { - List schemaDps = schema.functions.stream().map(fcn -> SchemaDp.fromRemoteSchema(gson, fcn)) + List functionDps = schema.functions.stream().map(fcn -> SchemaDp.fromRemoteSchema(gson, fcn)) + .collect(Collectors.toList()); + List statusDps = schema.status.stream() + .filter(status -> functionDps.stream().noneMatch(functionDp -> functionDp.id == status.dp_id)) + .map(status -> SchemaDp.fromRemoteSchema(gson, status)).collect(Collectors.toList()); + List schemaDps = Stream.of(functionDps, statusDps).flatMap(Collection::stream) .collect(Collectors.toList()); storage.put(device.id, gson.toJson(schemaDps)); });