NetgearRouter

NetgearRouter

Class representing a session with a Netgear router.

Constructor

new NetgearRouter(optionsopt)

Properties:
Name Type Description
loggedIn boolean

login state.

Example
// create a router session, login to router, fetch attached devices
	const Netgear = require('netgear');

	const router = new Netgear();

	async function getDevices() {
		try {
			const options = { password: 'myPassword' };
			await router.login(options);
			const deviceArray = await router.getAttachedDevices();
			console.log(deviceArray);
		} catch (error) {
			console.log(error);
		}
	}

	getDevices();
Parameters:
Name Type Attributes Description
options sessionOptions <optional>

configurable session options

Methods

(async) checkNewFirmware() → {Promise.<newFirmwareInfo>}

Check present firmware level, and new firmware level if available

Returns:
Type
Promise.<newFirmwareInfo>

(async) discover() → {Promise.<currentSetting>}

Discovers a netgear router in the network. Also sets the discovered ip address and soap port for this session.

Returns:

The discovered router info, including host ip address and soap port.

Type
Promise.<currentSetting>

(async) enableParentalControl(enable) → {Promise.<finished>}

Enable or Disable Parental Controls

Parameters:
Name Type Description
enable boolean

true to enable, false to disable.

Returns:
Type
Promise.<finished>

(async) enableTrafficMeter(enable) → {Promise.<finished>}

Enable or Disable Traffic Meter statistics

Parameters:
Name Type Description
enable boolean

true to enable, false to disable.

Returns:
Type
Promise.<finished>

(async) get5G1ChannelInfo() → {Promise.<channel>}

Get 5G-2 Wifi channel info

Returns:
Type
Promise.<channel>

(async) get5GChannelInfo() → {Promise.<channel>}

Get 5G-1 Wifi channel info

Returns:
Type
Promise.<channel>

(async) get5GGuestWifi2Enabled() → {Promise.<enabled>}

Get 5GHz-2 guest Wifi status

Returns:
Type
Promise.<enabled>

(async) get5GGuestWifiEnabled() → {Promise.<enabled>}

Get 5GHz-1 guest Wifi status

Returns:
Type
Promise.<enabled>

(async) getAttachedDevices(methodopt) → {Promise.<Array.<AttachedDevice>>}

Get array of attached devices.

Parameters:
Name Type Attributes Default Description
method number <optional>
0

0: auto, 1: v1 (old), 2: v2 (new)

Returns:
Type
Promise.<Array.<AttachedDevice>>

(async) getBandwidthControlOptions() → {Promise.<{newUplinkBandwidth, newDownlinkBandwidth, enabled}>}

Get Bandwidt Control options

Returns:
Type
Promise.<{newUplinkBandwidth, newDownlinkBandwidth, enabled}>

(async) getBlockDeviceEnableStatus() → {Promise.<blockDeviceEnabled>}

Get BlockDeviceEnabled status (= device access control)

Returns:
Type
Promise.<blockDeviceEnabled>

(async) getChannelInfo() → {Promise.<channel>}

Get 2.4G Wifi channel info

Returns:
Type
Promise.<channel>

(async) getCurrentBandwidthByMAC() → {Promise.<{currentDeviceUpBandwidth, currentDeviceDownBandwidth}>}

Get QOS getCurrentAppBandwidthByMAC. Only works on R7000

Returns:
Type
Promise.<{currentDeviceUpBandwidth, currentDeviceDownBandwidth}>

(async) getCurrentDeviceBandwidth() → {Promise.<currentDeviceBandwidth>}

Get QOS Device bandwith. Only works on R7000

Returns:
Type
Promise.<currentDeviceBandwidth>

(async) getCurrentSetting(hostopt) → {Promise.<currentSetting>}

Get router information without need for credentials. Autodiscovers the SOAP port and TLS

Parameters:
Name Type Attributes Description
host string <optional>

The url or ip address of the router.

Returns:
Type
Promise.<currentSetting>

(async) getDeviceConfig() → {Promise.<deviceConfig>}

Get Device Config.

