Coverage for src/ramses_rf/const.py: 100%

1#!/usr/bin/env python3

2"""RAMSES RF - a RAMSES-II protocol decoder & analyser."""

3

4 from __future__ import annotations

5

6 from enum import IntEnum

7 from typing import TYPE_CHECKING, Final

8

9 from ramses_tx.const import ( # noqa: F401

10 DEFAULT_MAX_ZONES as DEFAULT_MAX_ZONES,

11 DEVICE_ID_REGEX as DEVICE_ID_REGEX,

12 DOMAIN_TYPE_MAP as DOMAIN_TYPE_MAP,

13 FAN_MODE as FAN_MODE, # deprecated, use SZ_FAN_MODE, to be removed in Q1 2026

14 SYS_MODE_MAP as SYS_MODE_MAP,

15 SZ_ACCEPT as SZ_ACCEPT,

16 SZ_ACTUATORS as SZ_ACTUATORS,

17 SZ_AIR_QUALITY as SZ_AIR_QUALITY,

18 SZ_AIR_QUALITY_BASIS as SZ_AIR_QUALITY_BASIS,

19 SZ_BOOST_TIMER as SZ_BOOST_TIMER,

20 SZ_BYPASS_MODE as SZ_BYPASS_MODE,

21 SZ_BYPASS_POSITION as SZ_BYPASS_POSITION,

22 SZ_BYPASS_STATE as SZ_BYPASS_STATE,

23 SZ_CHANGE_COUNTER as SZ_CHANGE_COUNTER,

24 SZ_CO2_LEVEL as SZ_CO2_LEVEL,

25 SZ_CONFIRM as SZ_CONFIRM,

26 SZ_DATETIME as SZ_DATETIME,

27 SZ_DEVICE_ID as SZ_DEVICE_ID,

28 SZ_DEVICE_ROLE as SZ_DEVICE_ROLE,

29 SZ_DEVICES as SZ_DEVICES,

30 SZ_DHW_IDX as SZ_DHW_IDX,

31 SZ_DOMAIN_ID as SZ_DOMAIN_ID,

32 SZ_DURATION as SZ_DURATION,

33 SZ_EXHAUST_FAN_SPEED as SZ_EXHAUST_FAN_SPEED,

34 SZ_EXHAUST_FLOW as SZ_EXHAUST_FLOW,

35 SZ_EXHAUST_TEMP as SZ_EXHAUST_TEMP,

36 SZ_FAN_INFO as SZ_FAN_INFO,

37 SZ_FAN_MODE as SZ_FAN_MODE,

38 SZ_FAN_RATE as SZ_FAN_RATE,

39 SZ_FILTER_REMAINING as SZ_FILTER_REMAINING,

40 SZ_FRAG_LENGTH as SZ_FRAG_LENGTH,

41 SZ_FRAG_NUMBER as SZ_FRAG_NUMBER,

42 SZ_FRAGMENT as SZ_FRAGMENT,

43 SZ_HEAT_DEMAND as SZ_HEAT_DEMAND,

44 SZ_INDOOR_HUMIDITY as SZ_INDOOR_HUMIDITY,

45 SZ_INDOOR_TEMP as SZ_INDOOR_TEMP,

46 SZ_LANGUAGE as SZ_LANGUAGE,

47 SZ_MODE as SZ_MODE,

48 SZ_NAME as SZ_NAME,

49 SZ_OEM_CODE as SZ_OEM_CODE,

50 SZ_OFFER as SZ_OFFER,

51 SZ_OUTDOOR_HUMIDITY as SZ_OUTDOOR_HUMIDITY,

52 SZ_OUTDOOR_TEMP as SZ_OUTDOOR_TEMP,

53 SZ_PAYLOAD as SZ_PAYLOAD,

54 SZ_PHASE as SZ_PHASE,

55 SZ_POST_HEAT as SZ_POST_HEAT,

56 SZ_PRE_HEAT as SZ_PRE_HEAT,

57 SZ_PRESENCE_DETECTED as SZ_PRESENCE_DETECTED,

58 SZ_PRESSURE as SZ_PRESSURE,

59 SZ_RELAY_DEMAND as SZ_RELAY_DEMAND,

60 SZ_RELAY_FAILSAFE as SZ_RELAY_FAILSAFE,

61 SZ_REMAINING_DAYS as SZ_REMAINING_DAYS,

62 SZ_REMAINING_MINS as SZ_REMAINING_MINS,

63 SZ_REMAINING_PERCENT as SZ_REMAINING_PERCENT,

64 SZ_REQ_REASON as SZ_REQ_REASON,

65 SZ_REQ_SPEED as SZ_REQ_SPEED,

66 SZ_SCHEDULE as SZ_SCHEDULE,

67 SZ_SENSOR as SZ_SENSOR,

68 SZ_SETPOINT as SZ_SETPOINT,

69 SZ_SPEED_CAPABILITIES as SZ_SPEED_CAPABILITIES,

70 SZ_SUPPLY_FAN_SPEED as SZ_SUPPLY_FAN_SPEED,

71 SZ_SUPPLY_FLOW as SZ_SUPPLY_FLOW,

72 SZ_SUPPLY_TEMP as SZ_SUPPLY_TEMP,

73 SZ_SYSTEM_MODE as SZ_SYSTEM_MODE,

74 SZ_TEMPERATURE as SZ_TEMPERATURE,

75 SZ_TOTAL_FRAGS as SZ_TOTAL_FRAGS,

76 SZ_UFH_IDX as SZ_UFH_IDX,

77 SZ_UNKNOWN as SZ_UNKNOWN,

78 SZ_UNTIL as SZ_UNTIL,

79 SZ_VALUE as SZ_VALUE,

80 SZ_WINDOW_OPEN as SZ_WINDOW_OPEN,

81 SZ_ZONE_CLASS as SZ_ZONE_CLASS,

82 SZ_ZONE_IDX as SZ_ZONE_IDX,

83 SZ_ZONE_MASK as SZ_ZONE_MASK,

84 SZ_ZONE_TYPE as SZ_ZONE_TYPE,

85 SZ_ZONES as SZ_ZONES,

86 ZON_MODE_MAP as ZON_MODE_MAP,

87 SystemType as SystemType,

88)

