Home IO Control
ESPHome add-on for IO-Homecontrol devices
Loading...
Searching...
No Matches
platform_device_name_text_sensor.cpp
Go to the documentation of this file.
1/// @file platform_device_name_text_sensor.cpp
2/// @brief Diagnostic text sensor exposing the stored IO-Homecontrol device name.
3/// @ingroup hioc_platforms
4
6
7#include "hub_internal.h"
8#include "esphome/core/log.h"
9
10namespace esphome {
11namespace home_io_control {
12
13static const char *const TAG = "home_io_control.device_name";
14
16 if (this->parent_ == nullptr)
17 return;
18
19 this->register_companion_binding_([this](const IoDevice &dev) { this->publish_state(dev.name); });
20
21 this->set_timeout("init_name", INITIAL_STATUS_REQUEST_DELAY_MS,
22 [this]() { this->parent_->queue_request_device_name(this->device_id_); });
23}
24
26 LOG_TEXT_SENSOR("", "IO-Homecontrol Device Name", this);
27 ESP_LOGCONFIG(TAG, " Device ID: %s", this->device_id_.c_str());
28}
29
30} // namespace home_io_control
31} // namespace esphome
void register_companion_binding_(const std::function< void(const IoDevice &)> &publish)
Shared setup() body: subscribe to this device's updates and publish the initial state.
void setup() override
Register the device-update subscription and schedule an initial name fetch.
void dump_config() override
Dump text-sensor configuration to the log.
Internal helpers shared by the hub implementation .cpp files.
static constexpr const char * TAG
static constexpr uint32_t INITIAL_STATUS_REQUEST_DELAY_MS
Delay before the first post-boot status request from an entity.
Diagnostic text sensor exposing the stored IO-Homecontrol device name.
Runtime state of a paired IO‑Homecontrol device.
char name[DEVICE_NAME_BUFFER_SIZE]
Cached UTF-8 device name decoded from Latin-1 wire payloads.