Home IO Control
ESPHome add-on for IO-Homecontrol devices
Toggle main menu visibility
Loading...
Searching...
No Matches
platform_switch.h
Go to the documentation of this file.
1
#pragma once
2
3
/// @file platform_switch.h
4
/// @brief Experimental binary switch entity for IO‑Homecontrol devices.
5
/// @ingroup hioc_platforms
6
///
7
/// Provides a minimal on/off switch representation. Position < 50 is treated as on.
8
/// This platform is experimental and not yet validated on real hardware.
9
/// @todo Validate end-to-end behavior with physical IO-Homecontrol switch devices,
10
/// including passive state updates, startup state restoration, and any vendor-specific
11
/// position encodings that do not map cleanly to binary on/off semantics.
12
///
13
/// @warning This platform has not been tested with physical IO‑Homecontrol switch devices.
14
/// Behavior is inferred from the protocol specification and may be incomplete.
15
/// Use with caution and verify with actual hardware before production deployment.
16
17
#include "esphome/core/component.h"
18
#include "esphome/components/switch/switch.h"
19
#include "
platform_entity_base.h
"
20
21
namespace
esphome
{
22
namespace
home_io_control
{
23
24
/// @brief Binary switch entity for IO‑Homecontrol on/off devices.
25
/// @ingroup hioc_platforms
26
///
27
/// The device-binding setters, setup() registration ritual and poll-interval dump line come
28
/// from DeviceBoundEntity; only the on/off command and status decoding live here.
29
class
IOHomeSwitch
:
public
switch_::Switch,
public
Component,
public
DeviceBoundEntity
{
30
public
:
31
/// @brief Initialize the switch entity.
32
void
setup
()
override
;
33
/// @brief Dump configuration to log.
34
void
dump_config
()
override
;
35
/// @brief Get setup priority (DATA).
36
/// @return setup_priority::DATA.
37
[[nodiscard]]
float
get_setup_priority
()
const override
{
return
setup_priority::DATA; }
38
39
protected
:
40
/// @brief Write state change to the device.
41
/// @param state Desired on/off state.
42
void
write_state
(
bool
state)
override
;
43
/// @brief Callback when device state changes (e.g., from a remote).
44
/// @param id Device ID.
45
/// @param dev Updated IoDevice state.
46
void
on_device_update_
(
const
std::string &
id
,
const
IoDevice
&dev);
47
};
48
49
}
// namespace home_io_control
50
}
// namespace esphome
esphome::home_io_control::DeviceBoundEntity
Mixin holding the hub-device binding shared by all IO-Homecontrol entity platforms.
Definition
platform_entity_base.h:36
esphome::home_io_control::IOHomeSwitch
Binary switch entity for IO‑Homecontrol on/off devices.
Definition
platform_switch.h:29
esphome::home_io_control::IOHomeSwitch::get_setup_priority
float get_setup_priority() const override
Get setup priority (DATA).
Definition
platform_switch.h:37
esphome::home_io_control::IOHomeSwitch::dump_config
void dump_config() override
Dump configuration to log.
Definition
platform_switch.cpp:37
esphome::home_io_control::IOHomeSwitch::on_device_update_
void on_device_update_(const std::string &id, const IoDevice &dev)
Callback when device state changes (e.g., from a remote).
Definition
platform_switch.cpp:28
esphome::home_io_control::IOHomeSwitch::write_state
void write_state(bool state) override
Write state change to the device.
Definition
platform_switch.cpp:22
esphome::home_io_control::IOHomeSwitch::setup
void setup() override
Initialize the switch entity.
Definition
platform_switch.cpp:14
esphome::home_io_control
Definition
device_registry.cpp:13
esphome
Definition
device_registry.cpp:12
platform_entity_base.h
Shared device-binding mixins for IO-Homecontrol entity platforms.
esphome::home_io_control::IoDevice
Runtime state of a paired IO‑Homecontrol device.
Definition
proto_device_model.h:321
components
home_io_control
platform_switch.h
Generated by
1.18.0