-
-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
23 changed files
with
396 additions
and
80 deletions.
There are no files selected for viewing
Validating CODEOWNERS rules …
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import esphome.codegen as cg | ||
import esphome.config_validation as cv | ||
from esphome.components import button | ||
from ..climate import ( | ||
CONF_HAIER_ID, | ||
HonClimate, | ||
haier_ns, | ||
) | ||
|
||
CODEOWNERS = ["@paveldn"] | ||
SelfCleaningButton = haier_ns.class_("SelfCleaningButton", button.Button) | ||
SteriCleaningButton = haier_ns.class_("SteriCleaningButton", button.Button) | ||
|
||
|
||
# Haier buttons | ||
CONF_SELF_CLEANING = "self_cleaning" | ||
CONF_STERI_CLEANING = "steri_cleaning" | ||
|
||
# Additional icons | ||
ICON_SPRAY_BOTTLE = "mdi:spray-bottle" | ||
|
||
CONFIG_SCHEMA = cv.Schema( | ||
{ | ||
cv.Required(CONF_HAIER_ID): cv.use_id(HonClimate), | ||
cv.Optional(CONF_SELF_CLEANING): button.button_schema( | ||
SelfCleaningButton, | ||
icon=ICON_SPRAY_BOTTLE, | ||
), | ||
cv.Optional(CONF_STERI_CLEANING): button.button_schema( | ||
SteriCleaningButton, | ||
icon=ICON_SPRAY_BOTTLE, | ||
), | ||
} | ||
) | ||
|
||
|
||
async def to_code(config): | ||
for button_type in [CONF_SELF_CLEANING, CONF_STERI_CLEANING]: | ||
if conf := config.get(button_type): | ||
btn = await button.new_button(conf) | ||
await cg.register_parented(btn, config[CONF_HAIER_ID]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#include "self_cleaning.h" | ||
|
||
namespace esphome { | ||
namespace haier { | ||
|
||
void SelfCleaningButton::press_action() { this->parent_->start_self_cleaning(); } | ||
|
||
} // namespace haier | ||
} // namespace esphome |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#pragma once | ||
|
||
#include "esphome/components/button/button.h" | ||
#include "../hon_climate.h" | ||
|
||
namespace esphome { | ||
namespace haier { | ||
|
||
class SelfCleaningButton : public button::Button, public Parented<HonClimate> { | ||
public: | ||
SelfCleaningButton() = default; | ||
|
||
protected: | ||
void press_action() override; | ||
}; | ||
|
||
} // namespace haier | ||
} // namespace esphome |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#include "steri_cleaning.h" | ||
|
||
namespace esphome { | ||
namespace haier { | ||
|
||
void SteriCleaningButton::press_action() { this->parent_->start_steri_cleaning(); } | ||
|
||
} // namespace haier | ||
} // namespace esphome |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#pragma once | ||
|
||
#include "esphome/components/button/button.h" | ||
#include "../hon_climate.h" | ||
|
||
namespace esphome { | ||
namespace haier { | ||
|
||
class SteriCleaningButton : public button::Button, public Parented<HonClimate> { | ||
public: | ||
SteriCleaningButton() = default; | ||
|
||
protected: | ||
void press_action() override; | ||
}; | ||
|
||
} // namespace haier | ||
} // namespace esphome |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.