Skip to content

Commit

Permalink
fix: scan each TP-link device only once
Browse files Browse the repository at this point in the history
  • Loading branch information
plaa committed Jun 30, 2024
1 parent ce1811a commit 0d0f6c6
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/tplink/tplink-control.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@ const client = new Client();

export async function scanTplinkDevices() {
const dmxConfig = store.getState().data.tplink.dmxconfig;
const ipaddresses = dmxConfig.signals.map(signal => signal.ip);
const ipaddresses: string[] = dmxConfig.signals.map(signal => signal.ip);
const uniqueIpAddresses = [...new Set(ipaddresses)];
const devices = {};
for (let ip of ipaddresses) {
for (let ip of uniqueIpAddresses) {
try {
logger.debug(`Scanning TP-link device: ${ip}`);
const device = await client.getDevice({ host: ip });
Expand Down

0 comments on commit 0d0f6c6

Please sign in to comment.