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
5
#include "
platform_device_name_text_sensor.h
"
6
7
#include "
hub_internal.h
"
8
#include "esphome/core/log.h"
9
10
namespace
esphome
{
11
namespace
home_io_control
{
12
13
static
const
char
*
const
TAG
=
"home_io_control.device_name"
;
14
15
void
IOHomeDeviceNameTextSensor::setup
() {
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
25
void
IOHomeDeviceNameTextSensor::dump_config
() {
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
esphome::home_io_control::DeviceBoundCompanion::device_id_
std::string device_id_
Definition
platform_entity_base.h:145
esphome::home_io_control::DeviceBoundCompanion::register_companion_binding_
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.
Definition
platform_entity_base.h:131
esphome::home_io_control::DeviceBoundCompanion::parent_
IOHomeControlComponent * parent_
Definition
platform_entity_base.h:144
esphome::home_io_control::IOHomeDeviceNameTextSensor::setup
void setup() override
Register the device-update subscription and schedule an initial name fetch.
Definition
platform_device_name_text_sensor.cpp:15
esphome::home_io_control::IOHomeDeviceNameTextSensor::dump_config
void dump_config() override
Dump text-sensor configuration to the log.
Definition
platform_device_name_text_sensor.cpp:25
hub_internal.h
Internal helpers shared by the hub implementation .cpp files.
esphome::home_io_control
Definition
device_registry.cpp:13
esphome::home_io_control::TAG
static constexpr const char * TAG
Definition
device_registry.cpp:15
esphome::home_io_control::INITIAL_STATUS_REQUEST_DELAY_MS
static constexpr uint32_t INITIAL_STATUS_REQUEST_DELAY_MS
Delay before the first post-boot status request from an entity.
Definition
status_poll_policy.h:39
esphome
Definition
device_registry.cpp:12
platform_device_name_text_sensor.h
Diagnostic text sensor exposing the stored IO-Homecontrol device name.
esphome::home_io_control::IoDevice
Runtime state of a paired IO‑Homecontrol device.
Definition
proto_device_model.h:241
esphome::home_io_control::IoDevice::name
char name[DEVICE_NAME_BUFFER_SIZE]
Cached UTF-8 device name decoded from Latin-1 wire payloads.
Definition
proto_device_model.h:245
components
home_io_control
platform_device_name_text_sensor.cpp
Generated by
1.16.1