Correct value of PowerState.OFF

Fix a bug where setting the PowerState to OFF on the NB-02B was failing
due to OFF=2, where it should have been 0. Also revert to previous
approach of adding basic auth to requests; it worked.

Change-Id: I689085affb7360c8241fcf462090d0e53909fa37
Reviewed-on: https://fuchsia-review.googlesource.com/c/antlion/+/1044863
Fuchsia-Auto-Submit: Sam Balana <sbalana@google.com>
Reviewed-by: Anthonio Saw <anthonio@google.com>
Commit-Queue: Sam Balana <sbalana@google.com>
diff --git a/packages/antlion/controllers/pdu.py b/packages/antlion/controllers/pdu.py
index edfb89b..fb38111 100644
--- a/packages/antlion/controllers/pdu.py
+++ b/packages/antlion/controllers/pdu.py
@@ -226,8 +226,8 @@
 
 @unique
 class PowerState(IntEnum):
+    OFF = 0
     ON = 1
-    OFF = 2
 
 
 class PduDevice(object):
diff --git a/packages/antlion/controllers/pdu_lib/synaccess/np02b.py b/packages/antlion/controllers/pdu_lib/synaccess/np02b.py
index 7f5779f..b3672f8 100644
--- a/packages/antlion/controllers/pdu_lib/synaccess/np02b.py
+++ b/packages/antlion/controllers/pdu_lib/synaccess/np02b.py
@@ -104,8 +104,9 @@
     def __init__(self, host: str, user: str, password: str) -> None:
         self._url = f"http://{host}/cmd.cgi"
 
-        auth_handler = urllib.request.HTTPBasicAuthHandler()
-        auth_handler.add_password("NP-02B", self._url, user, password)
+        password_manager = urllib.request.HTTPPasswordMgrWithDefaultRealm()
+        password_manager.add_password(None, host, user, password)
+        auth_handler = urllib.request.HTTPBasicAuthHandler(password_manager)
         self._opener = urllib.request.build_opener(auth_handler)
 
         self.log = PrefixLoggerAdapter(