Skip to content

Commit

Permalink
Tweak 10D0 parser for Vasco HVAC (#140)
Browse files Browse the repository at this point in the history
* 10d0 parser (no new logs)

* schema, calculate days_remaining for Ventura

* days_remaining comment

Co-authored-by: David Bonnes <[email protected]>

* assume sentinel for remaining

Co-authored-by: David Bonnes <[email protected]>

* Ventura filter counter parsed as % only

---------

Co-authored-by: David Bonnes <[email protected]>
  • Loading branch information
silverailscolo and zxdavb authored Oct 17, 2024
1 parent 35eeb92 commit 36d0934
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 8 deletions.
17 changes: 10 additions & 7 deletions src/ramses_tx/parsers.py
Original file line number Diff line number Diff line change
Expand Up @@ -984,14 +984,17 @@ def parser_10d0(payload: str, msg: Message) -> dict[str, Any]:
result: dict[str, bool | float | None]

if msg.verb == W_:
result = {"reset_counter": payload[2:4] == "FF"}
else:
result = {"days_remaining": int(payload[2:4], 16)}
return {"reset_counter": payload[2:4] != "00"}

if msg.len >= 3:
result.update({"days_lifetime": int(payload[4:6], 16)})
if msg.len >= 4:
result.update({"percent_remaining": hex_to_percent(payload[6:8])})
result = {}

if payload[2:4] not in ("FF", "FE"):
result["days_remaining"] = int(payload[2:4], 16)

if payload[4:6] not in ("FF", "FE"):
result["days_lifetime"] = int(payload[4:6], 16)

result["percent_remaining"] = hex_to_percent(payload[6:8])

return result

Expand Down
3 changes: 2 additions & 1 deletion src/ramses_tx/ramses.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@
},
Code._10D0: { # filter_change - polling interval should be 1/day
SZ_NAME: "filter_change",
I_: r"^00[0-9A-F]{6}(0000)?$",
I_: r"^00[0-9A-F]{6}(0000|FFFF)?$",
RQ: r"^00(00)?$",
W_: r"^00FF$",
},
Expand Down Expand Up @@ -1094,6 +1094,7 @@
Code._0001: {RQ: {}}, # from a VMI (only?)
Code._042F: {I_: {}}, # from a VMI (only?)
Code._1060: {I_: {}},
Code._10D0: {W_: {}}, # reset filter count from REM
Code._10E0: {I_: {}, RQ: {}}, # RQ from a VMI (only?)
Code._1470: {RQ: {}}, # from a VMI (only?)
Code._1FC9: {I_: {}},
Expand Down
6 changes: 6 additions & 0 deletions tests/tests/parsers/code_10d0.log
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@
2022-07-03T22:52:34.571579 045 W --- 37:171871 32:155617 --:------ 10D0 002 00FF # {'reset_counter': True}
2022-07-03T22:52:34.596526 066 I --- 32:155617 37:171871 --:------ 10D0 006 0047B44F0000 # {'days_remaining': 71, 'days_lifetime': 180, 'percent_remaining': 0.395}

2024-10-15 12:33:55.595000 000 RQ --- 18:130140 32:022222 --:------ 10D0 001 00 # {}
2024-10-15 12:33:55.609000 --- RP --- 32:022222 18:130140 --:------ 10D0 006 00A9B6B90000 # {'days_remaining': 169, 'days_lifetime': 182, 'percent_remaining': 0.925}

2024-10-15T12:33:13.714200 000 RQ --- 18:130140 37:153226 --:------ 10D0 001 00 # {}
2024-10-15T12:33:13.731547 060 RP --- 37:153226 18:130140 --:------ 10D0 006 00FEFE79FFFF # {'percent_remaining': 0.605}

2022-07-03T23:14:23.854089 000 RQ --- 37:155617 32:155617 --:------ 10D0 002 0000 # {}
2022-07-03T23:14:23.876088 084 RP --- 32:155617 37:155617 --:------ 10D0 006 00B4B4C80000 # {'days_remaining': 180, 'days_lifetime': 180, 'percent_remaining': 1.000}

Expand Down

0 comments on commit 36d0934

Please sign in to comment.