DylanPiercey / local-devices

🔮 Find devices connected to the current local network.
MIT License
139 stars 27 forks source link

Can't find any (or correct amount of) devices. Instead got undefined on Raspberry Pi. #6

Closed natterstefan closed 5 years ago

natterstefan commented 5 years ago

Hi @DylanPiercey,

as described on Twitter yesterday, I have issues getting results on my Raspberry Pi.

When I run arp -n I get the following 24 results. But running find(192.168.0.66) for instance returns undefined.

At the same time arp -n 192.168.0.66 returns something.

This is my demo snippet on the Pi:

const find = require('local-devices');
// Find all local network devices.

find().then(devices => {
  console.log('FIND ALL', devices);
})

// Find a single device by ip address.
find('192.168.0.66').then(device => {
  console.log('FIND ONE', device);
})

What am I missing? For the record, find() returns a list with 172 results (but I have only 24 devices in the network)

Thanks for your help!

DylanPiercey commented 5 years ago

My guess is the format for the command results is different between macOS and whichever OS you are using on the PI. Would accept a PR to account for this, the parsing of the results is happening here: https://github.com/DylanPiercey/local-devices/blob/master/index.js#L104

Do not currently have the time to dig into this, at least immediately.

natterstefan commented 5 years ago

Okay, I'll try to push something on the weekend or next week @DylanPiercey. Most likely I have some time. Let's see and thanks for the hint!

natterstefan commented 5 years ago

Hi @DylanPiercey, I am sorry I was not able to get back to you earlier. But I already started digging into the topic. During research I stumpled upon the following package and tried to adapt some of the parsing logic into your package. Let's see when I am able to get back to it.