Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tweak 12A0 for ClimaRad HVAC #142

Open
wants to merge 21 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
d68975d
add 12a0 typedDict, move used classes before it
silverailscolo Oct 17, 2024
2b8b4b5
clean-up and Ventura packet logs
silverailscolo Oct 17, 2024
4a70578
fingerprints
silverailscolo Oct 17, 2024
e2f2ae5
Merge branch 'master' of https://github.com/zxdavb/ramses_rf into eb-…
silverailscolo Oct 17, 2024
34960b0
remove notes
silverailscolo Oct 18, 2024
3264a40
split result
silverailscolo Oct 18, 2024
4560b2f
Merge branch 'master' of https://github.com/zxdavb/ramses_rf into eb-…
silverailscolo Oct 18, 2024
e078ef3
Merge remote-tracking branch 'origin/eb-12a0' into eb-12a0
silverailscolo Oct 18, 2024
7f6f537
simplify regex, remove assert
silverailscolo Oct 18, 2024
e979a23
split _12a0 types, tag unknown0
silverailscolo Oct 18, 2024
febbd88
merge master
silverailscolo Oct 20, 2024
ccdcdd1
remove asserts
silverailscolo Oct 20, 2024
8694343
hum parse suggestion
silverailscolo Oct 20, 2024
9280495
hold on to alternative parser while sorting out result
silverailscolo Oct 20, 2024
d2c762e
12A0 dict easy
silverailscolo Oct 20, 2024
6693c91
typed humidity list interior-rh-exterior
silverailscolo Oct 20, 2024
2efcf16
clean up log
silverailscolo Oct 20, 2024
7472381
new V1x packet
silverailscolo Oct 21, 2024
7b25029
Merge branch 'master' of https://github.com/zxdavb/ramses_rf into eb-…
silverailscolo Oct 23, 2024
a4c39ad
Merge branch 'master' of https://github.com/zxdavb/ramses_rf into eb-…
silverailscolo Nov 6, 2024
a954a79
Merge branch 'master' of https://github.com/zxdavb/ramses_rf into eb-…
silverailscolo Nov 11, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions src/ramses_tx/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
SZ_OUTDOOR_TEMP,
SZ_POST_HEAT,
SZ_PRE_HEAT,
SZ_REL_HUMIDITY,
SZ_REMAINING_MINS,
SZ_SPEED_CAPABILITIES,
SZ_SUPPLY_FAN_SPEED,
Expand Down Expand Up @@ -537,6 +538,20 @@ def parse_co2_level(value: HexStr4) -> PayDictT.CO2_LEVEL:
return {SZ_CO2_LEVEL: level}


def parse_humidity_element(value: str, index: str) -> PayDictT._12A0:
"""Return the relative humidity (%) and 2 temperatures

The result may include current temperature ('C) and include dewpoint temperature ('C).
"""
if index == "01":
return _parse_hvac_humidity(SZ_REL_HUMIDITY, value[:2], value[2:6], value[6:10]) # type: ignore[return-value]
if index == "02":
return _parse_hvac_humidity(
SZ_OUTDOOR_HUMIDITY, value[:2], value[2:6], value[6:10]
) # type: ignore[return-value]
return _parse_hvac_humidity(SZ_INDOOR_HUMIDITY, value[:2], value[2:6], value[6:10]) # type: ignore[return-value]


# 31DA[10:12] and 12A0[2:12]
def parse_indoor_humidity(value: str) -> PayDictT.INDOOR_HUMIDITY:
"""Return the relative indoor humidity (%).
Expand Down
18 changes: 15 additions & 3 deletions src/ramses_tx/parsers.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@
parse_exhaust_temp,
parse_fan_info,
parse_fault_log_entry,
parse_humidity_element,
parse_indoor_humidity,
parse_indoor_temp,
parse_outdoor_humidity,
Expand Down Expand Up @@ -1120,9 +1121,20 @@ def parser_1298(payload: str, msg: Message) -> PayDictT._1298:
return parse_co2_level(payload[2:6])


# HVAC: indoor_humidity
def parser_12a0(payload: str, msg: Message) -> PayDictT._12A0:
return parse_indoor_humidity(payload[2:])
# HVAC: indoor_humidity, array of 3 sets for HRU
def parser_12a0(
payload: str, msg: Message
) -> PayDictT.INDOOR_HUMIDITY | list[PayDictT._12A0]:
if len(payload) <= 14:
return parse_indoor_humidity(payload[2:12])

return [
{
"hvac_idx": payload[i : i + 2],
**parse_humidity_element(payload[i + 2 : i + 12], payload[i : i + 2]),
}
for i in range(0, len(payload), 14)
]


# window_state (of a device/zone)
Expand Down
7 changes: 2 additions & 5 deletions src/ramses_tx/ramses.py
Original file line number Diff line number Diff line change
Expand Up @@ -279,12 +279,9 @@
RQ: r"^00$",
},
Code._12A0: { # indoor_humidity
# .I --- 32:168090 --:------ 32:168090 12A0 006 0030093504A8
# .I --- 32:132125 --:------ 32:132125 12A0 007 003107B67FFF00 # only dev_id with 007
# RP --- 20:008749 18:142609 --:------ 12A0 002 00EF
SZ_NAME: "indoor_humidity",
I_: r"^00[0-9A-F]{2}([0-9A-F]{8}(00)?)?$",
RP: r"^00[0-9A-F]{2}([0-9A-F]{8}(00)?)?$",
I_: r"^(0[0-9A-F]{3}([0-9A-F]{8}(00)?)?)+$",
RP: r"^0[0-9A-F]{3}([0-9A-F]{8}(00)?)?$",
SZ_LIFESPAN: td(hours=1),
},
Code._12B0: { # window_state (HVAC % window open)
Expand Down
20 changes: 19 additions & 1 deletion src/ramses_tx/typed_dicts.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,12 @@ class Co2Level(TypedDict):
co2_level: float | None


class RelativeHumidity(TypedDict):
relative_humidity: _HexToTempT
temperature: NotRequired[float | None]
dewpoint_temp: NotRequired[float | None]


class IndoorHumidity(TypedDict):
indoor_humidity: _HexToTempT
temperature: NotRequired[float | None]
Expand Down Expand Up @@ -255,6 +261,15 @@ class _1100_IDX(TypedDict):
domain_id: str


class _12a0(TypedDict):
hvac_idx: str
indoor_humidity: NotRequired[_HexToTempT | None]
outdoor_humidity: NotRequired[_HexToTempT | None]
relative_humidity: NotRequired[_HexToTempT | None]
temperature: NotRequired[float | None]
dewpoint_temp: NotRequired[float | None]


class _12b0(TypedDict):
window_open: bool | None

Expand Down Expand Up @@ -421,7 +436,7 @@ class PayDictT:
_1280: TypeAlias = OutdoorHumidity
_1290: TypeAlias = OutdoorTemp
_1298: TypeAlias = Co2Level
_12A0: TypeAlias = IndoorHumidity
_12A0: TypeAlias = _12a0
_12B0: TypeAlias = _12b0
_12C0: TypeAlias = _12c0
_12C8: TypeAlias = AirQuality
Expand Down Expand Up @@ -453,6 +468,9 @@ class PayDictT:
FAULT_LOG_ENTRY_NULL: TypeAlias = FaultLogEntryNull
TEMPERATURE: TypeAlias = _Temperature

# 12A0 primitive
RELATIVE_HUMIDITY: TypeAlias = RelativeHumidity

# 31DA primitives
AIR_QUALITY: TypeAlias = AirQuality
CO2_LEVEL: TypeAlias = Co2Level
Expand Down
16 changes: 16 additions & 0 deletions tests/tests/parsers/code_12a0.log
Original file line number Diff line number Diff line change
@@ -1,9 +1,25 @@

2021-02-12T20:59:47.225210 066 RP --- 20:008749 18:142609 --:------ 12A0 002 00EF # {'indoor_humidity': None}
2024-10-15T12:41:34.415872 075 I --- 29:099029 --:------ 29:099029 12A0 002 0031 # {'indoor_humidity': 0.49}

2022-03-08T11:24:21.138647 076 I --- 29:146052 --:------ 29:146052 12A0 006 00220685004C # {'indoor_humidity': 0.34, 'temperature': 16.69, 'dewpoint_temp': 0.76}

2022-07-03T10:04:21.953850 061 RP --- 32:155617 18:005904 --:------ 12A0 007 003908A57FFF00 # {'indoor_humidity': 0.57, 'temperature': 22.13, 'dewpoint_temp': None}
2022-08-17T02:29:36.718767 056 I --- 32:155617 --:------ 32:155617 12A0 007 003C096E7FFF00 # {'indoor_humidity': 0.60, 'temperature': 24.14, 'dewpoint_temp': None}

2019-12-16T05:19:20.630177 072 I --- 32:168090 --:------ 32:168090 12A0 006 003C06DE03E3 # {'indoor_humidity': 0.60, 'temperature': 17.58, 'dewpoint_temp': 9.95}

# ClimaRad VenturaV1x array of 3 Indoor_Humidity sets for HRU: Flow In (no dewpoint), Flow Out, Item_3

2024-10-15T12:33:21.828292 060 I --- 37:153226 --:------ 37:153226 12A0 021 003307DD7FFF0001EF7FFF7FFF00023E056B02A600 # [{'hvac_idx': '00', 'indoor_humidity': 0.51, 'temperature': 20.13, 'dewpoint_temp': None}, {'hvac_idx': '01', 'rel_humidity': None}, {'hvac_idx': '02', 'outdoor_humidity': 0.62, 'temperature': 13.87, 'dewpoint_temp': 6.78}]
2024-10-15T12:38:22.145126 060 I --- 37:153226 --:------ 37:153226 12A0 021 003207D27FFF0001EF7FFF7FFF00023F057B02D200 # [{'hvac_idx': '00', 'indoor_humidity': 0.5, 'temperature': 20.02, 'dewpoint_temp': None}, {'hvac_idx': '01', 'rel_humidity': None}, {'hvac_idx': '02', 'outdoor_humidity': 0.63, 'temperature': 14.03, 'dewpoint_temp': 7.22}]
2024-10-15T12:48:22.825444 060 I --- 37:153226 --:------ 37:153226 12A0 021 003107E47FFF0001EF7FFF7FFF00023E05A802D900 # [{'hvac_idx': '00', 'indoor_humidity': 0.49, 'temperature': 20.2, 'dewpoint_temp': None}, {'hvac_idx': '01', 'rel_humidity': None}, {'hvac_idx': '02', 'outdoor_humidity': 0.62, 'temperature': 14.48, 'dewpoint_temp': 7.29}]
2024-10-15T13:25:35.121534 062 I --- 37:153226 --:------ 37:153226 12A0 021 0034080C7FFF0001EF7FFF7FFF00023B05C002AF00 # [{'hvac_idx': '00', 'indoor_humidity': 0.52, 'temperature': 20.6, 'dewpoint_temp': None}, {'hvac_idx': '01', 'rel_humidity': None}, {'hvac_idx': '02', 'outdoor_humidity': 0.59, 'temperature': 14.72, 'dewpoint_temp': 6.87}]
2024-10-15T15:59:04.943042 061 I --- 37:153226 --:------ 37:153226 12A0 021 0033088F7FFF0001EF7FFF7FFF000237065C02D900 # [{'hvac_idx': '00', 'indoor_humidity': 0.51, 'temperature': 21.91, 'dewpoint_temp': None}, {'hvac_idx': '01', 'rel_humidity': None}, {'hvac_idx': '02', 'outdoor_humidity': 0.55, 'temperature': 16.28, 'dewpoint_temp': 7.29}]
2024-10-15T23:50:36.119335 074 I --- 37:153226 --:------ 37:153226 12A0 021 002B08137FFF0001EF7FFF7FFF00023D05A102CE00 # [{'hvac_idx': '00', 'indoor_humidity': 0.43, 'temperature': 20.67, 'dewpoint_temp': None}, {'hvac_idx': '01', 'rel_humidity': None}, {'hvac_idx': '02', 'outdoor_humidity': 0.61, 'temperature': 14.41, 'dewpoint_temp': 7.18}]
2024-10-18T13:40:19.208645 067 I --- 37:153226 --:------ 37:153226 12A0 021 0042081D7FFF0001EF7FFF7FFF00024D079205FF00 # [{'hvac_idx': '00', 'indoor_humidity': 0.66, 'temperature': 20.77, 'dewpoint_temp': None}, {'hvac_idx': '01', 'rel_humidity': None}, {'hvac_idx': '02', 'outdoor_humidity': 0.77, 'temperature': 19.38, 'dewpoint_temp': 15.35}]
2024-10-18T15:45:27.762626 067 I --- 37:153226 --:------ 37:153226 12A0 021 004408327FFF0001EF7FFF7FFF00024707EF05DE00 # [{'hvac_idx': '00', 'indoor_humidity': 0.68, 'temperature': 20.98, 'dewpoint_temp': None}, {'hvac_idx': '01', 'rel_humidity': None}, {'hvac_idx': '02', 'outdoor_humidity': 0.71, 'temperature': 20.31, 'dewpoint_temp': 15.02}]
2024-10-18T15:50:28.112562 067 I --- 37:153226 --:------ 37:153226 12A0 021 004408377FFF0001EF7FFF7FFF00024707F705E000 # [{'hvac_idx': '00', 'indoor_humidity': 0.68, 'temperature': 21.03, 'dewpoint_temp': None}, {'hvac_idx': '01', 'rel_humidity': None}, {'hvac_idx': '02', 'outdoor_humidity': 0.71, 'temperature': 20.39, 'dewpoint_temp': 15.04}]
2024-10-18T01:13:47.417683 064 I --- 37:153226 --:------ 37:153226 12A0 021 003F08077FFF0001EF7FFF7FFF00024E06D6055D00 # [{'hvac_idx': '00', 'indoor_humidity': 0.63, 'temperature': 20.55, 'dewpoint_temp': None}, {'hvac_idx': '01', 'rel_humidity': None}, {'hvac_idx': '02', 'outdoor_humidity': 0.78, 'temperature': 17.5, 'dewpoint_temp': 13.73}]
2024-10-20T15:01:12.576913 072 I --- 37:153226 --:------ 37:153226 12A0 021 0041078D7FFF0001EF7FFF7FFF0002470751054000 # [{'hvac_idx': '00', 'indoor_humidity': 0.65, 'temperature': 19.33, 'dewpoint_temp': None}, {'hvac_idx': '01', 'rel_humidity': None}, {'hvac_idx': '02', 'outdoor_humidity': 0.71, 'temperature': 18.73, 'dewpoint_temp': 13.44}]
2024-10-21T13:49:35.480133 060 I --- 37:153226 --:------ 37:153226 12A0 021 004108027FFF0001EF7FFF7FFF00024E06E1056500 # [{'hvac_idx': '00', 'indoor_humidity': 0.65, 'temperature': 20.5, 'dewpoint_temp': None}, {'hvac_idx': '01', 'rel_humidity': None}, {'hvac_idx': '02', 'outdoor_humidity': 0.78, 'temperature': 17.61, 'dewpoint_temp': 13.81}]