Binary or dimmable light entity for IO‑Homecontrol devices.
More...
#include <platform_light.h>
|
| void | setup () override |
| | Initialize the light entity.
|
| void | dump_config () override |
| | Dump configuration to log.
|
| float | get_setup_priority () const override |
| | Get setup priority (DATA).
|
| void | set_dimmable (bool dimmable) |
| | Enable brightness control (from YAML).
|
| light::LightTraits | get_traits () override |
| | Return traits: ColorMode::BRIGHTNESS if dimmable, else ColorMode::ON_OFF.
|
| void | setup_state (light::LightState *state) override |
| | Store the HA LightState object for state updates.
|
| void | write_state (light::LightState *state) override |
| void | set_parent (IOHomeControlComponent *parent) |
| | Set the parent controller component.
|
| void | set_device_id (const std::string &id) |
| | Set the unique IO-homecontrol device ID (from YAML).
|
| void | set_device_type (DeviceType type) |
| | Set the declared device type (from YAML).
|
| void | set_subtype (uint8_t subtype) |
| | Set the declared device subtype (from YAML).
|
| void | set_optimistic_state (bool optimistic_state) |
| | Enable or disable optimistic target updates for this device (from YAML).
|
| void | set_status_poll_interval (uint32_t poll_interval_ms) |
| | Configure bounded follow-up polling while a state change is expected.
|
Binary or dimmable light entity for IO‑Homecontrol devices.
The device-binding setters, setup() registration ritual and poll-interval dump line come from DeviceBoundEntity; only the on/off/brightness command and status decoding live here.
Definition at line 31 of file platform_light.h.
◆ dump_config()
| void esphome::home_io_control::IOHomeLight::dump_config |
( |
| ) |
|
|
override |
◆ get_setup_priority()
| float esphome::home_io_control::IOHomeLight::get_setup_priority |
( |
| ) |
const |
|
inlinenodiscardoverride |
Get setup priority (DATA).
- Returns
- setup_priority::DATA.
Definition at line 39 of file platform_light.h.
◆ get_traits()
| light::LightTraits esphome::home_io_control::IOHomeLight::get_traits |
( |
| ) |
|
|
override |
Return traits: ColorMode::BRIGHTNESS if dimmable, else ColorMode::ON_OFF.
Definition at line 27 of file platform_light.cpp.
◆ on_device_update_()
| void esphome::home_io_control::IOHomeLight::on_device_update_ |
( |
const std::string & | id, |
|
|
const IoDevice & | dev ) |
|
protected |
Handle inbound device status updates.
- Parameters
-
| id | Device ID. |
| dev | Updated device state. |
Definition at line 62 of file platform_light.cpp.
◆ set_dimmable()
| void esphome::home_io_control::IOHomeLight::set_dimmable |
( |
bool | dimmable | ) |
|
|
inline |
Enable brightness control (from YAML).
Default false: binary on/off only.
- Parameters
-
| dimmable | True to expose ColorMode::BRIGHTNESS instead of ColorMode::ON_OFF. |
Definition at line 43 of file platform_light.h.
◆ setup()
| void esphome::home_io_control::IOHomeLight::setup |
( |
| ) |
|
|
override |
◆ setup_state()
| void esphome::home_io_control::IOHomeLight::setup_state |
( |
light::LightState * | state | ) |
|
|
inlineoverride |
Store the HA LightState object for state updates.
LightState::setup() calls this first, then — moments later in that same call, before we get a chance to do anything else — applies its own restore_mode (default ALWAYS_OFF) via a real write_state() call, exactly as if HA had requested it. That's correct for a local PWM/LED output (which needs some defined state immediately), but wrong for a radio-controlled device with no local output to initialize: it would silently turn the light off (or on) on every reflash regardless of the device's actual state. Arm suppress_write_ here so that one boot-time write is swallowed the same way an inbound-update echo already is; the delayed initial status poll (register_device_binding_(), same as covers) is the real source of truth.
- Parameters
-
| state | Pointer to LightState. |
Definition at line 58 of file platform_light.h.
◆ write_state()
| void esphome::home_io_control::IOHomeLight::write_state |
( |
light::LightState * | state | ) |
|
|
override |
◆ dimmable_
| bool esphome::home_io_control::IOHomeLight::dimmable_ {false} |
|
protected |
◆ state_
| light::LightState* esphome::home_io_control::IOHomeLight::state_ {nullptr} |
|
protected |
◆ suppress_write_
| bool esphome::home_io_control::IOHomeLight::suppress_write_ {false} |
|
protected |
Guard so that an inbound radio status (or LightState's own boot-time restore_mode push — see setup_state()) does not echo back as a new outbound command.
This flag is a light-only asymmetry: LightState::make_call().perform() re-enters write_state(), so both the inbound-update path and setup_state() must suppress that. Switches publish state without re-entering write_state(), so they need no equivalent guard.
Definition at line 78 of file platform_light.h.
The documentation for this class was generated from the following files: