KarlJorgensen / virgin-media-hub3

Python API and command line interface to the Virgin Media Hub 3 broadband router
GNU General Public License v3.0
77 stars 18 forks source link

hub info gives warning for settings when in Modem Mode #10

Open InternalLoss opened 4 years ago

InternalLoss commented 4 years ago

Now I'm in Modem Mode on my VM Router, im not too surprised there's a small bug:

billy@Billys-MBP virgin-media-hub3 % python3 hub info
modelname : TG2492LG-85
family : 852
hardware_version : 10
serial_number : [REDACTED]
bootcode_version : 4.2.0.45
firmware_version : 9.1.1802.613
name : Home
current_time_status : TODStatus.RETRIEVED
current_time : 2019-10-11 23:54:17
uptime : 16:00:49.920000
first_install_wizard_completed : True
wan_ip_prov_mode : 1
wan_current_ipaddr_ipv4 : None
wan_current_ipaddr_ipv6 : None
/Users/billy/Downloads/virgin-media-hub3/snmp.py:767: UserWarning: SNMP Walk of '1.3.6.1.4.1.4115.1.20.1.1.1.11.2.1' yielded no results
  warnings.warn("SNMP Walk of '%s' yielded no results" % table_oid)
/Users/billy/Downloads/virgin-media-hub3/snmp.py:815: UserWarning: SMTP walk of 1.3.6.1.4.1.4115.1.20.1.1.1.11.2.1 resulted in zero rows
  % table_oid)
dns_servers :
+
|
+
+

I'm going to presume this is likely due to me being in Modem Mode c:

jamesmacwhite commented 4 years ago

I'd imagine some of the commands will return different responses when in modem mode. Perhaps, there needs to be a check for modem mode which I believe will potentially have it's own SNMP OID to query and then prevent certain methods being run when the Hub3 is in modem mode.

Looks like it's the dns_servers method that throws the error for the info command. Either gracefully handling a no results response or prevent certain commands being run when in modem mode would be potential fixes.

There's a JSON endpoint (checkConnType) which returns this:

{
    "conType": "LAN",
    "gwWan": "f",
    "remoteAddr": "192.168.100.2",
    "lang": "English",
    "provMode": "1",
    "dsLite": "0",
    "modemMode": "1",
    "firstInstall": "1"
}

And potentially an SNMP OID request: http://192.168.100.1/snmpGet?oids=1.3.6.1.4.1.4491.2.1.14.1.5.4.0 which returns "1" when on the modem mode page when logged in, potentially this is the OID for modem mode?