Home IO Control
ESPHome add-on for IO-Homecontrol devices
Toggle main menu visibility
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
"
23
#include "
platform_entity_base.h
"
24
#include "
proto_device_model.h
"
25
26
namespace
esphome
{
27
namespace
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.
34
class
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.
53
class
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
esphome::home_io_control::DeviceBoundCompanion
Mixin holding the parent + device-id binding shared by per-device entities that are not full entity p...
Definition
platform_entity_base.h:152
esphome::home_io_control::IOHomeOpenWindowDetectionSwitch
Switch that turns the heater's open-window detection on and off.
Definition
platform_climate_controls.h:53
esphome::home_io_control::IOHomeOpenWindowDetectionSwitch::dump_config
void dump_config() override
Dump switch configuration to the log.
Definition
platform_climate_controls.cpp:54
esphome::home_io_control::IOHomeOpenWindowDetectionSwitch::write_state
void write_state(bool state) override
Write the detection setting and read it back.
Definition
platform_climate_controls.cpp:40
esphome::home_io_control::IOHomeOpenWindowDetectionSwitch::setup
void setup() override
Subscribe to the device's updates and publish what is already known.
Definition
platform_climate_controls.cpp:32
esphome::home_io_control::IOHomeOpenWindowDetectionSwitch::get_setup_priority
float get_setup_priority() const override
Get setup priority so the parent hub is available first.
Definition
platform_climate_controls.h:63
esphome::home_io_control::IOHomeWindowBinarySensor
Binary sensor (device_class: window) that is ON while the heater's window sensor reports open.
Definition
platform_climate_controls.h:34
esphome::home_io_control::IOHomeWindowBinarySensor::dump_config
void dump_config() override
Dump sensor configuration to the log.
Definition
platform_climate_controls.cpp:27
esphome::home_io_control::IOHomeWindowBinarySensor::get_setup_priority
float get_setup_priority() const override
Get setup priority so the parent hub is available first.
Definition
platform_climate_controls.h:44
esphome::home_io_control::IOHomeWindowBinarySensor::setup
void setup() override
Subscribe to the device's updates and publish what is already known.
Definition
platform_climate_controls.cpp:16
hub_core.h
IO-Homecontrol ESPHome component — protocol controller.
esphome::home_io_control
Definition
device_registry.cpp:15
esphome
Definition
device_registry.cpp:14
platform_entity_base.h
Shared device-binding mixins for IO-Homecontrol entity platforms.
proto_device_model.h
IO-Homecontrol device-type model, capabilities and runtime device state.
components
home_io_control
platform_climate_controls.h
Generated by
1.18.0