Remove legacy away from generic humidifier.

This commit is contained in:
Jaco1990 2024-05-01 15:12:36 +00:00
parent 672aa79fb4
commit 91e7139d8f
3 changed files with 0 additions and 56 deletions

View File

@ -26,14 +26,10 @@ void GenericHumidifier::setup() {
this->mode = humidifier::HUMIDIFIER_MODE_NORMAL;
} else if (supports_eco_) {
this->mode = humidifier::HUMIDIFIER_MODE_ECO;
} else if (supports_away_) {
this->mode = humidifier::HUMIDIFIER_MODE_AWAY;
} else if (supports_boost_) {
this->mode = humidifier::HUMIDIFIER_MODE_BOOST;
} else if (supports_comfort_) {
this->mode = humidifier::HUMIDIFIER_MODE_COMFORT;
} else if (supports_home_) {
this->mode = humidifier::HUMIDIFIER_MODE_HOME;
} else if (supports_sleep_) {
this->mode = humidifier::HUMIDIFIER_MODE_SLEEP;
} else if (supports_auto_) {
@ -62,14 +58,10 @@ humidifier::HumidifierTraits GenericHumidifier::traits() {
traits.add_supported_mode(humidifier::HUMIDIFIER_MODE_NORMAL);
if (supports_eco_)
traits.add_supported_mode(humidifier::HUMIDIFIER_MODE_ECO);
if (supports_away_)
traits.add_supported_mode(humidifier::HUMIDIFIER_MODE_AWAY);
if (supports_boost_)
traits.add_supported_mode(humidifier::HUMIDIFIER_MODE_BOOST);
if (supports_comfort_)
traits.add_supported_mode(humidifier::HUMIDIFIER_MODE_COMFORT);
if (supports_home_)
traits.add_supported_mode(humidifier::HUMIDIFIER_MODE_HOME);
if (supports_sleep_)
traits.add_supported_mode(humidifier::HUMIDIFIER_MODE_SLEEP);
if (supports_auto_)
@ -109,18 +101,12 @@ void GenericHumidifier::switch_to_action_(humidifier::HumidifierAction action) {
case humidifier::HUMIDIFIER_ACTION_ECO:
trig = this->eco_trigger_;
break;
case humidifier::HUMIDIFIER_ACTION_AWAY:
trig = this->away_trigger_;
break;
case humidifier::HUMIDIFIER_ACTION_BOOST:
trig = this->boost_trigger_;
break;
case humidifier::HUMIDIFIER_ACTION_COMFORT:
trig = this->comfort_trigger_;
break;
case humidifier::HUMIDIFIER_ACTION_HOME:
trig = this->home_trigger_;
break;
case humidifier::HUMIDIFIER_ACTION_SLEEP:
trig = this->sleep_trigger_;
break;
@ -159,14 +145,10 @@ Trigger<> *GenericHumidifier::get_normal_trigger() const { return this->normal_t
void GenericHumidifier::set_supports_normal(bool supports_normal) { this->supports_normal_ = supports_normal; }
Trigger<> *GenericHumidifier::get_eco_trigger() const { return this->eco_trigger_; }
void GenericHumidifier::set_supports_eco(bool supports_eco) { this->supports_eco_ = supports_eco; }
Trigger<> *GenericHumidifier::get_away_trigger() const { return this->away_trigger_; }
void GenericHumidifier::set_supports_away(bool supports_away) { this->supports_away_ = supports_away; }
Trigger<> *GenericHumidifier::get_boost_trigger() const { return this->boost_trigger_; }
void GenericHumidifier::set_supports_boost(bool supports_boost) { this->supports_boost_ = supports_boost; }
Trigger<> *GenericHumidifier::get_comfort_trigger() const { return this->comfort_trigger_; }
void GenericHumidifier::set_supports_comfort(bool supports_comfort) { this->supports_comfort_ = supports_comfort; }
Trigger<> *GenericHumidifier::get_home_trigger() const { return this->home_trigger_; }
void GenericHumidifier::set_supports_home(bool supports_home) { this->supports_home_ = supports_home; }
Trigger<> *GenericHumidifier::get_sleep_trigger() const { return this->sleep_trigger_; }
void GenericHumidifier::set_supports_sleep(bool supports_sleep) { this->supports_sleep_ = supports_sleep; }
Trigger<> *GenericHumidifier::get_auto_trigger() const { return this->auto_trigger_; }
@ -177,10 +159,8 @@ void GenericHumidifier::dump_config() {
LOG_HUMIDIFIER("", "Generic Humidifier", this);
ESP_LOGCONFIG(TAG, " Supports Normal Mode: %s", YESNO(this->supports_normal_));
ESP_LOGCONFIG(TAG, " Supports Eco Mode: %s", YESNO(this->supports_eco_));
ESP_LOGCONFIG(TAG, " Supports Away Mode: %s", YESNO(this->supports_away_));
ESP_LOGCONFIG(TAG, " Supports Boost Mode: %s", YESNO(this->supports_boost_));
ESP_LOGCONFIG(TAG, " Supports Comfort Mode: %s", YESNO(this->supports_comfort_));
ESP_LOGCONFIG(TAG, " Supports Home Mode: %s", YESNO(this->supports_home_));
ESP_LOGCONFIG(TAG, " Supports Sleep Mode: %s", YESNO(this->supports_sleep_));
ESP_LOGCONFIG(TAG, " Supports Auto Mode: %s", YESNO(this->supports_auto_));
ESP_LOGCONFIG(TAG, " Supports Baby Mode: %s", YESNO(this->supports_baby_));

View File

@ -27,14 +27,10 @@ class GenericHumidifier : public humidifier::Humidifier, public Component {
void set_supports_normal(bool supports_normal);
Trigger<> *get_eco_trigger() const;
void set_supports_eco(bool supports_eco);
Trigger<> *get_away_trigger() const;
void set_supports_away(bool supports_away);
Trigger<> *get_boost_trigger() const;
void set_supports_boost(bool supports_boost);
Trigger<> *get_comfort_trigger() const;
void set_supports_comfort(bool supports_comfort);
Trigger<> *get_home_trigger() const;
void set_supports_home(bool supports_home);
Trigger<> *get_sleep_trigger() const;
void set_supports_sleep(bool supports_sleep);
Trigger<> *get_auto_trigger() const;
@ -74,14 +70,6 @@ class GenericHumidifier : public humidifier::Humidifier, public Component {
*/
bool supports_eco_{false};
/** The trigger to call when the controller should switch to away mode.
*/
Trigger<> *away_trigger_;
/** Whether the controller supports away mode.
* A false value for this attribute means that the controller has no away mode action
*/
bool supports_away_{false};
/** The trigger to call when the controller should switch to boost mode.
*/
Trigger<> *boost_trigger_;
@ -98,14 +86,6 @@ class GenericHumidifier : public humidifier::Humidifier, public Component {
*/
bool supports_comfort_{false};
/** The trigger to call when the controller should switch to home mode.
*/
Trigger<> *home_trigger_;
/** Whether the controller supports home mode.
* A false value for this attribute means that the controller has no home mode action
*/
bool supports_home_{false};
/** The trigger to call when the controller should switch to sleep mode.
*/
Trigger<> *sleep_trigger_;

View File

@ -18,10 +18,8 @@ GenericHumidifierTargetHumidityConfig = generic_humidifier_ns.struct(
CONF_NORMAL_ACTION = "normal_action"
CONF_ECO_ACTION = "eco_action"
CONF_AWAY_ACTION = "away_action"
CONF_BOOST_ACTION = "boost_action"
CONF_COMFORT_ACTION = "comfort_action"
CONF_HOME_ACTION = "home_action"
CONF_SLEEP_ACTION = "sleep_action"
CONF_AUTO_ACTION = "auto_action"
CONF_BABY_ACTION = "baby_action"
@ -36,12 +34,10 @@ CONFIG_SCHEMA = cv.All(
single=True
),
cv.Optional(CONF_ECO_ACTION): automation.validate_automation(single=True),
cv.Optional(CONF_AWAY_ACTION): automation.validate_automation(single=True),
cv.Optional(CONF_BOOST_ACTION): automation.validate_automation(single=True),
cv.Optional(CONF_COMFORT_ACTION): automation.validate_automation(
single=True
),
cv.Optional(CONF_HOME_ACTION): automation.validate_automation(single=True),
cv.Optional(CONF_SLEEP_ACTION): automation.validate_automation(single=True),
cv.Optional(CONF_AUTO_ACTION): automation.validate_automation(single=True),
cv.Optional(CONF_BABY_ACTION): automation.validate_automation(single=True),
@ -50,10 +46,8 @@ CONFIG_SCHEMA = cv.All(
cv.has_at_least_one_key(
CONF_NORMAL_ACTION,
CONF_ECO_ACTION,
CONF_AWAY_ACTION,
CONF_BOOST_ACTION,
CONF_COMFORT_ACTION,
CONF_HOME_ACTION,
CONF_SLEEP_ACTION,
CONF_AUTO_ACTION,
CONF_BABY_ACTION,
@ -82,11 +76,6 @@ async def to_code(config):
if eco_action_config := config.get(CONF_ECO_ACTION):
await automation.build_automation(var.get_eco_trigger(), [], eco_action_config)
cg.add(var.set_supports_eco(True))
if away_action_config := config.get(CONF_AWAY_ACTION):
await automation.build_automation(
var.get_away_trigger(), [], away_action_config
)
cg.add(var.set_supports_away(True))
if boost_action_config := config.get(CONF_BOOST_ACTION):
await automation.build_automation(
var.get_boost_trigger(), [], boost_action_config
@ -97,11 +86,6 @@ async def to_code(config):
var.get_comfort_trigger(), [], comfort_action_config
)
cg.add(var.set_supports_comfort(True))
if home_action_config := config.get(CONF_HOME_ACTION):
await automation.build_automation(
var.get_home_trigger(), [], home_action_config
)
cg.add(var.set_supports_home(True))
if sleep_action_config := config.get(CONF_SLEEP_ACTION):
await automation.build_automation(
var.get_sleep_trigger(), [], sleep_action_config