Returns:
Type
Promise.<deviceConfig>

(async) getDeviceListAll() → {Promise.<Array.<allowedDevice>>}

Get Allowed Device list.

Returns:
Type
Promise.<Array.<allowedDevice>>

(async) getEthernetLinkStatus() → {Promise.<ethernetLinkStatus>}

Get Internet connection status, e.g. 'Up'

Returns:
Type
Promise.<ethernetLinkStatus>

(async) getGuestWifiEnabled() → {Promise.<enabled>}

Get 2.4GHz-1 guest Wifi status

Returns:
Type
Promise.<enabled>

(async) getInfo() → {Promise.<info>}

Get router information.

Returns:
Type
Promise.<info>

(async) getLANConfig() → {Promise.<LANConfig>}

Get LAN config

Returns:
Type
Promise.<LANConfig>

(async) getNTPServers() → {Promise.<NTPservers>}

Get NTP servers.

Returns:
Type
Promise.<NTPservers>

(async) getParentalControlEnableStatus() → {Promise.<parentalControlEnabled>}

Get Parental Control Enable Status (true / false).

Returns:
Type
Promise.<parentalControlEnabled>

(async) getPortMappingInfo() → {Promise.<portMapping>}

Get Port Mapping Info

Returns:
Type
Promise.<portMapping>

(async) getQoSEnableStatus() → {Promise.<qosEnabled>}

Get QoS Enable Status (true / false).

Returns:
Type
Promise.<qosEnabled>

(async) getSmartConnectEnabled() → {Promise.<smartConnectEnabled>}

Get smartConnect Enable Status (true / false).

Returns:
Type
Promise.<smartConnectEnabled>

(async) getSupportFeatureListXML() → {Promise.<supportFeatureList>}

Get router SupportFeatureList.

Returns:
Type
Promise.<supportFeatureList>

(async) getSystemInfo() → {Promise.<systemInfo>}

Get system Info.

Returns:
Type
Promise.<systemInfo>

(async) getSystemLogs(parseopt) → {Promise.<logs>}

Get router logs.

Parameters:
Name Type Attributes Default Description
parse boolean <optional>
false

will parse the results to json if true

Returns:
Type
Promise.<logs>

(async) getSysUpTime() → {Promise.<hh:mm:ss>}

Get router uptime since last boot.

Returns:
Type
Promise.<hh:mm:ss>

(async) getTimeZoneInfo() → {Promise.<timeZoneInfo>}

Get TimeZone.

Returns:
Type
Promise.<timeZoneInfo>

(async) getTrafficMeter() → {Promise.<trafficStatistics>}

Get traffic meter statistics.

Returns:
Type
Promise.<trafficStatistics>

(async) getTrafficMeterEnabled() → {Promise.<trafficMeterEnabled>}

Get Traffic Meter Enable Status (true / false).

Returns:
Type
Promise.<trafficMeterEnabled>

(async) getTrafficMeterOptions() → {Promise.<{newControlOption, newNewMonthlyLimit, restartHour, restartMinute, restartDay}>}

Get Traffic Meter options

Returns:
Type
Promise.<{newControlOption, newNewMonthlyLimit, restartHour, restartMinute, restartDay}>

(async) getWANConfig() → {Promise.<WANConfig>}

Get WAN config

Returns:
Type
Promise.<WANConfig>

(async) getWANConnectionType() → {Promise.<WANConnectionType>}

Get WAN Connection Type

Returns:
Type
Promise.<WANConnectionType>

(async) getWANDNSLookUpStatus() → {Promise.<WANDNSLookUpStatus>}

Get WAN DNS LookUpStatus

Returns:
Type
Promise.<WANDNSLookUpStatus>

(async) getWANInternetPort() → {Promise.<WANInternetPort>}

Get WAN Internet Port Info

Returns:
Type
Promise.<WANInternetPort>

(async) getWifiChannels(bandopt) → {Promise.<Array.<channels>>}

Get available Wifi channels

Parameters:
Name Type Attributes Default Description
band string <optional>
'2.4G'

'2.4G', '5G' or '5G1'

