Home IO Control
ESPHome add-on for IO-Homecontrol devices
Toggle main menu visibility
Loading...
Searching...
No Matches
climate.py
Go to the documentation of this file.
1
## @file
2
## @brief ESPHome climate platform schema and code generation.
3
## @ingroup hioc_codegen
4
##
5
## Defines the experimental IO-Homecontrol heating/climate integration and wires it to the shared
6
## hub. Shared device-binding logic lives in platform_common.py; only climate-specific entity
7
## construction/registration stays here.
8
9
import
esphome.codegen
as
cg
10
import
esphome.config_validation
as
cv
11
from
esphome.components
import
climate
12
from
esphome.const
import
CONF_ID
13
14
from
.
import
home_io_control_ns
15
from
.platform_common
import
(
16
create_companion_sensors,
17
inject_companion_sensor_ids,
18
platform_schema_extension,
19
wire_device_binding,
20
CONF_HOME_IO_CONTROL_ID,
21
CONF_STATUS_POLL_INTERVAL,
22
)
23
24
DEPENDENCIES = [
"home_io_control"
]
25
26
IOHomeClimate = home_io_control_ns.class_(
"IOHomeClimate"
, climate.Climate, cg.Component)
27
28
29
def
_inject_companion_ids
(config):
30
return
inject_companion_sensor_ids(config, CONF_ID)
31
32
33
def
_reject_status_poll_interval
(config):
34
# CMD_WRITE_PRIVATE (0x20) is write-only: a heating device has nothing to read back, so a
35
# status poll interval is meaningless here (and would only schedule rejected polls against
36
# the device). The key is accepted by the shared platform schema; reject it for climate.
37
if
CONF_STATUS_POLL_INTERVAL
in
config:
38
raise
cv.Invalid(
39
"status_poll_interval is not supported for the climate platform: IO-Homecontrol "
40
"heating is write-only and never polls"
,
41
path=[CONF_STATUS_POLL_INTERVAL],
42
)
43
return
config
44
45
46
CONFIG_SCHEMA = cv.All(
47
climate.climate_schema(IOHomeClimate)
48
.extend(platform_schema_extension())
49
.extend(cv.COMPONENT_SCHEMA),
50
_reject_status_poll_interval,
51
_inject_companion_ids,
52
)
53
54
55
async def
to_code
(config):
56
var = cg.new_Pvariable(config[CONF_ID])
57
await cg.register_component(var, config)
58
await climate.register_climate(var, config)
59
60
parent = await cg.get_variable(config[CONF_HOME_IO_CONTROL_ID])
61
await wire_device_binding(var, parent, config)
62
await create_companion_sensors(config, parent)
home_io_control.climate.to_code
to_code(config)
Definition
climate.py:55
home_io_control.climate._inject_companion_ids
_inject_companion_ids(config)
Definition
climate.py:29
home_io_control.climate._reject_status_poll_interval
_reject_status_poll_interval(config)
Definition
climate.py:33
components
home_io_control
climate.py
Generated by
1.18.0