Skip to content

Commit 6c089b4

Browse files
authored
fix(models): add missing creation_time initialization in Zone class and fix incorrect type (str -> int) (#1891)
## Summary - Add missing `creation_time` parameter to `Zone.__init__()` - Fix timestamp type annotations from `str` to `int` to match API format ## Problem The `Zone` class declared `creation_time` as an attribute but never initialized it in `__init__`, causing `AttributeError` when accessed. ## Test plan - [x] All existing tests pass - [x] Pre-commit checks pass
1 parent f729a5d commit 6c089b4

File tree

1 file changed

+13
-11
lines changed

1 file changed

+13
-11
lines changed

pyoverkiz/models.py

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@
3636
class Setup:
3737
"""Representation of a complete setup returned by the Overkiz API."""
3838

39-
creation_time: str | None = None
40-
last_update_time: str | None = None
39+
creation_time: int | None = None
40+
last_update_time: int | None = None
4141
id: str = field(repr=obfuscate_id, default=None)
4242
location: Location | None = None
4343
gateways: list[Gateway]
@@ -51,8 +51,8 @@ class Setup:
5151
def __init__(
5252
self,
5353
*,
54-
creation_time: str | None = None,
55-
last_update_time: str | None = None,
54+
creation_time: int | None = None,
55+
last_update_time: int | None = None,
5656
id: str = field(repr=obfuscate_id, default=None),
5757
location: dict[str, Any] | None = None,
5858
gateways: list[dict[str, Any]],
@@ -82,8 +82,8 @@ def __init__(
8282
class Location:
8383
"""Geographical and address metadata for a Setup."""
8484

85-
creation_time: str
86-
last_update_time: str | None = None
85+
creation_time: int
86+
last_update_time: int | None = None
8787
city: str = field(repr=obfuscate_string, default=None)
8888
country: str = field(repr=obfuscate_string, default=None)
8989
postal_code: str = field(repr=obfuscate_string, default=None)
@@ -104,8 +104,8 @@ class Location:
104104
def __init__(
105105
self,
106106
*,
107-
creation_time: str,
108-
last_update_time: str | None = None,
107+
creation_time: int,
108+
last_update_time: int | None = None,
109109
city: str = field(repr=obfuscate_string, default=None),
110110
country: str = field(repr=obfuscate_string, default=None),
111111
postal_code: str = field(repr=obfuscate_string, default=None),
@@ -885,8 +885,8 @@ class ZoneItem:
885885
class Zone:
886886
"""A Zone groups related devices inside a place."""
887887

888-
creation_time: str
889-
last_update_time: str
888+
creation_time: int
889+
last_update_time: int
890890
label: str
891891
type: int
892892
items: list[ZoneItem] | None
@@ -897,7 +897,8 @@ class Zone:
897897
def __init__(
898898
self,
899899
*,
900-
last_update_time: str,
900+
creation_time: int,
901+
last_update_time: int,
901902
label: str,
902903
type: int,
903904
items: list[dict[str, Any]] | None,
@@ -907,6 +908,7 @@ def __init__(
907908
**_: Any,
908909
) -> None:
909910
"""Initialize Zone from API data and convert nested items."""
911+
self.creation_time = creation_time
910912
self.last_update_time = last_update_time
911913
self.label = label
912914
self.type = type

0 commit comments

Comments
 (0)