Home IO Control
ESPHome add-on for IO-Homecontrol devices
Toggle main menu visibility
Loading...
Searching...
No Matches
fan.py
Go to the documentation of this file.
1
## @file
2
## @brief ESPHome fan platform schema and code generation (exterior heating).
3
## @ingroup hioc_codegen
4
##
5
## Defines the experimental IO-Homecontrol exterior-heating integration (a heat level as a fan speed)
6
## and wires it to the shared hub. Shared device-binding logic lives in platform_common.py; only
7
## fan-specific entity construction/registration stays here.
8
9
import
esphome.codegen
as
cg
10
import
esphome.config_validation
as
cv
11
from
esphome.components
import
fan
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
validate_device_model,
20
warn_if_experimental_kind,
21
wire_device_binding,
22
CONF_HOME_IO_CONTROL_ID,
23
)
24
25
DEPENDENCIES = [
"home_io_control"
]
26
27
IOHomeFan = home_io_control_ns.class_(
"IOHomeFan"
, fan.Fan, cg.Component)
28
29
30
def
_inject_companion_ids
(config):
31
return
inject_companion_sensor_ids(config, CONF_ID)
32
33
34
# The entity never restores a saved state: a restored command would be sent to the heater at boot
35
# (the same trap the light platform guards against), and the first status poll is the truth.
36
CONFIG_SCHEMA = cv.All(
37
fan.fan_schema(IOHomeFan, default_restore_mode=
"NO_RESTORE"
)
38
.extend(platform_schema_extension())
39
.extend(cv.COMPONENT_SCHEMA),
40
validate_device_model,
41
warn_if_experimental_kind,
42
_inject_companion_ids,
43
)
44
45
46
async def
to_code
(config):
47
var = await fan.new_fan(config)
48
await cg.register_component(var, config)
49
50
parent = await cg.get_variable(config[CONF_HOME_IO_CONTROL_ID])
51
await wire_device_binding(var, parent, config)
52
await create_companion_sensors(config, parent)
home_io_control.fan.to_code
to_code(config)
Definition
fan.py:46
home_io_control.fan._inject_companion_ids
_inject_companion_ids(config)
Definition
fan.py:30
components
home_io_control
fan.py
Generated by
1.18.0