mirror of
https://github.com/esphome/esphome.git
synced 2025-09-03 11:52:20 +01:00
Suppress excessive warnings about deprecated Fan interfaces (#2270)
This commit is contained in:
committed by
Jesse Hills
parent
1b5f11bbee
commit
23ead416d5
@@ -243,6 +243,9 @@ void APIConnection::cover_command(const CoverCommandRequest &msg) {
|
||||
#endif
|
||||
|
||||
#ifdef USE_FAN
|
||||
// Shut-up about usage of deprecated speed_level_to_enum/speed_enum_to_level functions for a bit.
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
||||
bool APIConnection::send_fan_state(fan::FanState *fan) {
|
||||
if (!this->state_subscription_)
|
||||
return false;
|
||||
@@ -291,13 +294,13 @@ void APIConnection::fan_command(const FanCommandRequest &msg) {
|
||||
// Prefer level
|
||||
call.set_speed(msg.speed_level);
|
||||
} else if (msg.has_speed) {
|
||||
// NOLINTNEXTLINE(clang-diagnostic-deprecated-declarations)
|
||||
call.set_speed(fan::speed_enum_to_level(static_cast<fan::FanSpeed>(msg.speed), traits.supported_speed_count()));
|
||||
}
|
||||
if (msg.has_direction)
|
||||
call.set_direction(static_cast<fan::FanDirection>(msg.direction));
|
||||
call.perform();
|
||||
}
|
||||
#pragma GCC diagnostic pop
|
||||
#endif
|
||||
|
||||
#ifdef USE_LIGHT
|
||||
|
Reference in New Issue
Block a user