Merge pull request #5047 from esphome/bump-2023.6.4

2023.6.4
This commit is contained in:
Jesse Hills 2023-07-04 14:42:36 +12:00 committed by GitHub
commit 0709367587
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 631 additions and 604 deletions

View File

@ -57,6 +57,10 @@ void MDNSComponent::compile_records_() {
service.txt_records.push_back({"network", "ethernet"});
#endif
#ifdef USE_API_NOISE
service.txt_records.push_back({"api_encryption", "Noise_NNpsk0_25519_ChaChaPoly_SHA256"});
#endif
#ifdef ESPHOME_PROJECT_NAME
service.txt_records.push_back({"project_name", ESPHOME_PROJECT_NAME});
service.txt_records.push_back({"project_version", ESPHOME_PROJECT_VERSION});

View File

@ -42,13 +42,18 @@ void SCD30Component::setup() {
ESP_LOGD(TAG, "SCD30 Firmware v%0d.%02d", (uint16_t(raw_firmware_version[0]) >> 8),
uint16_t(raw_firmware_version[0] & 0xFF));
if (this->temperature_offset_ != 0) {
if (!this->write_command(SCD30_CMD_TEMPERATURE_OFFSET, (uint16_t) (temperature_offset_ * 100.0))) {
ESP_LOGE(TAG, "Sensor SCD30 error setting temperature offset.");
this->error_code_ = MEASUREMENT_INIT_FAILED;
this->mark_failed();
return;
}
uint16_t temp_offset;
if (this->temperature_offset_ > 0) {
temp_offset = (this->temperature_offset_ * 100);
} else {
temp_offset = 0;
}
if (!this->write_command(SCD30_CMD_TEMPERATURE_OFFSET, temp_offset)) {
ESP_LOGE(TAG, "Sensor SCD30 error setting temperature offset.");
this->error_code_ = MEASUREMENT_INIT_FAILED;
this->mark_failed();
return;
}
#ifdef USE_ESP32
// According ESP32 clock stretching is typically 30ms and up to 150ms "due to

View File

@ -68,7 +68,10 @@ CONFIG_SCHEMA = (
cv.int_range(min=0, max=0xFFFF, max_included=False),
),
cv.Optional(CONF_AMBIENT_PRESSURE_COMPENSATION, default=0): cv.pressure,
cv.Optional(CONF_TEMPERATURE_OFFSET): cv.temperature,
cv.Optional(CONF_TEMPERATURE_OFFSET): cv.All(
cv.temperature,
cv.float_range(min=0, max=655.35),
),
cv.Optional(CONF_UPDATE_INTERVAL, default="60s"): cv.All(
cv.positive_time_period_seconds,
cv.Range(

View File

@ -6,11 +6,21 @@ namespace template_ {
static const char *const TAG = "template.binary_sensor";
void TemplateBinarySensor::loop() {
if (!this->f_.has_value())
void TemplateBinarySensor::setup() {
if (!this->publish_initial_state_)
return;
auto s = (*this->f_)();
if (this->f_ != nullptr) {
this->publish_initial_state(*this->f_());
} else {
this->publish_initial_state(false);
}
}
void TemplateBinarySensor::loop() {
if (this->f_ == nullptr)
return;
auto s = this->f_();
if (s.has_value()) {
this->publish_state(*s);
}

View File

@ -10,13 +10,14 @@ class TemplateBinarySensor : public Component, public binary_sensor::BinarySenso
public:
void set_template(std::function<optional<bool>()> &&f) { this->f_ = f; }
void setup() override;
void loop() override;
void dump_config() override;
float get_setup_priority() const override { return setup_priority::HARDWARE; }
protected:
optional<std::function<optional<bool>()>> f_{};
std::function<optional<bool>()> f_{nullptr};
};
} // namespace template_

File diff suppressed because it is too large Load Diff

View File

@ -108,6 +108,7 @@ ROOT_CONFIG_PATH = object()
RESERVED_IDS = [
# C++ keywords http://en.cppreference.com/w/cpp/keyword
"alarm",
"alignas",
"alignof",
"and",

View File

@ -1,6 +1,6 @@
"""Constants used by esphome."""
__version__ = "2023.6.3"
__version__ = "2023.6.4"
ALLOWED_NAME_CHARS = "abcdefghijklmnopqrstuvwxyz0123456789-_"
VALID_SUBSTITUTIONS_CHARACTERS = (