Home IO Control
ESPHome add-on for IO-Homecontrol devices
Loading...
Searching...
No Matches
platform_rssi_sensor.cpp
Go to the documentation of this file.
1/// @file platform_rssi_sensor.cpp
2/// @brief Diagnostic sensor exposing a device's smoothed RSSI.
3/// @ingroup hioc_platforms
4
6
7#include "esphome/core/log.h"
8
9namespace esphome {
10namespace home_io_control {
11
12static const char *const TAG = "home_io_control.rssi";
13
15 this->register_companion_binding_([this](const IoDevice &dev) {
16 if (const int16_t ema_dbm = device_rssi_ema_dbm(dev); ema_dbm != RSSI_UNKNOWN_DBM)
17 this->publish_state(ema_dbm);
18 });
19}
20
22 LOG_SENSOR("", "IO-Homecontrol RSSI", this);
23 ESP_LOGCONFIG(TAG, " Device ID: %s", this->device_id_.c_str());
24}
25
26} // namespace home_io_control
27} // namespace esphome
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.
void setup() override
Register the device-update subscription and publish the initial cached state.
void dump_config() override
Dump sensor configuration to the log.
static constexpr const char * TAG
int16_t device_rssi_ema_dbm(const IoDevice &dev)
A device's smoothed RSSI in whole dBm.
static constexpr int16_t RSSI_UNKNOWN_DBM
Sentinel value meaning "no RSSI sample recorded yet" for last_rssi_dbm/rssi_ema_scaled.
Diagnostic sensor exposing a device's smoothed RSSI.
Runtime state of a paired IO‑Homecontrol device.