Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,14 @@ ignore_missing_imports = true
module = "aiohttp.*"
ignore_missing_imports = true

[[tool.mypy.overrides]]
module = "click.*"
ignore_missing_imports = true

[[tool.mypy.overrides]]
module = "nwp500.cli.*"
ignore_errors = true

[[tool.mypy.overrides]]
module = "pydantic.*"
ignore_missing_imports = true
Expand Down
7 changes: 6 additions & 1 deletion src/nwp500/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -628,6 +628,11 @@ def current_tokens(self) -> AuthTokens | None:
"""Get current authentication tokens."""
return self._auth_response.tokens if self._auth_response else None

@property
def auth_response(self) -> AuthenticationResponse | None:
"""Get the complete authentication response."""
return self._auth_response

@property
def user_email(self) -> str | None:
"""Get the email address of the authenticated user."""
Expand Down Expand Up @@ -716,7 +721,7 @@ async def authenticate(user_id: str, password: str) -> AuthenticationResponse:
>>> # Do not print tokens in production code
"""
async with NavienAuthClient(user_id, password) as client:
auth_response = cast(Any, client)._auth_response
auth_response = client.auth_response
if auth_response is None:
raise AuthenticationError(
"Authentication failed: no response received"
Expand Down
5 changes: 3 additions & 2 deletions src/nwp500/cli/rich_output.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,12 @@ class OutputFormatter:
def __init__(self) -> None:
"""Initialize the formatter."""
self.use_rich = _should_use_rich()
self.console: Any
if self.use_rich:
assert Console is not None
self.console: Any = Console()
self.console = Console()
else:
self.console: Any = None
self.console = None

def print_status_table(self, items: list[tuple[str, str, str]]) -> None:
"""Print status items as a formatted table.
Expand Down
11 changes: 11 additions & 0 deletions src/nwp500/enums.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,17 @@ class OnOffFlag(IntEnum):
ON = 2


class ConnectionStatus(IntEnum):
"""Device connection status to cloud/MQTT.

Represents whether the device is currently connected to the Navien cloud
service and can receive commands.
"""

DISCONNECTED = 1
CONNECTED = 2


class Operation(IntEnum):
"""Device operation state."""

Expand Down
6 changes: 5 additions & 1 deletion src/nwp500/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
tou_status_to_python,
)
from .enums import (
ConnectionStatus,
CurrentOperationMode,
DeviceType,
DHWControlTypeFlag,
Expand Down Expand Up @@ -61,6 +62,9 @@
VolumeCodeField = Annotated[
VolumeCode, BeforeValidator(enum_validator(VolumeCode))
]
ConnectionStatusField = Annotated[
ConnectionStatus, BeforeValidator(enum_validator(ConnectionStatus))
]


def fahrenheit_to_half_celsius(fahrenheit: float) -> int:
Expand Down Expand Up @@ -151,7 +155,7 @@ class DeviceInfo(NavienBaseModel):
additional_value: str = ""
device_type: DeviceType | int = DeviceType.NPF700_WIFI
device_name: str = "Unknown"
connected: int = 0
connected: ConnectionStatusField = ConnectionStatus.DISCONNECTED
install_type: str | None = None


Expand Down