Returns:
Type
Promise.<Array.<channels>>

(async) login(optionsopt) → {Promise.<loggedIn>}

Login to the router. Passing options will override any existing session settings. If host or port are not set, login will try to auto discover these.

Parameters:
Name Type Attributes Description
options sessionOptions <optional>

configurable session options

Returns:

The loggedIn state.

Type
Promise.<loggedIn>

(async) logout() → {Promise.<loggedIn>}

Logout from the router.

Returns:

The loggedIn state.

Type
Promise.<loggedIn>

(async) reboot() → {Promise.<finished>}

Reboot the router

Returns:
Type
Promise.<finished>

(async) set5GGuestWifi(enable) → {Promise.<wifiSetMethod>}

Enable or Disable 5GHz-1 guest Wifi

Parameters:
Name Type Description
enable boolean

true to enable, false to disable.

Returns:
Type
Promise.<wifiSetMethod>

(async) set5GGuestWifi2(enable) → {Promise.<wifiSetMethod>}

Enable or Disable 5GHz-2 guest Wifi

Parameters:
Name Type Description
enable boolean

true to enable, false to disable.

Returns:
Type
Promise.<wifiSetMethod>

(async) setBandwidthControlOptions(newUplinkBandwidth, newDownlinkBandwidth) → {Promise.<finished>}

sets Qos bandwidth options

Parameters:
Name Type Description
newUplinkBandwidth number

maximum uplink bandwidth (Mb/s).

newDownlinkBandwidth number

maximum downlink bandwidth (Mb/s).

Returns:
Type
Promise.<finished>

(async) setBlockDevice(MAC, AllowOrBlock) → {Promise.<MAC>}

Enable or Disable BlockDevice (= device access control)

Parameters:
Name Type Description
MAC string

MAC address of the device to block or allow.

AllowOrBlock string

either 'Allow' or 'Block'.

Returns:
Type
Promise.<MAC>

(async) setBlockDeviceEnable(enable) → {Promise.<finished>}

Enable or Disable BlockDevice (= device access control)

Parameters:
Name Type Description
enable boolean

true to enable, false to disable.

Returns:
Type
Promise.<finished>

(async) setGuestWifi(enable) → {Promise.<wifiSetMethod>}

Enable or Disable 2.4GHz-1 guest Wifi

Parameters:
Name Type Description
enable boolean

true to enable, false to disable.

Returns:
Type
Promise.<wifiSetMethod>

(async) setNetgearDeviceName(name) → {Promise.<finished>}

Set the device name

Parameters:
Name Type Description
name string

e.g. 'MyNetgearRouter'

Returns:
Type
Promise.<finished>

(async) setQoSEnableStatus(enable) → {Promise.<finished>}

Enable or Disable QoS

Parameters:
Name Type Description
enable boolean

true to enable, false to disable.

Returns:
Type
Promise.<finished>

(async) setSmartConnectEnabled(enable) → {Promise.<finished>}

Enable or Disable smartConnect

Parameters:
Name Type Description
enable boolean

true to enable, false to disable.

Returns:
Type
Promise.<finished>

(async) setWifiChannel(channelopt, bandopt) → {Promise.<finished>}

Set the wifi channel

Parameters:
Name Type Attributes Default Description
channel string <optional>
'Auto'

e.g. '6'

band string <optional>
'2.4G'

'2.4G', '5G' or '5G1'

Returns:
Type
Promise.<finished>

(async) speedTest() → {Promise.<speed>}

Perform Internet bandwidth speedtest (Note: takes a minute to respond)

Returns:
Type
Promise.<speed>

(async) updateNewFirmware() → {Promise.<finished>}

Update the firmware of the router

Returns:
Type
Promise.<finished>

(async) wol(MAC, secureOnPasswordopt) → {Promise.<finished>}

Send Wake On Lan command to a mac address

Parameters:
Name Type Attributes Default Description
MAC string

MAC address of the device to wake.

secureOnPassword string <optional>
'00:00:00:00:00:00'

optional WOL Password.

Returns:
Type
Promise.<finished>