7#include "esphome/core/log.h"
12static const char *
const TAG =
"home_io_control.light";
25 auto traits = light::LightTraits();
26 traits.set_supported_color_modes({this->
dimmable_ ? light::ColorMode::BRIGHTNESS : light::ColorMode::ON_OFF});
37 float brightness = 0.0F;
44 state->current_values.as_brightness(&brightness);
55 state->current_values_as_binary(&on);
68 const float brightness = 1.0F - (dev.
position / 100.0F);
76 this->suppress_write_);
80 ESP_LOGCONFIG(
TAG,
"IO-Homecontrol %s Light", this->
dimmable_ ?
"Dimmable" :
"Binary");
81 ESP_LOGCONFIG(
TAG,
" Device ID: %s", this->
device_id_.c_str());
void log_poll_interval_config_(const char *tag) const
Emit the shared two-branch poll-interval line for dump_config().
void register_device_binding_(Component *self, DeviceCapabilityClass entity_class, std::optional< bool > invert_override, std::function< void(const std::string &, const IoDevice &)> on_update, bool dimmable=false)
Perform the shared setup() registration ritual.
IOHomeControlComponent * parent_
bool passes_binary_update_filter_(const std::string &id, const IoDevice &dev) const
Shared inbound-update guard for binary endpoints.
virtual void queue_set_light_position(const std::string &device_id, uint8_t position)
Async form of set_light_position() that keeps radio work serialized on the main loop.
virtual void queue_set_light_state(const std::string &device_id, bool on)
Async form of set_light_state() that keeps radio work serialized on the main loop.
void write_state(light::LightState *state) override
bool suppress_write_
Guard so that an inbound radio status (or LightState's own boot-time restore_mode push — see setup_st...
light::LightState * state_
void on_device_update_(const std::string &id, const IoDevice &dev)
Handle inbound device status updates.
void dump_config() override
Dump configuration to log.
light::LightTraits get_traits() override
Return traits: ColorMode::BRIGHTNESS if dimmable, else ColorMode::ON_OFF.
void setup() override
Initialize the light entity.
Conversions and renderers shared by the hub and its Home Assistant entities.
constexpr float BINARY_ENTITY_ON_POSITION_THRESHOLD
Shared 0-100 cutoff: values below this mean binary "on".
uint8_t round_percent(float fraction)
Convert a 0.0-1.0 HA fraction (position, tilt, or brightness) to a 0-100 IO percent.
static constexpr const char * TAG
@ LIGHT
Binary on/off light.
static const char *const TAG
Runtime state of a paired IO‑Homecontrol device.
float position
Current position: 0=open, 100=closed, or UNKNOWN_POSITION.