def __init__(self, host, port, alias, username, password): """Initialize the data object.""" self._host = host self._alias = alias # Establish client with persistent=False to open/close connection on # each update call. This is more reliable with async. self._client = PyNUTClient(self._host, port, username, password, 5, False) self._status = None
def __init__(self, host, port, alias, username, password): """Initialize the data object.""" from pynut2.nut2 import PyNUTClient, PyNUTError self._host = host self._port = port self._alias = alias self._username = username self._password = password self.pynuterror = PyNUTError # Establish client with persistent=False to open/close connection on # each update call. This is more reliable with async. self._client = PyNUTClient(self._host, self._port, self._username, self._password, 5, False) self._status = None
def __init__( self, host: str, port: int, alias: str | None, username: str | None, password: str | None, ) -> None: """Initialize the data object.""" self._host = host self._alias = alias # Establish client with persistent=False to open/close connection on # each update call. This is more reliable with async. self._client = PyNUTClient(self._host, port, username, password, 5, False) self.ups_list: dict[str, str] | None = None self._status: dict[str, str] | None = None self._device_info: NUTDeviceInfo | None = None