89

90 from ramses_tx.const import ( # noqa: F401, isort: skip, pylint: disable=unused-import

91 I_ as I_,

92 RP as RP,

93 RQ as RQ,

94 W_ as W_,

95 Code as Code,

96 IndexT as IndexT,

97 VerbT as VerbT,

98)

99

100 from ramses_tx.const import ( # noqa: F401, isort: skip, pylint: disable=unused-import

101 F9 as F9,

102 FA as FA,

103 FC as FC,

104 FF as FF,

105 DEV_ROLE_MAP as DEV_ROLE_MAP,

106 DEV_TYPE_MAP as DEV_TYPE_MAP,

107 ZON_ROLE_MAP as ZON_ROLE_MAP,

108 DevRole as DevRole,

109 DevType as DevType,

110 ZoneRole as ZoneRole,

111)

112

113 if TYPE_CHECKING:

114 from ramses_tx.const import ( # noqa: F401, pylint: disable=unused-import

115 IndexT,

116 VerbT,

117 )

118

119

120 __dev_mode__ = False # NOTE: this is const.py

121

122

123 class Discover(IntEnum):

124 NOTHING = 0

125 SCHEMA = 1

126 PARAMS = 2

127 STATUS = 4

128 FAULTS = 8

129 SCHEDS = 16

130 TRAITS = 32

131 DEFAULT = 1 + 2 + 4

132

133

134 DONT_CREATE_MESSAGES: Final[int] = 3

135 DONT_CREATE_ENTITIES: Final[int] = 2

136 DONT_UPDATE_ENTITIES: Final[int] = 1

137

138 SCHED_REFRESH_INTERVAL: Final[int] = 3 # minutes

139

140# Status codes for Worcester Bosch boilers - OT|OEM diagnostic code

141 WB_STATUS_CODES: Final[dict[str, str]] = {

142 "200": "CH system is being heated.",

143 "201": "DHW system is being heated.",

144 "202": "Anti rapid cycle mode. The boiler has commenced anti-cycle period for CH.",

145 "203": "System standby mode.",

146 "204": "System waiting, appliance waiting for heating system to cool.",

147 "208": "Appliance in service Test mode (Min/Max)",

148 "265": "EMS controller has forced stand-by-mode due to low heating load (power required is less than the minimum output)",

149 "268": "Component test mode (is running the manual component test as activated in the menus).",

150 "270": "Power up mode (appliance is powering up).",

151 "283": "Burner starting. The fan and the pump are being controlled.",

152 "284": "Gas valve(s) opened, flame must be detected within safety time. The gas valve is being controlled.",

153 "305": "Anti fast cycle mode (DHW keep warm function). Diverter valve is held in DHW position for a period of time after DHW demand.",

154 "357": "Appliance in air purge mode. Primary heat exchanger air venting program active - approximately 100 seconds.",

155 "358": "Three way valve kick. If the 3-way valve hasn't moved in within 48 hours, the valve will operate once to prevent seizure",

156}