Mixin holding the hub/device binding shared by the auto-generated per-device companion diagnostic sensors (device name, active issue, RSSI, last contact, exchange failures).
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 hub/device binding shared by the auto-generated per-device companion diagnostic sensors (device name, active issue, RSSI, last contact, exchange failures).
Companions differ from the main entity platforms (DeviceBoundEntity above) in that they only observe a device the main entity already registered: they never call add_device() or configure polling, they just subscribe to update notifications and republish their one value. This mixin centralizes that subscribe-and-republish ritual; each sensor class keeps only its value rendering (including its decision whether a given device state is publishable at all).
Definition at line 115 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 131 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 122 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: