Skip to content

Commit

Permalink
match Pkt._expiry timeouts for OTB
Browse files Browse the repository at this point in the history
  • Loading branch information
zxdavb committed Jan 27, 2024
1 parent 24487a5 commit 570cc74
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
6 changes: 3 additions & 3 deletions src/ramses_rf/device/heat.py
Original file line number Diff line number Diff line change
Expand Up @@ -675,7 +675,7 @@ def which_cmd(use_native_ot: str, msg_id: str) -> Command | None:

for _msg_id in SCHEMA_MSG_IDS: # From OT v2.2: version numbers
if cmd := which_cmd(self._gwy.config.use_native_ot, f"{_msg_id:02X}"):
self._add_discovery_cmd(cmd, 24 * 3600, delay=180)
self._add_discovery_cmd(cmd, 6 * 3600, delay=180)

for _msg_id in PARAMS_MSG_IDS: # params or L/T state
if cmd := which_cmd(self._gwy.config.use_native_ot, f"{_msg_id:02X}"):
Expand Down Expand Up @@ -783,8 +783,8 @@ def _ot_msg_name(msg) -> str: # TODO: remove

def _ot_msg_value(self, msg_id: str) -> int | float | list | None:
# data_id = int(msg_id, 16)
if self._msgs_ot.get(msg_id) and not self._msgs_ot[msg_id]._expired:
return self._msgs_ot[msg_id].payload.get(SZ_VALUE) # TODO: value_hb/_lb
if (msg := self._msgs_ot.get(msg_id)) and not msg._expired:
return msg.payload.get(SZ_VALUE) # TODO: value_hb/_lb

def _result_by_callback(
self, cbk_ot: Callable | None, cbk_ramses: Callable | None
Expand Down
12 changes: 6 additions & 6 deletions src/ramses_tx/packet.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,16 +190,16 @@ def pkt_lifespan(pkt: Packet) -> td: # import OtbGateway??
if pkt.code in (Code._2309, Code._30C9) and pkt._has_array: # sends I /sync_cycle
return _TD_SECS_360

if pkt.code == Code._3220: # FIXME
if pkt.code == Code._3220: # FIXME: 2.1 means we can miss two packets
if pkt.payload[4:6] in WRITE_MSG_IDS: # and Write-Data: # TODO
return _TD_SECS_003
return _TD_SECS_003 * 2.1
if pkt.payload[4:6] in SCHEMA_MSG_IDS:
return _TD_MINS_060
return _TD_MINS_360 * 2.1
if pkt.payload[4:6] in PARAMS_MSG_IDS:
return _TD_MINS_360
return _TD_MINS_060 * 2.1
if pkt.payload[4:6] in STATUS_MSG_IDS:
return _TD_MINS_005
return _TD_MINS_005
return _TD_MINS_005 * 2.1
return _TD_MINS_005 * 2.1

# if pkt.code in (Code._3B00, Code._3EF0, ): # TODO: 0008, 3EF0, 3EF1
# return td(minutes=6.7) # TODO: WIP
Expand Down

0 comments on commit 570cc74

Please sign in to comment.