mirror of
https://github.com/esphome/esphome.git
synced 2025-11-03 08:31:47 +00:00
Compare commits
29 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5086cd716f | ||
|
|
4937af0cd9 | ||
|
|
877a5fda41 | ||
|
|
1fac91a659 | ||
|
|
0a4837c1f0 | ||
|
|
e7404183a0 | ||
|
|
44f8dcfb6e | ||
|
|
481e0e98f8 | ||
|
|
9de40c26eb | ||
|
|
ad953f02d1 | ||
|
|
3869e56521 | ||
|
|
63d87b17aa | ||
|
|
2e59ad90cc | ||
|
|
1b8c9edcde | ||
|
|
d4c2a85f9c | ||
|
|
8c75b87e94 | ||
|
|
409d4b9d47 | ||
|
|
4e3b95d120 | ||
|
|
61a9c9fa33 | ||
|
|
9c605f2d46 | ||
|
|
44bb5a89c8 | ||
|
|
cbdb96f105 | ||
|
|
9ee3463d07 | ||
|
|
8bf0448f41 | ||
|
|
14e04eb231 | ||
|
|
1be9bac3a9 | ||
|
|
02b5a3efb8 | ||
|
|
bd457f64d8 | ||
|
|
9efeea14f2 |
4
.github/workflows/release.yml
vendored
4
.github/workflows/release.yml
vendored
@@ -19,7 +19,7 @@ jobs:
|
||||
id: tag
|
||||
run: |
|
||||
if [[ "$GITHUB_EVENT_NAME" = "release" ]]; then
|
||||
TAG="${GITHUB_REF#refs/tags/v}"
|
||||
TAG="${GITHUB_REF#refs/tags/}"
|
||||
else
|
||||
TAG=$(cat esphome/const.py | sed -n -E "s/^__version__\s+=\s+\"(.+)\"$/\1/p")
|
||||
today="$(date --utc '+%Y%m%d')"
|
||||
@@ -138,7 +138,7 @@ jobs:
|
||||
- env:
|
||||
TOKEN: ${{ secrets.DEPLOY_HASSIO_TOKEN }}
|
||||
run: |
|
||||
TAG="${GITHUB_REF#refs/tags/v}"
|
||||
TAG="${GITHUB_REF#refs/tags/}"
|
||||
curl \
|
||||
-u ":$TOKEN" \
|
||||
-X POST \
|
||||
|
||||
@@ -448,6 +448,7 @@ message LightCommandRequest {
|
||||
enum SensorStateClass {
|
||||
STATE_CLASS_NONE = 0;
|
||||
STATE_CLASS_MEASUREMENT = 1;
|
||||
STATE_CLASS_TOTAL_INCREASING = 2;
|
||||
}
|
||||
|
||||
enum SensorLastResetType {
|
||||
@@ -555,9 +556,10 @@ enum LogLevel {
|
||||
LOG_LEVEL_ERROR = 1;
|
||||
LOG_LEVEL_WARN = 2;
|
||||
LOG_LEVEL_INFO = 3;
|
||||
LOG_LEVEL_DEBUG = 4;
|
||||
LOG_LEVEL_VERBOSE = 5;
|
||||
LOG_LEVEL_VERY_VERBOSE = 6;
|
||||
LOG_LEVEL_CONFIG = 4;
|
||||
LOG_LEVEL_DEBUG = 5;
|
||||
LOG_LEVEL_VERBOSE = 6;
|
||||
LOG_LEVEL_VERY_VERBOSE = 7;
|
||||
}
|
||||
message SubscribeLogsRequest {
|
||||
option (id) = 28;
|
||||
@@ -572,7 +574,6 @@ message SubscribeLogsResponse {
|
||||
option (no_delay) = false;
|
||||
|
||||
LogLevel level = 1;
|
||||
string tag = 2;
|
||||
string message = 3;
|
||||
bool send_failed = 4;
|
||||
}
|
||||
|
||||
@@ -310,22 +310,15 @@ bool APIConnection::send_light_state(light::LightState *light) {
|
||||
resp.key = light->get_object_id_hash();
|
||||
resp.state = values.is_on();
|
||||
resp.color_mode = static_cast<enums::ColorMode>(color_mode);
|
||||
if (color_mode & light::ColorCapability::BRIGHTNESS)
|
||||
resp.brightness = values.get_brightness();
|
||||
if (color_mode & light::ColorCapability::RGB) {
|
||||
resp.color_brightness = values.get_color_brightness();
|
||||
resp.red = values.get_red();
|
||||
resp.green = values.get_green();
|
||||
resp.blue = values.get_blue();
|
||||
}
|
||||
if (color_mode & light::ColorCapability::WHITE)
|
||||
resp.white = values.get_white();
|
||||
if (color_mode & light::ColorCapability::COLOR_TEMPERATURE)
|
||||
resp.color_temperature = values.get_color_temperature();
|
||||
if (color_mode & light::ColorCapability::COLD_WARM_WHITE) {
|
||||
resp.cold_white = values.get_cold_white();
|
||||
resp.warm_white = values.get_warm_white();
|
||||
}
|
||||
resp.brightness = values.get_brightness();
|
||||
resp.color_brightness = values.get_color_brightness();
|
||||
resp.red = values.get_red();
|
||||
resp.green = values.get_green();
|
||||
resp.blue = values.get_blue();
|
||||
resp.white = values.get_white();
|
||||
resp.color_temperature = values.get_color_temperature();
|
||||
resp.cold_white = values.get_cold_white();
|
||||
resp.warm_white = values.get_warm_white();
|
||||
if (light->supports_effects())
|
||||
resp.effect = light->get_effect_name();
|
||||
return this->send_light_state_response(resp);
|
||||
@@ -701,8 +694,6 @@ bool APIConnection::send_log_message(int level, const char *tag, const char *lin
|
||||
auto buffer = this->create_buffer();
|
||||
// LogLevel level = 1;
|
||||
buffer.encode_uint32(1, static_cast<uint32_t>(level));
|
||||
// string tag = 2;
|
||||
// buffer.encode_string(2, tag, strlen(tag));
|
||||
// string message = 3;
|
||||
buffer.encode_string(3, line, strlen(line));
|
||||
// SubscribeLogsResponse - 29
|
||||
|
||||
@@ -94,6 +94,8 @@ template<> const char *proto_enum_to_string<enums::SensorStateClass>(enums::Sens
|
||||
return "STATE_CLASS_NONE";
|
||||
case enums::STATE_CLASS_MEASUREMENT:
|
||||
return "STATE_CLASS_MEASUREMENT";
|
||||
case enums::STATE_CLASS_TOTAL_INCREASING:
|
||||
return "STATE_CLASS_TOTAL_INCREASING";
|
||||
default:
|
||||
return "UNKNOWN";
|
||||
}
|
||||
@@ -120,6 +122,8 @@ template<> const char *proto_enum_to_string<enums::LogLevel>(enums::LogLevel val
|
||||
return "LOG_LEVEL_WARN";
|
||||
case enums::LOG_LEVEL_INFO:
|
||||
return "LOG_LEVEL_INFO";
|
||||
case enums::LOG_LEVEL_CONFIG:
|
||||
return "LOG_LEVEL_CONFIG";
|
||||
case enums::LOG_LEVEL_DEBUG:
|
||||
return "LOG_LEVEL_DEBUG";
|
||||
case enums::LOG_LEVEL_VERBOSE:
|
||||
@@ -2334,10 +2338,6 @@ bool SubscribeLogsResponse::decode_varint(uint32_t field_id, ProtoVarInt value)
|
||||
}
|
||||
bool SubscribeLogsResponse::decode_length(uint32_t field_id, ProtoLengthDelimited value) {
|
||||
switch (field_id) {
|
||||
case 2: {
|
||||
this->tag = value.as_string();
|
||||
return true;
|
||||
}
|
||||
case 3: {
|
||||
this->message = value.as_string();
|
||||
return true;
|
||||
@@ -2348,7 +2348,6 @@ bool SubscribeLogsResponse::decode_length(uint32_t field_id, ProtoLengthDelimite
|
||||
}
|
||||
void SubscribeLogsResponse::encode(ProtoWriteBuffer buffer) const {
|
||||
buffer.encode_enum<enums::LogLevel>(1, this->level);
|
||||
buffer.encode_string(2, this->tag);
|
||||
buffer.encode_string(3, this->message);
|
||||
buffer.encode_bool(4, this->send_failed);
|
||||
}
|
||||
@@ -2360,10 +2359,6 @@ void SubscribeLogsResponse::dump_to(std::string &out) const {
|
||||
out.append(proto_enum_to_string<enums::LogLevel>(this->level));
|
||||
out.append("\n");
|
||||
|
||||
out.append(" tag: ");
|
||||
out.append("'").append(this->tag).append("'");
|
||||
out.append("\n");
|
||||
|
||||
out.append(" message: ");
|
||||
out.append("'").append(this->message).append("'");
|
||||
out.append("\n");
|
||||
|
||||
@@ -47,6 +47,7 @@ enum ColorMode : uint32_t {
|
||||
enum SensorStateClass : uint32_t {
|
||||
STATE_CLASS_NONE = 0,
|
||||
STATE_CLASS_MEASUREMENT = 1,
|
||||
STATE_CLASS_TOTAL_INCREASING = 2,
|
||||
};
|
||||
enum SensorLastResetType : uint32_t {
|
||||
LAST_RESET_NONE = 0,
|
||||
@@ -58,9 +59,10 @@ enum LogLevel : uint32_t {
|
||||
LOG_LEVEL_ERROR = 1,
|
||||
LOG_LEVEL_WARN = 2,
|
||||
LOG_LEVEL_INFO = 3,
|
||||
LOG_LEVEL_DEBUG = 4,
|
||||
LOG_LEVEL_VERBOSE = 5,
|
||||
LOG_LEVEL_VERY_VERBOSE = 6,
|
||||
LOG_LEVEL_CONFIG = 4,
|
||||
LOG_LEVEL_DEBUG = 5,
|
||||
LOG_LEVEL_VERBOSE = 6,
|
||||
LOG_LEVEL_VERY_VERBOSE = 7,
|
||||
};
|
||||
enum ServiceArgType : uint32_t {
|
||||
SERVICE_ARG_TYPE_BOOL = 0,
|
||||
@@ -627,7 +629,6 @@ class SubscribeLogsRequest : public ProtoMessage {
|
||||
class SubscribeLogsResponse : public ProtoMessage {
|
||||
public:
|
||||
enums::LogLevel level{};
|
||||
std::string tag{};
|
||||
std::string message{};
|
||||
bool send_failed{false};
|
||||
void encode(ProtoWriteBuffer buffer) const override;
|
||||
|
||||
@@ -5,6 +5,7 @@ from esphome.const import (
|
||||
DEVICE_CLASS_CURRENT,
|
||||
DEVICE_CLASS_EMPTY,
|
||||
DEVICE_CLASS_ENERGY,
|
||||
DEVICE_CLASS_GAS,
|
||||
DEVICE_CLASS_POWER,
|
||||
DEVICE_CLASS_VOLTAGE,
|
||||
ICON_EMPTY,
|
||||
@@ -178,7 +179,7 @@ CONFIG_SCHEMA = cv.Schema(
|
||||
"m³",
|
||||
ICON_EMPTY,
|
||||
3,
|
||||
DEVICE_CLASS_EMPTY,
|
||||
DEVICE_CLASS_GAS,
|
||||
STATE_CLASS_MEASUREMENT,
|
||||
LAST_RESET_TYPE_NEVER,
|
||||
),
|
||||
@@ -186,7 +187,7 @@ CONFIG_SCHEMA = cv.Schema(
|
||||
"m³",
|
||||
ICON_EMPTY,
|
||||
3,
|
||||
DEVICE_CLASS_EMPTY,
|
||||
DEVICE_CLASS_GAS,
|
||||
STATE_CLASS_MEASUREMENT,
|
||||
LAST_RESET_TYPE_NEVER,
|
||||
),
|
||||
|
||||
@@ -19,6 +19,8 @@ class HBridgeLightOutput : public PollingComponent, public light::LightOutput {
|
||||
light::LightTraits get_traits() override {
|
||||
auto traits = light::LightTraits();
|
||||
traits.set_supported_color_modes({light::ColorMode::COLD_WARM_WHITE});
|
||||
traits.set_min_mireds(153);
|
||||
traits.set_max_mireds(500);
|
||||
return traits;
|
||||
}
|
||||
|
||||
|
||||
@@ -46,9 +46,14 @@ void AddressableLight::write_state(LightState *state) {
|
||||
|
||||
// don't use LightState helper, gamma correction+brightness is handled by ESPColorView
|
||||
this->all() = esp_color_from_light_color_values(val);
|
||||
this->schedule_show();
|
||||
}
|
||||
|
||||
void AddressableLightTransformer::start() {
|
||||
// don't try to transition over running effects.
|
||||
if (this->light_.is_effect_active())
|
||||
return;
|
||||
|
||||
auto end_values = this->target_values_;
|
||||
this->target_color_ = esp_color_from_light_color_values(end_values);
|
||||
|
||||
|
||||
@@ -39,6 +39,13 @@ void LightState::setup() {
|
||||
effect->init_internal(this);
|
||||
}
|
||||
|
||||
// When supported color temperature range is known, initialize color temperature setting within bounds.
|
||||
float min_mireds = this->get_traits().get_min_mireds();
|
||||
if (min_mireds > 0) {
|
||||
this->remote_values.set_color_temperature(min_mireds);
|
||||
this->current_values.set_color_temperature(min_mireds);
|
||||
}
|
||||
|
||||
auto call = this->make_call();
|
||||
LightStateRTCState recovered{};
|
||||
switch (this->restore_mode_) {
|
||||
|
||||
@@ -60,6 +60,8 @@ void MQTTClimateComponent::send_discovery(JsonObject &root, mqtt::SendDiscoveryC
|
||||
root["max_temp"] = traits.get_visual_max_temperature();
|
||||
// temp_step
|
||||
root["temp_step"] = traits.get_visual_temperature_step();
|
||||
// temperature units are always coerced to Celsius internally
|
||||
root["temp_unit"] = "C";
|
||||
|
||||
if (traits.supports_preset(CLIMATE_PRESET_AWAY)) {
|
||||
// away_mode_command_topic
|
||||
|
||||
@@ -54,12 +54,6 @@ void MQTTJSONLightComponent::send_discovery(JsonObject &root, mqtt::SendDiscover
|
||||
// legacy API
|
||||
if (traits.supports_color_capability(ColorCapability::BRIGHTNESS))
|
||||
root["brightness"] = true;
|
||||
if (traits.supports_color_capability(ColorCapability::RGB))
|
||||
root["rgb"] = true;
|
||||
if (traits.supports_color_capability(ColorCapability::COLOR_TEMPERATURE))
|
||||
root["color_temp"] = true;
|
||||
if (traits.supports_color_capability(ColorCapability::WHITE))
|
||||
root["white_value"] = true;
|
||||
|
||||
if (this->state_->supports_effects()) {
|
||||
root["effect"] = true;
|
||||
|
||||
@@ -61,6 +61,9 @@ void MQTTSensorComponent::send_discovery(JsonObject &root, mqtt::SendDiscoveryCo
|
||||
if (this->sensor_->get_force_update())
|
||||
root["force_update"] = true;
|
||||
|
||||
if (this->sensor_->state_class == sensor::STATE_CLASS_MEASUREMENT)
|
||||
root["state_class"] = "measurement";
|
||||
|
||||
config.command_topic = false;
|
||||
}
|
||||
bool MQTTSensorComponent::send_initial_state() {
|
||||
|
||||
@@ -543,6 +543,7 @@ void Nextion::process_nextion_commands_() {
|
||||
ESP_LOGVV(TAG, "Received Nextion leaves sleep automatically");
|
||||
this->is_sleeping_ = false;
|
||||
this->wake_callback_.call();
|
||||
this->all_components_send_state_(false);
|
||||
break;
|
||||
}
|
||||
case 0x88: // system successful start up
|
||||
|
||||
@@ -40,6 +40,7 @@ from esphome.const import (
|
||||
DEVICE_CLASS_CARBON_DIOXIDE,
|
||||
DEVICE_CLASS_CURRENT,
|
||||
DEVICE_CLASS_ENERGY,
|
||||
DEVICE_CLASS_GAS,
|
||||
DEVICE_CLASS_HUMIDITY,
|
||||
DEVICE_CLASS_ILLUMINANCE,
|
||||
DEVICE_CLASS_MONETARY,
|
||||
@@ -62,6 +63,7 @@ DEVICE_CLASSES = [
|
||||
DEVICE_CLASS_CARBON_DIOXIDE,
|
||||
DEVICE_CLASS_CURRENT,
|
||||
DEVICE_CLASS_ENERGY,
|
||||
DEVICE_CLASS_GAS,
|
||||
DEVICE_CLASS_HUMIDITY,
|
||||
DEVICE_CLASS_ILLUMINANCE,
|
||||
DEVICE_CLASS_MONETARY,
|
||||
@@ -79,6 +81,7 @@ StateClasses = sensor_ns.enum("StateClass")
|
||||
STATE_CLASSES = {
|
||||
"": StateClasses.STATE_CLASS_NONE,
|
||||
"measurement": StateClasses.STATE_CLASS_MEASUREMENT,
|
||||
"total_increasing": StateClasses.STATE_CLASS_TOTAL_INCREASING,
|
||||
}
|
||||
validate_state_class = cv.enum(STATE_CLASSES, lower=True, space="_")
|
||||
|
||||
|
||||
@@ -10,6 +10,8 @@ const char *state_class_to_string(StateClass state_class) {
|
||||
switch (state_class) {
|
||||
case STATE_CLASS_MEASUREMENT:
|
||||
return "measurement";
|
||||
case STATE_CLASS_TOTAL_INCREASING:
|
||||
return "total_increasing";
|
||||
case STATE_CLASS_NONE:
|
||||
default:
|
||||
return "";
|
||||
@@ -72,6 +74,8 @@ void Sensor::set_state_class(StateClass state_class) { this->state_class = state
|
||||
void Sensor::set_state_class(const std::string &state_class) {
|
||||
if (str_equals_case_insensitive(state_class, "measurement")) {
|
||||
this->state_class = STATE_CLASS_MEASUREMENT;
|
||||
} else if (str_equals_case_insensitive(state_class, "total_increasing")) {
|
||||
this->state_class = STATE_CLASS_TOTAL_INCREASING;
|
||||
} else {
|
||||
ESP_LOGW(TAG, "'%s' - Unrecognized state class %s", this->get_name().c_str(), state_class.c_str());
|
||||
}
|
||||
|
||||
@@ -37,6 +37,7 @@ namespace sensor {
|
||||
enum StateClass : uint8_t {
|
||||
STATE_CLASS_NONE = 0,
|
||||
STATE_CLASS_MEASUREMENT = 1,
|
||||
STATE_CLASS_TOTAL_INCREASING = 2,
|
||||
};
|
||||
|
||||
const char *state_class_to_string(StateClass state_class);
|
||||
|
||||
@@ -55,7 +55,7 @@ async def to_code(config):
|
||||
|
||||
if CONF_LAMBDA in config:
|
||||
template_ = await cg.process_lambda(
|
||||
config[CONF_LAMBDA], [], return_type=cg.optional.template(str)
|
||||
config[CONF_LAMBDA], [], return_type=cg.optional.template(cg.std_string)
|
||||
)
|
||||
cg.add(var.set_template(template_))
|
||||
|
||||
|
||||
@@ -57,29 +57,34 @@ void ThermostatClimate::refresh() {
|
||||
}
|
||||
|
||||
bool ThermostatClimate::climate_action_change_delayed() {
|
||||
bool state_mismatch = this->action != this->compute_action_(true);
|
||||
|
||||
switch (this->compute_action_(true)) {
|
||||
case climate::CLIMATE_ACTION_OFF:
|
||||
case climate::CLIMATE_ACTION_IDLE:
|
||||
return !this->idle_action_ready_();
|
||||
return state_mismatch && (!this->idle_action_ready_());
|
||||
case climate::CLIMATE_ACTION_COOLING:
|
||||
return !this->cooling_action_ready_();
|
||||
return state_mismatch && (!this->cooling_action_ready_());
|
||||
case climate::CLIMATE_ACTION_HEATING:
|
||||
return !this->heating_action_ready_();
|
||||
return state_mismatch && (!this->heating_action_ready_());
|
||||
case climate::CLIMATE_ACTION_FAN:
|
||||
return !this->fanning_action_ready_();
|
||||
return state_mismatch && (!this->fanning_action_ready_());
|
||||
case climate::CLIMATE_ACTION_DRYING:
|
||||
return !this->drying_action_ready_();
|
||||
return state_mismatch && (!this->drying_action_ready_());
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool ThermostatClimate::fan_mode_change_delayed() { return !this->fan_mode_ready_(); }
|
||||
bool ThermostatClimate::fan_mode_change_delayed() {
|
||||
bool state_mismatch = this->fan_mode.value_or(climate::CLIMATE_FAN_ON) != this->prev_fan_mode_;
|
||||
return state_mismatch && (!this->fan_mode_ready_());
|
||||
}
|
||||
|
||||
climate::ClimateAction ThermostatClimate::delayed_climate_action() { return this->compute_action_(true); }
|
||||
|
||||
climate::ClimateFanMode ThermostatClimate::delayed_fan_mode() { return this->desired_fan_mode_; }
|
||||
climate::ClimateFanMode ThermostatClimate::locked_fan_mode() { return this->prev_fan_mode_; }
|
||||
|
||||
bool ThermostatClimate::hysteresis_valid() {
|
||||
if ((this->supports_cool_ || (this->supports_fan_only_ && this->supports_fan_only_cooling_)) &&
|
||||
@@ -510,7 +515,7 @@ void ThermostatClimate::switch_to_fan_mode_(climate::ClimateFanMode fan_mode) {
|
||||
// already in target mode
|
||||
return;
|
||||
|
||||
this->desired_fan_mode_ = fan_mode; // needed for timer callback
|
||||
this->fan_mode = fan_mode;
|
||||
|
||||
if (this->fan_mode_ready_()) {
|
||||
Trigger<> *trig = this->fan_mode_auto_trigger_;
|
||||
@@ -564,7 +569,6 @@ void ThermostatClimate::switch_to_fan_mode_(climate::ClimateFanMode fan_mode) {
|
||||
this->start_timer_(thermostat::TIMER_FAN_MODE);
|
||||
assert(trig != nullptr);
|
||||
trig->trigger();
|
||||
this->fan_mode = fan_mode;
|
||||
this->prev_fan_mode_ = fan_mode;
|
||||
this->prev_fan_mode_trigger_ = trig;
|
||||
}
|
||||
@@ -733,7 +737,7 @@ void ThermostatClimate::cooling_on_timer_callback_() {
|
||||
void ThermostatClimate::fan_mode_timer_callback_() {
|
||||
ESP_LOGVV(TAG, "fan_mode timer expired");
|
||||
this->timer_[thermostat::TIMER_FAN_MODE].active = false;
|
||||
this->switch_to_fan_mode_(this->desired_fan_mode_);
|
||||
this->switch_to_fan_mode_(this->fan_mode.value_or(climate::CLIMATE_FAN_ON));
|
||||
if (this->supports_fan_only_action_uses_fan_mode_timer_)
|
||||
this->switch_to_action_(this->compute_action_());
|
||||
}
|
||||
|
||||
@@ -136,8 +136,8 @@ class ThermostatClimate : public climate::Climate, public Component {
|
||||
bool fan_mode_change_delayed();
|
||||
/// Returns the climate action that is being delayed (check climate_action_change_delayed(), first!)
|
||||
climate::ClimateAction delayed_climate_action();
|
||||
/// Returns the fan mode that is being delayed (check fan_mode_change_delayed(), first!)
|
||||
climate::ClimateFanMode delayed_fan_mode();
|
||||
/// Returns the fan mode that is locked in (check fan_mode_change_delayed(), first!)
|
||||
climate::ClimateFanMode locked_fan_mode();
|
||||
/// Set point and hysteresis validation
|
||||
bool hysteresis_valid(); // returns true if valid
|
||||
void validate_target_temperature();
|
||||
@@ -377,9 +377,6 @@ class ThermostatClimate : public climate::Climate, public Component {
|
||||
Trigger<> *prev_mode_trigger_{nullptr};
|
||||
Trigger<> *prev_swing_mode_trigger_{nullptr};
|
||||
|
||||
/// Desired fan_mode -- used to store desired mode for callback when switching is delayed
|
||||
climate::ClimateFanMode desired_fan_mode_{climate::CLIMATE_FAN_ON};
|
||||
|
||||
/// Store previously-known states
|
||||
///
|
||||
/// These are used to determine when a trigger/action needs to be called
|
||||
|
||||
@@ -20,7 +20,6 @@ TotalDailyEnergy = total_daily_energy_ns.class_(
|
||||
|
||||
CONFIG_SCHEMA = (
|
||||
sensor.sensor_schema(
|
||||
accuracy_decimals=0,
|
||||
device_class=DEVICE_CLASS_ENERGY,
|
||||
state_class=STATE_CLASS_MEASUREMENT,
|
||||
last_reset_type=LAST_RESET_TYPE_AUTO,
|
||||
|
||||
@@ -80,7 +80,7 @@ void TuyaFan::write_state() {
|
||||
}
|
||||
if (this->speed_id_.has_value()) {
|
||||
ESP_LOGV(TAG, "Setting speed: %d", this->fan_->speed);
|
||||
this->parent_->set_integer_datapoint_value(*this->speed_id_, this->fan_->speed - 1);
|
||||
this->parent_->set_enum_datapoint_value(*this->speed_id_, this->fan_->speed - 1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
"""Constants used by esphome."""
|
||||
|
||||
__version__ = "1.21.0b1"
|
||||
__version__ = "2021.8.2"
|
||||
|
||||
ESP_PLATFORM_ESP32 = "ESP32"
|
||||
ESP_PLATFORM_ESP8266 = "ESP8266"
|
||||
@@ -840,6 +840,9 @@ STATE_CLASS_NONE = ""
|
||||
# The state represents a measurement in present time
|
||||
STATE_CLASS_MEASUREMENT = "measurement"
|
||||
|
||||
# The state represents a total that only increases, a decrease is considered a reset.
|
||||
STATE_CLASS_TOTAL_INCREASING = "total_increasing"
|
||||
|
||||
# This sensor does not support resetting. ie, it is not accumulative
|
||||
LAST_RESET_TYPE_NONE = ""
|
||||
# This sensor is expected to never reset its value
|
||||
|
||||
2
setup.py
2
setup.py
@@ -21,7 +21,7 @@ PYPI_URL = "https://pypi.python.org/pypi/{}".format(PROJECT_PACKAGE_NAME)
|
||||
GITHUB_PATH = "{}/{}".format(PROJECT_GITHUB_USERNAME, PROJECT_GITHUB_REPOSITORY)
|
||||
GITHUB_URL = "https://github.com/{}".format(GITHUB_PATH)
|
||||
|
||||
DOWNLOAD_URL = "{}/archive/v{}.zip".format(GITHUB_URL, const.__version__)
|
||||
DOWNLOAD_URL = "{}/archive/{}.zip".format(GITHUB_URL, const.__version__)
|
||||
|
||||
here = os.path.abspath(os.path.dirname(__file__))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user