Skip to content

Commit

Permalink
A_CYC_FILTER_CHANGED_*, A_CYC_FILTER_CHANGE_INTERVAL writable
Browse files Browse the repository at this point in the history
  • Loading branch information
yozik04 committed Feb 12, 2024
1 parent 5aa0677 commit a5620c8
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions vallox_websocket_api/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,9 @@ class Client:
re.compile("^A_CYC_(?:BOOST|FIREPLACE|EXTRA)_TIMER$"),
re.compile("^A_CYC_(?:FIREPLACE|EXTRA)_(?:EXTR|SUPP)_FAN$"),
re.compile("^A_CYC_(?:EXTR|SUPP)_FAN_BALANCE_BASE$"),
re.compile(
"^A_CYC_FILTER_CHANGED_(?:DAY|MONTH|YEAR)|A_CYC_FILTER_CHANGE_INTERVAL$"
),
}

_settable_addresses: Dict[int, type]
Expand Down Expand Up @@ -163,10 +166,10 @@ def set_settable_address(self, address: Union[int, str], var_type: type) -> None
if var_type not in [int, float]:
raise ValloxInvalidInputException("Only float or int types are supported")

if type(address) == int:
if isinstance(address, int):
self._settable_addresses[address] = var_type
return
elif type(address) == str and address in self.data_model.addresses:
elif isinstance(address, str) and address in self.data_model.addresses:
key = int(self.data_model.addresses[address])
self._settable_addresses[key] = var_type
return
Expand Down Expand Up @@ -195,8 +198,8 @@ def _encode_pair(

required_type = addresses[address]

assert (
type(raw_value) == required_type
assert isinstance(
raw_value, required_type
), f"{key}({address}) key needs to be an {required_type.__name__}, but {type(raw_value).__name__} passed"

return address, raw_value
Expand Down

0 comments on commit a5620c8

Please sign in to comment.