diff --git a/src/platform/OpenThread/GenericThreadStackManagerImpl_OpenThread.cpp b/src/platform/OpenThread/GenericThreadStackManagerImpl_OpenThread.cpp index 10d9bf94a530e1..6e59b2e8d0df60 100644 --- a/src/platform/OpenThread/GenericThreadStackManagerImpl_OpenThread.cpp +++ b/src/platform/OpenThread/GenericThreadStackManagerImpl_OpenThread.cpp @@ -1152,8 +1152,24 @@ CHIP_ERROR GenericThreadStackManagerImpl_OpenThread::_WriteThreadNetw app::DataModel::Nullable averageRssi; app::DataModel::Nullable lastRssi; - averageRssi.SetNonNull(neighInfo.mAverageRssi); - lastRssi.SetNonNull(neighInfo.mLastRssi); + if (neighInfo.mAverageRssi == OT_RADIO_RSSI_INVALID) + { + averageRssi.SetNull(); + } + else + { + // Thread average calculation already restrict mAverageRssi to be between -128 and 0 + averageRssi.SetNonNull(neighInfo.mAverageRssi); + } + + if (neighInfo.mAverageRssi == OT_RADIO_RSSI_INVALID) + { + lastRssi.SetNull(); + } + else + { + lastRssi.SetNonNull(((neighInfo.mLastRssi > 0) ? 0 : neighInfo.mLastRssi)); + } neighborTable.averageRssi = averageRssi; neighborTable.lastRssi = lastRssi;