Home IO Control
ESPHome add-on for IO-Homecontrol devices
Loading...
Searching...
No Matches
platform_cover_favorite_button.cpp
Go to the documentation of this file.
1/// @file platform_cover_favorite_button.cpp
2/// @brief Generated favorite-position button for position-capable cover entities.
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.favorite_button";
13
15 if (this->parent_ == nullptr) {
16 ESP_LOGW(TAG, "Ignoring favorite-position press because the parent hub is not configured");
17 return;
18 }
19
20 if (this->parent_->get_device(this->device_id_) == nullptr) {
21 ESP_LOGW(TAG, "Ignoring favorite-position press for %s because the device is not registered yet",
22 this->device_id_.c_str());
23 return;
24 }
25
26 this->parent_->queue_set_device_position(this->device_id_, POS_FAVORITE);
27}
28
30 ESP_LOGCONFIG(TAG, "IO-Homecontrol Favorite Position Button");
31 ESP_LOGCONFIG(TAG, " Device ID: %s", this->device_id_.c_str());
32}
33
34} // namespace home_io_control
35} // namespace esphome
void press_action() override
Handle a Home Assistant button press by queueing a favorite-position command.
void dump_config() override
Dump button configuration to the log.
static constexpr uint8_t POS_FAVORITE
Move to favorite/"My" position.
static const char *const TAG
Definition hub_core.cpp:35
Generated favorite-position button for position-capable cover entities.