7#include "esphome/core/log.h"
16static const char *
const TAG_SILENT =
"home_io_control.cover.silent";
17static const char *
const TAG_RAIN =
"home_io_control.cover.rain_sensor";
18static const char *
const TAG_BATTERY =
"home_io_control.cover.battery";
22 ESP_LOGW(
TAG_COMMAND_BUTTON,
"Ignoring %s press because the parent hub is not configured",
28 ESP_LOGW(
TAG_COMMAND_BUTTON,
"Ignoring %s press for %s because the device is not registered yet",
47 this->publish_state(dev->silent);
54 this->publish_state(state);
55 ESP_LOGI(
TAG_SILENT,
"Device %s: silent operation %s", this->
device_id_.c_str(), state ?
"on" :
"off");
59 ESP_LOGCONFIG(
TAG_SILENT,
"IO-Homecontrol Silent Operation:");
70 this->publish_state(
true);
73 this->publish_state(
false);
77 this->invalidate_state();
83 ESP_LOGCONFIG(
TAG_RAIN,
"IO-Homecontrol Rain Sensor:");
94 this->publish_state(
true);
98 this->publish_state(
false);
104 this->invalidate_state();
106 if (dev.
last_status != 0 && !this->logged_not_reported_) {
108 ESP_LOGI(
TAG_BATTERY,
"Device %s reports no battery state; it is probably mains powered", this->
device_id_.c_str());
113 ESP_LOGCONFIG(
TAG_BATTERY,
"IO-Homecontrol Battery Low:");
125 ESP_LOGCONFIG(
TAG_BATTERY,
"IO-Homecontrol Battery:");
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.
IOHomeControlComponent * parent_
void setup() override
Subscribe to the device's updates and publish what is already known.
void dump_config() override
Dump sensor configuration to the log.
void publish_battery_(const IoDevice &dev)
Publish from a device record: ON for LOW_CHARGE, OFF for NORMAL/FULL, no state otherwise.
bool logged_not_reported_
The "reports no battery" INFO line was written once already.
void setup() override
Subscribe to the device's updates and publish what is already known.
void dump_config() override
Dump sensor configuration to the log.
virtual IoDevice * get_device(const std::string &device_id)
Retrieve a device by ID; returns nullptr if not found.
virtual bool queue_device_command(const std::string &device_id, CoverCommand cmd)
Queue an async named command (STOP, FAVORITE, VENT, FORCE_OPEN); returns immediately,...
virtual void set_device_silent(const std::string &device_id, bool silent)
Select a device's travel profile at runtime (see IOHomeCoverSilentSwitch).
void write_state(bool state) override
Apply the requested travel profile to the bound device.
void setup() override
Publish the boot state declared in YAML so Home Assistant starts in sync.
void dump_config() override
Dump switch configuration to the log.
void dump_config() override
Dump sensor configuration to the log.
void publish_rain_state_(RainSensorState state)
Publish a rain state: true for RAIN, false for DRY, no state for UNKNOWN.
void setup() override
Subscribe to the device's updates and publish what is already known.
static const char *const TAG_COMMAND_BUTTON
RainSensorState
What the hub's latest minimum-limitation read says about a rain-protection limit.
@ UNKNOWN
No usable reading: never read, or the last reads went unanswered.
@ DRY
The device answered and reports no rain-sized opening limit.
@ RAIN
The device answered and reports an opening limit of rain size.
static const char *const TAG_SILENT
@ FULL_CHARGE
Battery full.
@ NORMAL_CHARGE
Battery neither low nor full.
@ NOT_REPORTED
The device does not report a battery (mains powered), or no status was read yet.
const char * cover_command_name(CoverCommand cmd)
Get a human-readable name for a CoverCommand.
static const char *const TAG_BATTERY
static const char *const TAG_RAIN
const char * battery_state_name(BatteryState state)
Get the name a battery level is published under.
Runtime state of a paired IO‑Homecontrol device.
uint32_t last_status
millis() timestamp of last received status.
RainSensorState rain_sensor
Rain state from the opt-in minimum-limitation poll.
BatteryState battery
Coarse battery level from byte 1 of the device's own status: a reply to a status poll or an authentic...