20constexpr uint16_t LOW_BYTE_MASK = 0xFF;
31constexpr int8_t SETPOINT_HEATER_PROGRAM_PRESET = 2;
151constexpr float TEMPERATURE_VISUAL_MIN_C = 5.0F;
152constexpr float TEMPERATURE_VISUAL_MAX_C = 30.0F;
158 {
true,
false,
false,
false,
160 HEATING_ALIAS_MP_PREFIX,
161 TEMPERATURE_VISUAL_MIN_C,
162 TEMPERATURE_VISUAL_MAX_C,
165 TEMPERATURE_INTERFACE_MODES,
166 std::size(TEMPERATURE_INTERFACE_MODES),
167 TEMPERATURE_INTERFACE_PRESETS,
168 std::size(TEMPERATURE_INTERFACE_PRESETS),
169 TEMPERATURE_INTERFACE_OBSERVED,
170 std::size(TEMPERATURE_INTERFACE_OBSERVED),
178 {
true,
false,
false,
false,
180 HEATING_ALIAS_MP_PREFIX,
181 TEMPERATURE_VISUAL_MIN_C,
182 TEMPERATURE_VISUAL_MAX_C,
186 std::size(HEAT_PUMP_MODES),
188 std::size(HEAT_PUMP_PRESETS),
190 std::size(HEAT_PUMP_OBSERVED),
198 {
false,
false,
false,
false,
200 HEATING_LEVEL_MP_PREFIX,
206 std::size(LEVEL_HEATER_MODES),
207 LEVEL_HEATER_PRESETS,
208 std::size(LEVEL_HEATER_PRESETS),
209 LEVEL_HEATER_OBSERVED,
210 std::size(LEVEL_HEATER_OBSERVED),
218 {
true,
true,
true,
true,
225 SETPOINT_HEATER_MODES,
226 std::size(SETPOINT_HEATER_MODES),
227 SETPOINT_HEATER_PRESETS,
228 std::size(SETPOINT_HEATER_PRESETS),
229 SETPOINT_HEATER_OBSERVED,
230 std::size(SETPOINT_HEATER_OBSERVED),
231 SETPOINT_HEATER_POLL,
232 std::size(SETPOINT_HEATER_POLL),
233 SETPOINT_HEATER_BOOT,
234 std::size(SETPOINT_HEATER_BOOT)},
239 if (profile.type == type && profile.subtype == subtype)
248 const HeatingProfile *profile = find_exact_profile(type, subtype);
249 if (profile !=
nullptr || subtype == 0)
272 if (!std::isfinite(celsius) || !std::isfinite(min_c) || !std::isfinite(max_c) || !(max_c > min_c))
274 const float steps = std::round((celsius - min_c) / (max_c - min_c) *
static_cast<float>(HEATING_TEMPERATURE_MP_SPAN));
275 main_parameter =
static_cast<uint16_t
>(std::clamp(steps, 0.0F,
static_cast<float>(HEATING_TEMPERATURE_MP_SPAN)));
280 if (main_parameter > HEATING_TEMPERATURE_MP_SPAN || !std::isfinite(min_c) || !std::isfinite(max_c) ||
284 min_c + (
static_cast<float>(main_parameter) /
static_cast<float>(HEATING_TEMPERATURE_MP_SPAN) * (max_c - min_c));
289 if ((main_parameter >> BITS_PER_BYTE) != HEATING_LEVEL_MP_PREFIX)
291 level =
static_cast<uint8_t
>(main_parameter & LOW_BYTE_MASK);
const HeatingObservedState * find_observed_state(const HeatingProfile &profile, uint8_t wire)
Find what a device-reported wire value shows on the card.
bool encode_temperature_main_parameter(float celsius, float min_c, float max_c, uint16_t &main_parameter)
Encode a temperature as a main parameter over an encoding range.
@ FP9
Functional parameter 9, one byte.
@ FP16
Functional parameter 16, two bytes.
HeatingFunction
Registers and functions of a 2W heater, one row of the descriptor table each.
@ ROOM_TEMPERATURE
Register 0x0115, read-only: measured room temperature, signed hundredths of a degree.
@ MAX_SETPOINT
Register 0x0102, read-only: highest setpoint the heater accepts, tenths of a degree.
@ SET_PRESENCE
Register 0x0110, write-only: someone is in the room (1) or not (0).
@ REGULATOR_STATE
Register 0x0117, read-only: 0 none, 1 standby, 2 heating.
@ WINDOW_OPEN
Register 0x010E, read-only: the heater's window sensor, 0 closed / 1 open.
@ SET_OPEN_WINDOW_DETECTION
Register 0x0106, read/write: open-window detection on (1) or off (0).
@ SET_TEMPERATURE
Register 0x0103, read/write: comfort setpoint, tenths of a degree.
@ SET_MODE
Register 0x0100, read/write: operating mode (HeatingMode).
const HeatingProfile * find_heating_profile(DeviceType type, uint8_t subtype)
Look up the heating profile for a (type, subtype).
bool decode_temperature_main_parameter(uint16_t main_parameter, float min_c, float max_c, float &celsius)
Decode a main parameter as a temperature over an encoding range (the inverse of encode_temperature_ma...
@ HOME
Someone is in the room.
@ CUSTOM
Named by HeatingPresetEntry::custom_name.
@ AWAY
Nobody is in the room (the frost-protection level on a level heater).
constexpr float HEATING_TEMP_MAX_C
Highest setpoint this codec will encode.
DeviceType
IO-Homecontrol node types.
@ ELECTRICAL_HEATER
Electrical heater.
@ HEATING_TEMPERATURE_INTERFACE
Heating temperature interface.
@ TEMPERATURE_EXECUTE
Standard EXECUTE with a temperature or an alias as the main parameter; read with 0x03.
@ PRIVATE_REGISTERS
CMD_WRITE_PRIVATE register reads and writes (proto_heating.h).
@ HEATING_LEVEL
Standard EXECUTE with a heating level as the main parameter; read with 0x03.
const DeviceTypeInfo * find_exact_device_type_info(DeviceType type, uint8_t subtype)
Look up the table row with exactly this (type, subtype), without falling back.
constexpr float HEATING_TEMP_MIN_C
Lowest setpoint this codec will encode.
bool device_uses_heating_levels(DeviceType type, uint8_t subtype)
Does a climate entity drive this device with heating levels?
bool decode_heating_level(uint16_t main_parameter, uint8_t &level)
Read a heating level out of a main parameter.
@ PROG
Program mode; the device runs its own stored weekly schedule.
@ EXTERNAL_SETPOINT
Setpoint comes from an external controller.
@ MANUAL
Manual mode; follows the last written setpoint.
@ AUTO
Automatic mode; the device manages the setpoint itself.
bool device_uses_heating_registers(DeviceType type, uint8_t subtype)
Does a climate entity drive this device over the private register protocol?
bool device_uses_heating_temperature(DeviceType type, uint8_t subtype)
Does a climate entity drive this device with a temperature or an alias in the main parameter?
constexpr uint16_t heating_prefixed_main_parameter(uint8_t prefix, uint8_t low)
Main parameter of a prefixed value (a level or an alias).
@ AUTO
The device decides.
The IO node-type and subtype table: names, entity class, platform and behaviour flags.
Heating profiles: what a climate card offers for each kind of heater, and how.
Fundamental IO-Homecontrol frame and crypto size constants.
A functional parameter and its value.
One HVAC mode the card offers and the wire value that selects it.
What a device-reported wire value shows on the card.
uint8_t wire
Mode register value, or level low byte, as the device reports it.
One preset the card offers.
const HeatingObservedState * observed
Device-reported value -> card state.
HeatingControlPath path
How the heater is commanded and read.
size_t observed_count
Number of entries in observed.