Mixin holding the parent + device-id binding shared by per-device entities that are not full entity platforms: the auto-generated companion diagnostic sensors (device name, active issue, RSSI, last contact, exchange failures, last commanded by, last command source) and the per-device auxiliary control entities (cover favorite/vent buttons, cover silent switch).
More...
#include <platform_entity_base.h>
|
| 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.
|
Mixin holding the parent + device-id binding shared by per-device entities that are not full entity platforms: the auto-generated companion diagnostic sensors (device name, active issue, RSSI, last contact, exchange failures, last commanded by, last command source) and the per-device auxiliary control entities (cover favorite/vent buttons, cover silent switch).
These differ from the main entity platforms (DeviceBoundEntity above) in that they do not own the device: they never call add_device() or configure polling. The companion sensors use register_companion_binding_() to subscribe to update notifications and republish their one value; the auxiliary control entities take only the parent + device-id pair and act on their already-registered device on demand, so register_companion_binding_() stays opt-in. Each class keeps its own value rendering / action logic (including whether a given device state is publishable at all).
Definition at line 138 of file platform_entity_base.h.
◆ register_companion_binding_()
| void esphome::home_io_control::DeviceBoundCompanion::register_companion_binding_ |
( |
const std::function< void(const IoDevice &)> & | publish | ) |
|
|
inlineprotected |
Shared setup() body: subscribe to this device's updates and publish the initial state.
No-op when no parent is wired (codegen always wires one before setup() runs).
- Parameters
-
| publish | Renders and publishes the sensor's value from a device record — or skips publishing when the record has no meaningful value yet. Runs once immediately when the device is already registered, then again on every update notification for this device. |
Definition at line 154 of file platform_entity_base.h.
◆ set_device_id()
| void esphome::home_io_control::DeviceBoundCompanion::set_device_id |
( |
const std::string & | id | ) |
|
|
inline |
Set the device ID whose state this companion sensor exposes.
- Parameters
-
| id | Hexadecimal node ID string (for example "123ABC"). |
Definition at line 145 of file platform_entity_base.h.
◆ set_parent()
◆ device_id_
| std::string esphome::home_io_control::DeviceBoundCompanion::device_id_ |
|
protected |
◆ parent_
The documentation for this class was generated from the following file: