mirror of
https://github.com/esphome/esphome.git
synced 2025-09-09 23:02:23 +01:00
Support fan speed levels (#1541)
* Add fan speed percentage support to the API * Add float fan speed percentage * Add percentage support to automation and configuration * Update Tuya fan * Fix pylint warning * Update API to use speed levels instead of percentage * Use speed levels * Fix type warnings * MQTT component now converts between speed levels and enums * Webserver now supports speed_level * Update prometheus * Remove low/medium/high settings from speed fan * Remove unused enum * Configurable speed levels for speed fan * Remove unused import * Rename speed_level->speed and speed_levels->speed_count * Rename supported_speed_levels -> supported_speed_count in API and FanTraits Field id stays the same in the protocol, so the change is not breaking for aioesphome.
This commit is contained in:
@@ -284,6 +284,7 @@ class ListEntitiesFanResponse : public ProtoMessage {
|
||||
bool supports_oscillation{false}; // NOLINT
|
||||
bool supports_speed{false}; // NOLINT
|
||||
bool supports_direction{false}; // NOLINT
|
||||
int32_t supported_speed_count{0}; // NOLINT
|
||||
void encode(ProtoWriteBuffer buffer) const override;
|
||||
void dump_to(std::string &out) const override;
|
||||
|
||||
@@ -299,6 +300,7 @@ class FanStateResponse : public ProtoMessage {
|
||||
bool oscillating{false}; // NOLINT
|
||||
enums::FanSpeed speed{}; // NOLINT
|
||||
enums::FanDirection direction{}; // NOLINT
|
||||
int32_t speed_level{0}; // NOLINT
|
||||
void encode(ProtoWriteBuffer buffer) const override;
|
||||
void dump_to(std::string &out) const override;
|
||||
|
||||
@@ -317,6 +319,8 @@ class FanCommandRequest : public ProtoMessage {
|
||||
bool oscillating{false}; // NOLINT
|
||||
bool has_direction{false}; // NOLINT
|
||||
enums::FanDirection direction{}; // NOLINT
|
||||
bool has_speed_level{false}; // NOLINT
|
||||
int32_t speed_level{0}; // NOLINT
|
||||
void encode(ProtoWriteBuffer buffer) const override;
|
||||
void dump_to(std::string &out) const override;
|
||||
|
||||
@@ -401,9 +405,9 @@ class ListEntitiesSensorResponse : public ProtoMessage {
|
||||
std::string unique_id{}; // NOLINT
|
||||
std::string icon{}; // NOLINT
|
||||
std::string unit_of_measurement{}; // NOLINT
|
||||
std::string device_class{}; // NOLINT
|
||||
int32_t accuracy_decimals{0}; // NOLINT
|
||||
bool force_update{false}; // NOLINT
|
||||
std::string device_class{}; // NOLINT
|
||||
void encode(ProtoWriteBuffer buffer) const override;
|
||||
void dump_to(std::string &out) const override;
|
||||
|
||||
|
Reference in New Issue
Block a user