Home IO Control
ESPHome add-on for IO-Homecontrol devices
Loading...
Searching...
No Matches
platform_fan.h
Go to the documentation of this file.
1#pragma once
2
3/// @file platform_fan.h
4/// @brief Experimental fan entity for IO-Homecontrol exterior heating (a heat level, 0-100 %).
5/// @ingroup hioc_platforms
6///
7/// Exterior heating (node type 21) takes a heat level in the position field rather than a
8/// temperature, so it is a fan entity: on/off plus a 0-100 % speed that is the heat level. The
9/// mapping is the dimmable light's: heat `p` % is the IO position `100 - p` (MP = position x 0x200,
10/// so 100 % heat is `0x0000` and off is `0xC800`; KLF 200 API specification, Table 277). Every
11/// exterior heater is sent the main parameter only (no functional-parameter block); subtype 58 is
12/// on/off, so it advertises no speed.
13///
14/// A command shows the commanded on/off and level until the device's status reply (the settle poll
15/// after the command, then the regular poll) replaces it; a reply is always the observation that
16/// wins. Turning on without a level uses the last non-zero level, else full heat.
17///
18/// @todo Experimental: no exterior heater has been exercised on hardware. Confirm the position
19/// mapping and the status read with a capture or a reporter's heater.
20
21#include "esphome/components/fan/fan.h"
22#include "esphome/core/component.h"
24
25namespace esphome {
26namespace home_io_control {
27
28/// @brief Fan entity for IO-Homecontrol exterior heating.
29/// @ingroup hioc_platforms
30///
31/// The device-binding setters, setup() registration ritual and poll-interval dump line come from
32/// DeviceBoundEntity; the heat-level command and status decoding live here.
33class IOHomeFan : public fan::Fan, public Component, public DeviceBoundEntity {
34 public:
35 /// @brief Register the entity with the shared hub and schedule the first status poll.
36 void setup() override;
37 /// @brief Dump configuration to the log.
38 void dump_config() override;
39 /// @brief Get setup priority (DATA).
40 /// @return setup_priority::DATA.
41 [[nodiscard]] float get_setup_priority() const override { return setup_priority::DATA; }
42
43 /// @brief Traits: a 100-step speed (the heat level) unless the device takes the main parameter
44 /// only (subtype 58, on/off). No oscillation, no direction.
45 fan::FanTraits get_traits() override;
46
47 protected:
48 /// @brief Apply a Home Assistant fan request: a heat level, or on/off.
49 /// @param call The requested changes.
50 void control(const fan::FanCall &call) override;
51
52 /// @brief Show a settled device status: heat level = 100 - position.
53 /// @param id Device ID.
54 /// @param dev Updated device state.
55 void on_device_update_(const std::string &id, const IoDevice &dev);
56};
57
58} // namespace home_io_control
59} // namespace esphome
Mixin holding the hub-device binding shared by all IO-Homecontrol entity platforms.
Fan entity for IO-Homecontrol exterior heating.
fan::FanTraits get_traits() override
Traits: a 100-step speed (the heat level) unless the device takes the main parameter only (subtype 58...
void dump_config() override
Dump configuration to the log.
void on_device_update_(const std::string &id, const IoDevice &dev)
Show a settled device status: heat level = 100 - position.
void setup() override
Register the entity with the shared hub and schedule the first status poll.
float get_setup_priority() const override
Get setup priority (DATA).
void control(const fan::FanCall &call) override
Apply a Home Assistant fan request: a heat level, or on/off.
Shared device-binding mixins for IO-Homecontrol entity platforms.
Runtime state of a paired IO‑Homecontrol device.