Skip to content

Commit

Permalink
Fix port_forward.enable key not always exist (#476)
Browse files Browse the repository at this point in the history
  • Loading branch information
Kane610 authored Sep 3, 2023
1 parent 75c3cc7 commit 95b5ada
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions aiounifi/models/port_forward.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""Port forwarding in a UniFi network."""
from dataclasses import dataclass
from typing import Self, TypedDict
from typing import NotRequired, Self, TypedDict

from .api import ApiItem, ApiRequest

Expand All @@ -10,7 +10,7 @@ class TypedPortForward(TypedDict):

_id: str
dst_port: str
enabled: bool
enabled: NotRequired[bool]
fwd_port: str
fwd: str
name: str
Expand Down Expand Up @@ -64,7 +64,7 @@ def destination_port(self) -> str:
@property
def enabled(self) -> bool:
"""Is port forward enabled."""
return self.raw["enabled"]
return self.raw.get("enabled", False)

@property
def forward_port(self) -> str:
Expand Down

0 comments on commit 95b5ada

Please sign in to comment.