Home IO Control
ESPHome add-on for IO-Homecontrol devices
Loading...
Searching...
No Matches
platform_active_issue_text_sensor.cpp
Go to the documentation of this file.
1
/// @file platform_active_issue_text_sensor.cpp
2
/// @brief Diagnostic text sensor exposing a device's currently outstanding CMD_ERROR_RESP reason.
3
/// @ingroup hioc_platforms
4
5
#include "
platform_active_issue_text_sensor.h
"
6
7
#include "
proto_constants.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.active_issue"
;
14
15
void
IOHomeActiveIssueTextSensor::setup
() {
16
this->
register_companion_binding_
([
this
](
const
IoDevice
&dev) {
17
// Empty string when no result is recorded; otherwise the symbolic result name.
18
this->publish_state(dev.
last_result_code
== 0 ?
""
:
command_result_name
(dev.
last_result_code
));
19
});
20
}
21
22
void
IOHomeActiveIssueTextSensor::dump_config
() {
23
LOG_TEXT_SENSOR(
""
,
"IO-Homecontrol Active Issue"
,
this
);
24
ESP_LOGCONFIG(
TAG
,
" Device ID: %s"
, this->
device_id_
.c_str());
25
}
26
27
}
// namespace home_io_control
28
}
// 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::IOHomeActiveIssueTextSensor::setup
void setup() override
Register the device-update subscription and publish the initial cached state.
Definition
platform_active_issue_text_sensor.cpp:15
esphome::home_io_control::IOHomeActiveIssueTextSensor::dump_config
void dump_config() override
Dump text-sensor configuration to the log.
Definition
platform_active_issue_text_sensor.cpp:22
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::command_result_name
const char * command_result_name(uint8_t result)
Return a stable symbolic name for a CMD_ERROR_RESP result code.
Definition
proto_constants.cpp:232
esphome
Definition
device_registry.cpp:12
platform_active_issue_text_sensor.h
Diagnostic text sensor exposing a device's currently outstanding CMD_ERROR_RESP reason.
proto_constants.h
IO-Homecontrol command IDs, result codes and protocol enumerations.
esphome::home_io_control::IoDevice
Runtime state of a paired IO‑Homecontrol device.
Definition
proto_device_model.h:241
esphome::home_io_control::IoDevice::last_result_code
uint8_t last_result_code
Last CMD_ERROR_RESP result byte (0 = none recorded).
Definition
proto_device_model.h:257
components
home_io_control
platform_active_issue_text_sensor.cpp
Generated by
1.16.1