Home IO Control
ESPHome add-on for IO-Homecontrol devices
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"
20
21namespace esphome {
22namespace 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.
29class 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
Mixin holding the hub-device binding shared by all IO-Homecontrol entity platforms.
Binary switch entity for IO‑Homecontrol on/off devices.
float get_setup_priority() const override
Get setup priority (DATA).
void dump_config() override
Dump configuration to log.
void on_device_update_(const std::string &id, const IoDevice &dev)
Callback when device state changes (e.g., from a remote).
void write_state(bool state) override
Write state change to the device.
void setup() override
Initialize the switch entity.
Shared device-binding mixins for IO-Homecontrol entity platforms.
Runtime state of a paired IO‑Homecontrol device.