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
wire_device_binding,
20
CONF_HOME_IO_CONTROL_ID,
21
)
22
23
DEPENDENCIES = [
"home_io_control"
]
24
25
IOHomeFan = home_io_control_ns.class_(
"IOHomeFan"
, fan.Fan, cg.Component)
26
27
28
def
_inject_companion_ids
(config):
29
return
inject_companion_sensor_ids(config, CONF_ID)
30
31
32
# The entity never restores a saved state: a restored command would be sent to the heater at boot
33
# (the same trap the light platform guards against), and the first status poll is the truth.
34
CONFIG_SCHEMA = cv.All(
35
fan.fan_schema(IOHomeFan, default_restore_mode=
"NO_RESTORE"
)
36
.extend(platform_schema_extension())
37
.extend(cv.COMPONENT_SCHEMA),
38
_inject_companion_ids,
39
)
40
41
42
async def
to_code
(config):
43
var = await fan.new_fan(config)
44
await cg.register_component(var, config)
45
46
parent = await cg.get_variable(config[CONF_HOME_IO_CONTROL_ID])
47
await wire_device_binding(var, parent, config)
48
await create_companion_sensors(config, parent)
home_io_control.fan.to_code
to_code(config)
Definition
fan.py:42
home_io_control.fan._inject_companion_ids
_inject_companion_ids(config)
Definition
fan.py:28
components
home_io_control
fan.py
Generated by
1.18.0