mirror of
https://github.com/esphome/esphome.git
synced 2025-10-25 21:23:53 +01:00
[fan] Clean up deprecated code from 2022.2 (#11392)
This commit is contained in:
@@ -38,7 +38,6 @@ IS_PLATFORM_COMPONENT = True
|
|||||||
|
|
||||||
fan_ns = cg.esphome_ns.namespace("fan")
|
fan_ns = cg.esphome_ns.namespace("fan")
|
||||||
Fan = fan_ns.class_("Fan", cg.EntityBase)
|
Fan = fan_ns.class_("Fan", cg.EntityBase)
|
||||||
FanState = fan_ns.class_("Fan", Fan, cg.Component)
|
|
||||||
|
|
||||||
FanDirection = fan_ns.enum("FanDirection", is_class=True)
|
FanDirection = fan_ns.enum("FanDirection", is_class=True)
|
||||||
FAN_DIRECTION_ENUM = {
|
FAN_DIRECTION_ENUM = {
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "esphome/core/component.h"
|
|
||||||
#include "esphome/core/automation.h"
|
#include "esphome/core/automation.h"
|
||||||
#include "fan_state.h"
|
#include "esphome/core/component.h"
|
||||||
|
#include "fan.h"
|
||||||
|
|
||||||
namespace esphome {
|
namespace esphome {
|
||||||
namespace fan {
|
namespace fan {
|
||||||
|
|||||||
@@ -1,16 +0,0 @@
|
|||||||
#include "fan_state.h"
|
|
||||||
|
|
||||||
namespace esphome {
|
|
||||||
namespace fan {
|
|
||||||
|
|
||||||
static const char *const TAG = "fan";
|
|
||||||
|
|
||||||
void FanState::setup() {
|
|
||||||
auto restore = this->restore_state_();
|
|
||||||
if (restore)
|
|
||||||
restore->to_call(*this).perform();
|
|
||||||
}
|
|
||||||
float FanState::get_setup_priority() const { return setup_priority::DATA - 1.0f; }
|
|
||||||
|
|
||||||
} // namespace fan
|
|
||||||
} // namespace esphome
|
|
||||||
@@ -1,34 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
|
|
||||||
#include "esphome/core/component.h"
|
|
||||||
#include "fan.h"
|
|
||||||
|
|
||||||
namespace esphome {
|
|
||||||
namespace fan {
|
|
||||||
|
|
||||||
enum ESPDEPRECATED("LegacyFanDirection members are deprecated, use FanDirection instead.",
|
|
||||||
"2022.2") LegacyFanDirection {
|
|
||||||
FAN_DIRECTION_FORWARD = 0,
|
|
||||||
FAN_DIRECTION_REVERSE = 1
|
|
||||||
};
|
|
||||||
|
|
||||||
class ESPDEPRECATED("FanState is deprecated, use Fan instead.", "2022.2") FanState : public Fan, public Component {
|
|
||||||
public:
|
|
||||||
FanState() = default;
|
|
||||||
|
|
||||||
/// Get the traits of this fan.
|
|
||||||
FanTraits get_traits() override { return this->traits_; }
|
|
||||||
/// Set the traits of this fan (i.e. what features it supports).
|
|
||||||
void set_traits(const FanTraits &traits) { this->traits_ = traits; }
|
|
||||||
|
|
||||||
void setup() override;
|
|
||||||
float get_setup_priority() const override;
|
|
||||||
|
|
||||||
protected:
|
|
||||||
void control(const FanCall &call) override { this->publish_state(); }
|
|
||||||
|
|
||||||
FanTraits traits_{};
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace fan
|
|
||||||
} // namespace esphome
|
|
||||||
@@ -5,7 +5,7 @@
|
|||||||
#ifdef USE_MQTT
|
#ifdef USE_MQTT
|
||||||
#ifdef USE_FAN
|
#ifdef USE_FAN
|
||||||
|
|
||||||
#include "esphome/components/fan/fan_state.h"
|
#include "esphome/components/fan/fan.h"
|
||||||
#include "mqtt_component.h"
|
#include "mqtt_component.h"
|
||||||
|
|
||||||
namespace esphome {
|
namespace esphome {
|
||||||
|
|||||||
@@ -39,7 +39,7 @@
|
|||||||
#include "esphome/components/text_sensor/text_sensor.h"
|
#include "esphome/components/text_sensor/text_sensor.h"
|
||||||
#endif
|
#endif
|
||||||
#ifdef USE_FAN
|
#ifdef USE_FAN
|
||||||
#include "esphome/components/fan/fan_state.h"
|
#include "esphome/components/fan/fan.h"
|
||||||
#endif
|
#endif
|
||||||
#ifdef USE_CLIMATE
|
#ifdef USE_CLIMATE
|
||||||
#include "esphome/components/climate/climate.h"
|
#include "esphome/components/climate/climate.h"
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
#include "esphome/components/binary_sensor/binary_sensor.h"
|
#include "esphome/components/binary_sensor/binary_sensor.h"
|
||||||
#endif
|
#endif
|
||||||
#ifdef USE_FAN
|
#ifdef USE_FAN
|
||||||
#include "esphome/components/fan/fan_state.h"
|
#include "esphome/components/fan/fan.h"
|
||||||
#endif
|
#endif
|
||||||
#ifdef USE_LIGHT
|
#ifdef USE_LIGHT
|
||||||
#include "esphome/components/light/light_state.h"
|
#include "esphome/components/light/light_state.h"
|
||||||
|
|||||||
Reference in New Issue
Block a user