Home IO Control
ESPHome add-on for IO-Homecontrol devices
Loading...
Searching...
No Matches
esphome::home_io_control::IOHomeDeviceCounterSensor Class Referenceabstract

Shared base for the companions that publish one cumulative uint16_t counter held on IoDevice. More...

#include <platform_companion_sensors.h>

Inheritance diagram for esphome::home_io_control::IOHomeDeviceCounterSensor:
Collaboration diagram for esphome::home_io_control::IOHomeDeviceCounterSensor:

Public Member Functions

void setup () final
 Register the device-update subscription and publish the initial cached count.
Public Member Functions inherited from esphome::home_io_control::IOHomeCompanionSensor
float get_setup_priority () const override
 Get setup priority so the parent hub is available first.
Public Member Functions inherited from esphome::home_io_control::DeviceBoundCompanion
void set_parent (IOHomeControlComponent *parent)
 Set the parent controller component.
void set_device_id (const std::string &id)
 Set the device ID whose state this companion sensor exposes.

Protected Member Functions

virtual uint16_t counter_value (const IoDevice &dev) const =0
 Return the counter this sensor publishes.
Protected Member Functions inherited from esphome::home_io_control::DeviceBoundCompanion
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.

Additional Inherited Members

Protected Attributes inherited from esphome::home_io_control::DeviceBoundCompanion
IOHomeControlComponent * parent_ {nullptr}
std::string device_id_

Detailed Description

Shared base for the companions that publish one cumulative uint16_t counter held on IoDevice.

These differ only in which field they read and what they call themselves, so the binding lives here once and each subclass supplies the field through counter_value(). Zero is a meaningful reading for all of them — "none yet", not "no data" — so unlike RSSI and Last Contact they publish unconditionally on setup.

Definition at line 57 of file platform_companion_sensors.h.

Member Function Documentation

◆ counter_value()

virtual uint16_t esphome::home_io_control::IOHomeDeviceCounterSensor::counter_value ( const IoDevice & dev) const
nodiscardprotectedpure virtual

Return the counter this sensor publishes.

Parameters
devDevice record to read the count from.

Implemented in esphome::home_io_control::IOHomeExchangeFailuresSensor, and esphome::home_io_control::IOHomeUnconfirmedExchangesSensor.

◆ setup()

void esphome::home_io_control::IOHomeDeviceCounterSensor::setup ( )
final

Register the device-update subscription and publish the initial cached count.

Definition at line 66 of file platform_companion_sensors.cpp.

Here is the call graph for this function:

The documentation for this class was generated from the following files: