Skip to content

Commit

Permalink
refactor 3EF0 typed dicts
Browse files Browse the repository at this point in the history
  • Loading branch information
zxdavb committed Oct 18, 2024
1 parent 2f638e5 commit 79b2ee7
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 20 deletions.
4 changes: 1 addition & 3 deletions src/ramses_tx/parsers.py
Original file line number Diff line number Diff line change
Expand Up @@ -2453,9 +2453,7 @@ def complex_idx(payload: str, msg: Message) -> dict: # has complex idx


# actuator_state
def parser_3ef0(
payload: str, msg: Message
) -> PayDictT._3EF0_3 | PayDictT._3EF0_6 | PayDictT._3EF0_9 | PayDictT._JASPER:
def parser_3ef0(payload: str, msg: Message) -> PayDictT._3EF0 | PayDictT._JASPER:
result: dict[str, Any]

if msg.src.type == DEV_TYPE_MAP.JIM: # Honeywell Jasper
Expand Down
21 changes: 4 additions & 17 deletions src/ramses_tx/typed_dicts.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,14 +212,12 @@ class _3b00(TypedDict):
actuator_sync: bool | None


class _3ef0_3(TypedDict):
class _3ef0_3(TypedDict): # payload of 3 bytes
modulation_level: float | None
_flags_2: str


class _3ef0_6(TypedDict):
modulation_level: float | None
_flags_2: str
class _3ef0_6(_3ef0_3): # payload of 6 bytes
_flags_3: list[int]
ch_active: bool
dhw_active: bool
Expand All @@ -229,16 +227,7 @@ class _3ef0_6(TypedDict):
_unknown_5: str


class _3ef0_9(TypedDict):
modulation_level: float | None
_flags_2: str
_flags_3: list[int]
ch_active: bool
dhw_active: bool
cool_active: bool
flame_on: bool
_unknown_4: str
_unknown_5: str
class _3ef0_9(_3ef0_6): # payload of 9 bytes
_flags_6: list[int]
ch_enabled: bool
ch_setpoint: int
Expand Down Expand Up @@ -442,9 +431,7 @@ class PayDictT:
_3200: TypeAlias = _Temperature
_3210: TypeAlias = _Temperature
_3B00: TypeAlias = _3b00
_3EF0_3: TypeAlias = _3ef0_3
_3EF0_6: TypeAlias = _3ef0_6
_3EF0_9: TypeAlias = _3ef0_9
_3EF0: TypeAlias = _3ef0_3 | _3ef0_6 | _3ef0_9
_3EF1: TypeAlias = _3ef1

_JASPER: TypeAlias = _JASPER
Expand Down

0 comments on commit 79b2ee7

Please sign in to comment.