1.0.1 • Published 5 years ago

redi-network-scanner v1.0.1

Weekly downloads
4
License
ISC
Repository
github
Last release
5 years ago

Network Scanner

the simple way to keep your network devices in focus

Install via NPM:

npm i redi-network-scanner --save

Only tested on Raspberry Pi Zero W on NodeJS Version v10.14.2

API

Configuration
nametypedefaultdescriptioninfo
suffixstring.fritz.boxyour network suffix
testfunctionshows ur network scan unparsed
ipstringgets loadedlets you define a fixed ip (faster on startup)
debugboolfalsesome debug logging
offlinetimeoutint5*60time when the offline event should get firedin seconds
scanintervalint1check intervalin seconds
Events
namedescriptionresponse
errordisplays some errors
onlinefired when a new device is in your network{ ip:'xxx.xxx.xxx.xxx', name: 'xyz' }
offlinefired when a device disconnected{ ip:'xxx.xxx.xxx.xxx', name: 'xyz' }
backfired when the disconnect timeout gets canceled{ ip: 'xxx.xxx.xxx.xxx', name: 'xyz', time: MOMENTS_STRING }
lostfired when the device is lost. disconnect timeout gets started here{ ip: 'xxx.xxx.xxx.xxx', name: 'xyz', time: MOMENTS_STRING }
listinitial list of known devices
initinitial function with your config (optional)

Full example as in example.js

const ns = require('redi-network-scanner')
ns.error(data => { console.log(`error`,data) })
ns.online(data => { console.log(`online`,data) })
ns.offline(data => { console.log(`offline`,data) })
// ns.back(data => { console.log(`back`,data) })
// ns.lost(data => { console.log(`lost`,data) })
ns.list(data => { console.log(`list`,data); })
ns.init({
	// test: true,
	// ip: '192.168.178.123',
	// debug: true,
	// suffix: '.fritz.box' // see ns.test() for info.
	// offlinetimeout: 5*60,
	// scaninterval: 1
})