Skip to content

Commit

Permalink
ID naming convention had been changed unintentionally.
Browse files Browse the repository at this point in the history
If a device had two instances with the same internal id, both were given the ID 'id_eoj'.
Correctly, only the node profile should have had the ID "id_eoj".
  • Loading branch information
banban525 committed Aug 26, 2024
1 parent b5cbfda commit 02fbbe9
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions server/EchoNetLiteController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ export class EchoNetLiteController{
}

// idが重複している場合は、id_eojの形にする
// ただし、idの重複がnodeProfileともう1つだけなら、nodeProfileのみid_eojの形にする
const deviceIds:DeviceId[] = [];
for(let i = 0; i<deviceIdsTemp.length; i++)
{
Expand All @@ -153,6 +154,18 @@ export class EchoNetLiteController{
{
deviceIds.push(deviceId);
}
else if(matchedDeviceIds.length === 2 &&
matchedDeviceIds.find(_=>_.eoj === "0ef001") !== undefined)
{
if(deviceId.eoj !== "0ef001")
{
deviceIds.push(deviceId);
}
else
{
deviceIds.push({ip:deviceId.ip, eoj:deviceId.eoj, id:`${deviceId.id}_${deviceId.eoj}`});
}
}
else
{
deviceIds.push({ip:deviceId.ip, eoj:deviceId.eoj, id:`${deviceId.id}_${deviceId.eoj}`});
Expand Down

0 comments on commit 02fbbe9

Please sign in to comment.