Home IO Control
ESPHome add-on for IO-Homecontrol devices
Loading...
Searching...
No Matches
platform_climate.h
Go to the documentation of this file.
1#pragma once
2
3/// @file platform_climate.h
4/// @brief Experimental climate entity for IO-Homecontrol heating devices (CMD_WRITE_PRIVATE 0x20).
5/// @ingroup hioc_platforms
6///
7/// Maps Home Assistant climate semantics (HVAC mode, target temperature, presets) onto the six
8/// 2W heating functions in proto_heating.h, transmitting through the hub's single shared heating
9/// send path (IOHomeControlComponent::send_heating_command()). Both this entity and the
10/// `heating_control` hub action use that one path.
11///
12/// Write-only state: the `set_*` functions are write-only — nothing decodes what the radiator
13/// actually did into this entity. (`power_on` and `midnight_sync` are register *reads*; their
14/// 0x21 ACK payload is logged at DEBUG but not decoded into any field.) The entity publishes only
15/// what it has just successfully sent ("last commanded, never confirmed") and never at request
16/// time; there is no status poll and no current temperature. It deliberately does NOT use the
17/// OptimisticState overlay (ADR 0030) — that machinery keeps a prediction apart from a competing
18/// observation, and heating has no observation stream for it to sit against.
19///
20/// @warning Unvalidated on hardware. The protocol is derived from the iohomecontrol project's
21/// Cozytouch support (Atlantic / Thermor / Sauter radiators); no such device has ever
22/// been exercised. See docs/home_io_control.md's experimental banner.
23
24#include "esphome/components/climate/climate.h"
25#include "esphome/core/component.h"
27#include "proto_heating.h"
28
29namespace esphome {
30namespace home_io_control {
31
32/// @brief Climate entity for IO-Homecontrol heating devices.
33/// @ingroup hioc_platforms
34///
35/// The device-binding setters and setup() registration ritual come from DeviceBoundEntity; the
36/// HA-to-protocol mapping and the write-only publish discipline live here.
37class IOHomeClimate : public climate::Climate, public Component, public DeviceBoundEntity {
38 public:
39 /// @brief Register the entity with the shared hub (no status poll — heating has no readback).
40 void setup() override;
41 /// @brief Dump configuration to the log.
42 void dump_config() override;
43 /// @brief Get setup priority (DATA).
44 /// @return setup_priority::DATA.
45 [[nodiscard]] float get_setup_priority() const override { return setup_priority::DATA; }
46
47 /// @brief Static traits: modes OFF/HEAT/AUTO, presets HOME/AWAY, temperature range
48 /// HEATING_TEMP_MIN_C..HEATING_TEMP_MAX_C (7.0..28.0 C) at a 0.5 C step. No current
49 /// temperature (no sensor evidence in the protocol).
50 climate::ClimateTraits traits() override;
51
52 /// @brief Apply a Home Assistant climate control request.
53 ///
54 /// Translates the request to one or more send_heating_command() calls via a single static
55 /// mapping table (climate_mode <-> HeatingMode, climate_preset <-> presence). Publishes each
56 /// changed field only after its send returns success; a failed send leaves the entity state
57 /// untouched.
58 /// @param call The requested attribute changes.
59 void control(const climate::ClimateCall &call) override;
60
61 protected:
62 /// @brief Inbound device-update hook. Intentionally empty: a write-only heating device produces
63 /// no state this entity can publish. Link health / active issue reach the user through the
64 /// companion diagnostic sensors instead.
65 void on_device_update_(const std::string &id, const IoDevice &dev);
66
67 /// @brief Apply the request's HVAC mode via SET_MODE, if present. @return true if state was published.
68 bool apply_mode_(const climate::ClimateCall &call);
69 /// @brief Apply the "Program" custom preset via SET_MODE(prog), if present. @return true if published.
70 bool apply_custom_preset_(const climate::ClimateCall &call);
71 /// @brief Apply a HOME/AWAY preset via SET_PRESENCE, if present. @return true if published.
72 bool apply_preset_(const climate::ClimateCall &call);
73 /// @brief Apply the target temperature via SET_TEMPERATURE, if present. @return true if published.
74 bool apply_target_temperature_(const climate::ClimateCall &call);
75};
76
77} // namespace home_io_control
78} // namespace esphome
Mixin holding the hub-device binding shared by all IO-Homecontrol entity platforms.
Climate entity for IO-Homecontrol heating devices.
void on_device_update_(const std::string &id, const IoDevice &dev)
Inbound device-update hook.
bool apply_custom_preset_(const climate::ClimateCall &call)
Apply the "Program" custom preset via SET_MODE(prog), if present.
void dump_config() override
Dump configuration to the log.
bool apply_target_temperature_(const climate::ClimateCall &call)
Apply the target temperature via SET_TEMPERATURE, if present.
float get_setup_priority() const override
Get setup priority (DATA).
bool apply_preset_(const climate::ClimateCall &call)
Apply a HOME/AWAY preset via SET_PRESENCE, if present.
climate::ClimateTraits traits() override
Static traits: modes OFF/HEAT/AUTO, presets HOME/AWAY, temperature range HEATING_TEMP_MIN_C....
void control(const climate::ClimateCall &call) override
Apply a Home Assistant climate control request.
void setup() override
Register the entity with the shared hub (no status poll — heating has no readback).
bool apply_mode_(const climate::ClimateCall &call)
Apply the request's HVAC mode via SET_MODE, if present.
Shared device-binding mixins for IO-Homecontrol entity platforms.
Pure codec for IO-Homecontrol 2W heating/climate functions (CMD_WRITE_PRIVATE 0x20).
Runtime state of a paired IO‑Homecontrol device.