diff --git a/jetlinks-manager/device-manager/src/main/java/org/jetlinks/community/device/service/DeviceMessageBusinessHandler.java b/jetlinks-manager/device-manager/src/main/java/org/jetlinks/community/device/service/DeviceMessageBusinessHandler.java index 2acb924f2..b3368f7ee 100644 --- a/jetlinks-manager/device-manager/src/main/java/org/jetlinks/community/device/service/DeviceMessageBusinessHandler.java +++ b/jetlinks-manager/device-manager/src/main/java/org/jetlinks/community/device/service/DeviceMessageBusinessHandler.java @@ -103,7 +103,10 @@ private Mono doAutoRegister(DeviceRegisterMessage message) { instance.setCreateTimeNow(); instance.setCreatorId(tps.getT4().getCreatorId()); instance.setOrgId(tps.getT4().getOrgId()); - + //网关ID + message.getHeader(DeviceConfigKey.parentGatewayId.getKey()) + .map(String::valueOf) + .ifPresent(instance::setParentId); //设备自状态管理 //网关注册设备子设备时,设置自状态管理。 //在检查子设备状态时,将会发送ChildDeviceMessage到网关