mirror of
https://github.com/esphome/esphome.git
synced 2025-09-03 11:52:20 +01:00
Refactor fan platform to resemble climate/cover platforms (#2848)
Co-authored-by: Oxan van Leeuwen <oxan@oxanvanleeuwen.nl> Co-authored-by: rob-deutsch <robzyb+altgithub@gmail.com> Co-authored-by: Jesse Hills <3060199+jesserockz@users.noreply.github.com>
This commit is contained in:
@@ -255,7 +255,7 @@ void APIConnection::cover_command(const CoverCommandRequest &msg) {
|
||||
// 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) {
|
||||
bool APIConnection::send_fan_state(fan::Fan *fan) {
|
||||
if (!this->state_subscription_)
|
||||
return false;
|
||||
|
||||
@@ -273,7 +273,7 @@ bool APIConnection::send_fan_state(fan::FanState *fan) {
|
||||
resp.direction = static_cast<enums::FanDirection>(fan->direction);
|
||||
return this->send_fan_state_response(resp);
|
||||
}
|
||||
bool APIConnection::send_fan_info(fan::FanState *fan) {
|
||||
bool APIConnection::send_fan_info(fan::Fan *fan) {
|
||||
auto traits = fan->get_traits();
|
||||
ListEntitiesFanResponse msg;
|
||||
msg.key = fan->get_object_id_hash();
|
||||
@@ -290,7 +290,7 @@ bool APIConnection::send_fan_info(fan::FanState *fan) {
|
||||
return this->send_list_entities_fan_response(msg);
|
||||
}
|
||||
void APIConnection::fan_command(const FanCommandRequest &msg) {
|
||||
fan::FanState *fan = App.get_fan_by_key(msg.key);
|
||||
fan::Fan *fan = App.get_fan_by_key(msg.key);
|
||||
if (fan == nullptr)
|
||||
return;
|
||||
|
||||
|
Reference in New Issue
Block a user