Home IO Control
ESPHome add-on for IO-Homecontrol devices
Loading...
Searching...
No Matches
platform_climate_controls.h
Go to the documentation of this file.
1#pragma once
2
3/// @file platform_climate_controls.h
4/// @brief Generated per-heater auxiliary entities: the window binary sensor and the open-window
5/// detection switch.
6/// @ingroup hioc_platforms
7///
8/// Both are device-bound companions (DeviceBoundCompanion) that climate.py generates alongside a
9/// `climate:` entity when the device's heating profile has them (HeatingProfileFeatures). They show
10/// readings the hub's poll already stores in IoDevice::heating and add no radio traffic of their own,
11/// except the switch's write and the read-back that confirms it.
12///
13/// @todo Experimental: the meaning of registers 0x010E (window sensor) and 0x0106 (open-window
14/// detection) is unconfirmed on hardware. An AGILIA IO radiator answers both reads (window 0,
15/// detection 1, tests/corpus/captures/exchange/atlantic_agilia_exchange_status_read.yaml), but no
16/// report has opened a window or switched detection off yet
17/// ([issue #165](https://github.com/laberning/home_io_control/issues/165)).
18
19#include "esphome/components/binary_sensor/binary_sensor.h"
20#include "esphome/components/switch/switch.h"
21#include "esphome/core/component.h"
22#include "hub_core.h"
24#include "proto_device_model.h"
25
26namespace esphome {
27namespace home_io_control {
28
29/// @brief Binary sensor (`device_class: window`) that is ON while the heater's window sensor reports open.
30/// @ingroup hioc_platforms
31///
32/// Reads IoDevice::heating.window_open. No state until the first poll has read register 0x010E, so
33/// "closed" always means the heater said so.
34class IOHomeWindowBinarySensor : public binary_sensor::BinarySensor, public Component, public DeviceBoundCompanion {
35 public:
36 /// @brief Subscribe to the device's updates and publish what is already known.
37 void setup() override;
38
39 /// @brief Dump sensor configuration to the log.
40 void dump_config() override;
41
42 /// @brief Get setup priority so the parent hub is available first.
43 /// @return setup_priority::DATA.
44 [[nodiscard]] float get_setup_priority() const override { return setup_priority::DATA; }
45};
46
47/// @brief Switch that turns the heater's open-window detection on and off.
48/// @ingroup hioc_platforms
49///
50/// A write sends register 0x0106 and reads it back; the switch shows what the heater answered, so it
51/// has no state until the first read (the boot poll) and never shows a command the heater did not
52/// confirm. Disabled by default and in the config entity category.
53class IOHomeOpenWindowDetectionSwitch : public switch_::Switch, public Component, public DeviceBoundCompanion {
54 public:
55 /// @brief Subscribe to the device's updates and publish what is already known.
56 void setup() override;
57
58 /// @brief Dump switch configuration to the log.
59 void dump_config() override;
60
61 /// @brief Get setup priority so the parent hub is available first.
62 /// @return setup_priority::DATA.
63 [[nodiscard]] float get_setup_priority() const override { return setup_priority::DATA; }
64
65 protected:
66 /// @brief Write the detection setting and read it back.
67 /// @param state True to switch detection on.
68 void write_state(bool state) override;
69};
70
71} // namespace home_io_control
72} // namespace esphome
Mixin holding the parent + device-id binding shared by per-device entities that are not full entity p...
Switch that turns the heater's open-window detection on and off.
void dump_config() override
Dump switch configuration to the log.
void write_state(bool state) override
Write the detection setting and read it back.
void setup() override
Subscribe to the device's updates and publish what is already known.
float get_setup_priority() const override
Get setup priority so the parent hub is available first.
Binary sensor (device_class: window) that is ON while the heater's window sensor reports open.
void dump_config() override
Dump sensor configuration to the log.
float get_setup_priority() const override
Get setup priority so the parent hub is available first.
void setup() override
Subscribe to the device's updates and publish what is already known.
IO-Homecontrol ESPHome component — protocol controller.
Shared device-binding mixins for IO-Homecontrol entity platforms.
IO-Homecontrol device-type model, capabilities and runtime device state.