mirror of
https://github.com/esphome/esphome.git
synced 2025-03-24 03:28:20 +00:00
Merge branch 'esphome:dev' into mcp4461
This commit is contained in:
commit
36f8d21cfc
@ -45,6 +45,6 @@ repos:
|
|||||||
hooks:
|
hooks:
|
||||||
- id: pylint
|
- id: pylint
|
||||||
name: pylint
|
name: pylint
|
||||||
entry: python script/run-in-env pylint
|
entry: python3 script/run-in-env.py pylint
|
||||||
language: system
|
language: system
|
||||||
types: [python]
|
types: [python]
|
||||||
|
@ -242,6 +242,7 @@ esphome/components/lightwaverf/* @max246
|
|||||||
esphome/components/lilygo_t5_47/touchscreen/* @jesserockz
|
esphome/components/lilygo_t5_47/touchscreen/* @jesserockz
|
||||||
esphome/components/lock/* @esphome/core
|
esphome/components/lock/* @esphome/core
|
||||||
esphome/components/logger/* @esphome/core
|
esphome/components/logger/* @esphome/core
|
||||||
|
esphome/components/logger/select/* @clydebarrow
|
||||||
esphome/components/ltr390/* @latonita @sjtrny
|
esphome/components/ltr390/* @latonita @sjtrny
|
||||||
esphome/components/ltr501/* @latonita
|
esphome/components/ltr501/* @latonita
|
||||||
esphome/components/ltr_als_ps/* @latonita
|
esphome/components/ltr_als_ps/* @latonita
|
||||||
|
@ -1,12 +1,14 @@
|
|||||||
# Contributing to ESPHome
|
# Contributing to ESPHome [](https://discord.gg/KhAMKrd) [](https://GitHub.com/esphome/esphome/releases/)
|
||||||
|
|
||||||
For a detailed guide, please see https://esphome.io/guides/contributing.html#contributing-to-esphome
|
We welcome contributions to the ESPHome suite of code and documentation!
|
||||||
|
|
||||||
Things to note when contributing:
|
Please read our [contributing guide](https://esphome.io/guides/contributing.html) if you wish to contribute to the
|
||||||
|
project and be sure to join us on [Discord](https://discord.gg/KhAMKrd).
|
||||||
|
|
||||||
- Please test your changes :)
|
**See also:**
|
||||||
- If a new feature is added or an existing user-facing feature is changed, you should also
|
|
||||||
update the [docs](https://github.com/esphome/esphome-docs). See [contributing to esphome-docs](https://esphome.io/guides/contributing.html#contributing-to-esphomedocs)
|
[Documentation](https://esphome.io) -- [Issues](https://github.com/esphome/issues/issues) -- [Feature requests](https://github.com/esphome/feature-requests/issues)
|
||||||
for more information.
|
|
||||||
- Please also update the tests in the `tests/` folder. You can do so by just adding a line in one of the YAML files
|
---
|
||||||
which checks if your new feature compiles correctly.
|
|
||||||
|
[](https://www.openhomefoundation.org/)
|
||||||
|
@ -7,10 +7,10 @@
|
|||||||
</picture>
|
</picture>
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
**Documentation:** https://esphome.io/
|
---
|
||||||
|
|
||||||
For issues, please go to [the issue tracker](https://github.com/esphome/issues/issues).
|
[Documentation](https://esphome.io) -- [Issues](https://github.com/esphome/issues/issues) -- [Feature requests](https://github.com/esphome/feature-requests/issues)
|
||||||
|
|
||||||
For feature requests, please see [feature requests](https://github.com/esphome/feature-requests/issues).
|
---
|
||||||
|
|
||||||
[](https://www.openhomefoundation.org/)
|
[](https://www.openhomefoundation.org/)
|
||||||
|
@ -36,6 +36,14 @@ ATTENUATION_MODES = {
|
|||||||
"auto": "auto",
|
"auto": "auto",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sampling_mode = adc_ns.enum("SamplingMode", is_class=True)
|
||||||
|
|
||||||
|
SAMPLING_MODES = {
|
||||||
|
"avg": sampling_mode.AVG,
|
||||||
|
"min": sampling_mode.MIN,
|
||||||
|
"max": sampling_mode.MAX,
|
||||||
|
}
|
||||||
|
|
||||||
adc1_channel_t = cg.global_ns.enum("adc1_channel_t")
|
adc1_channel_t = cg.global_ns.enum("adc1_channel_t")
|
||||||
adc2_channel_t = cg.global_ns.enum("adc2_channel_t")
|
adc2_channel_t = cg.global_ns.enum("adc2_channel_t")
|
||||||
|
|
||||||
|
@ -28,6 +28,21 @@ static const adc_atten_t ADC_ATTEN_DB_12_COMPAT = ADC_ATTEN_DB_11;
|
|||||||
#endif
|
#endif
|
||||||
#endif // USE_ESP32
|
#endif // USE_ESP32
|
||||||
|
|
||||||
|
enum class SamplingMode : uint8_t { AVG = 0, MIN = 1, MAX = 2 };
|
||||||
|
const LogString *sampling_mode_to_str(SamplingMode mode);
|
||||||
|
|
||||||
|
class Aggregator {
|
||||||
|
public:
|
||||||
|
void add_sample(uint32_t value);
|
||||||
|
uint32_t aggregate();
|
||||||
|
Aggregator(SamplingMode mode);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
SamplingMode mode_{SamplingMode::AVG};
|
||||||
|
uint32_t aggr_{0};
|
||||||
|
uint32_t samples_{0};
|
||||||
|
};
|
||||||
|
|
||||||
class ADCSensor : public sensor::Sensor, public PollingComponent, public voltage_sampler::VoltageSampler {
|
class ADCSensor : public sensor::Sensor, public PollingComponent, public voltage_sampler::VoltageSampler {
|
||||||
public:
|
public:
|
||||||
#ifdef USE_ESP32
|
#ifdef USE_ESP32
|
||||||
@ -54,6 +69,7 @@ class ADCSensor : public sensor::Sensor, public PollingComponent, public voltage
|
|||||||
void set_pin(InternalGPIOPin *pin) { this->pin_ = pin; }
|
void set_pin(InternalGPIOPin *pin) { this->pin_ = pin; }
|
||||||
void set_output_raw(bool output_raw) { this->output_raw_ = output_raw; }
|
void set_output_raw(bool output_raw) { this->output_raw_ = output_raw; }
|
||||||
void set_sample_count(uint8_t sample_count);
|
void set_sample_count(uint8_t sample_count);
|
||||||
|
void set_sampling_mode(SamplingMode sampling_mode);
|
||||||
float sample() override;
|
float sample() override;
|
||||||
|
|
||||||
#ifdef USE_ESP8266
|
#ifdef USE_ESP8266
|
||||||
@ -68,6 +84,7 @@ class ADCSensor : public sensor::Sensor, public PollingComponent, public voltage
|
|||||||
InternalGPIOPin *pin_;
|
InternalGPIOPin *pin_;
|
||||||
bool output_raw_{false};
|
bool output_raw_{false};
|
||||||
uint8_t sample_count_{1};
|
uint8_t sample_count_{1};
|
||||||
|
SamplingMode sampling_mode_{SamplingMode::AVG};
|
||||||
|
|
||||||
#ifdef USE_RP2040
|
#ifdef USE_RP2040
|
||||||
bool is_temperature_{false};
|
bool is_temperature_{false};
|
||||||
|
@ -6,6 +6,59 @@ namespace adc {
|
|||||||
|
|
||||||
static const char *const TAG = "adc.common";
|
static const char *const TAG = "adc.common";
|
||||||
|
|
||||||
|
const LogString *sampling_mode_to_str(SamplingMode mode) {
|
||||||
|
switch (mode) {
|
||||||
|
case SamplingMode::AVG:
|
||||||
|
return LOG_STR("average");
|
||||||
|
case SamplingMode::MIN:
|
||||||
|
return LOG_STR("minimum");
|
||||||
|
case SamplingMode::MAX:
|
||||||
|
return LOG_STR("maximum");
|
||||||
|
}
|
||||||
|
return LOG_STR("unknown");
|
||||||
|
}
|
||||||
|
|
||||||
|
Aggregator::Aggregator(SamplingMode mode) {
|
||||||
|
this->mode_ = mode;
|
||||||
|
// set to max uint if mode is "min"
|
||||||
|
if (mode == SamplingMode::MIN) {
|
||||||
|
this->aggr_ = UINT32_MAX;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Aggregator::add_sample(uint32_t value) {
|
||||||
|
this->samples_ += 1;
|
||||||
|
|
||||||
|
switch (this->mode_) {
|
||||||
|
case SamplingMode::AVG:
|
||||||
|
this->aggr_ += value;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case SamplingMode::MIN:
|
||||||
|
if (value < this->aggr_) {
|
||||||
|
this->aggr_ = value;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case SamplingMode::MAX:
|
||||||
|
if (value > this->aggr_) {
|
||||||
|
this->aggr_ = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
uint32_t Aggregator::aggregate() {
|
||||||
|
if (this->mode_ == SamplingMode::AVG) {
|
||||||
|
if (this->samples_ == 0) {
|
||||||
|
return this->aggr_;
|
||||||
|
}
|
||||||
|
|
||||||
|
return (this->aggr_ + (this->samples_ >> 1)) / this->samples_; // NOLINT(clang-analyzer-core.DivideZero)
|
||||||
|
}
|
||||||
|
|
||||||
|
return this->aggr_;
|
||||||
|
}
|
||||||
|
|
||||||
void ADCSensor::update() {
|
void ADCSensor::update() {
|
||||||
float value_v = this->sample();
|
float value_v = this->sample();
|
||||||
ESP_LOGV(TAG, "'%s': Got voltage=%.4fV", this->get_name().c_str(), value_v);
|
ESP_LOGV(TAG, "'%s': Got voltage=%.4fV", this->get_name().c_str(), value_v);
|
||||||
@ -18,6 +71,8 @@ void ADCSensor::set_sample_count(uint8_t sample_count) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ADCSensor::set_sampling_mode(SamplingMode sampling_mode) { this->sampling_mode_ = sampling_mode; }
|
||||||
|
|
||||||
float ADCSensor::get_setup_priority() const { return setup_priority::DATA; }
|
float ADCSensor::get_setup_priority() const { return setup_priority::DATA; }
|
||||||
|
|
||||||
} // namespace adc
|
} // namespace adc
|
||||||
|
@ -78,12 +78,14 @@ void ADCSensor::dump_config() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
ESP_LOGCONFIG(TAG, " Samples: %i", this->sample_count_);
|
ESP_LOGCONFIG(TAG, " Samples: %i", this->sample_count_);
|
||||||
|
ESP_LOGCONFIG(TAG, " Sampling mode: %s", LOG_STR_ARG(sampling_mode_to_str(this->sampling_mode_)));
|
||||||
LOG_UPDATE_INTERVAL(this);
|
LOG_UPDATE_INTERVAL(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
float ADCSensor::sample() {
|
float ADCSensor::sample() {
|
||||||
if (!this->autorange_) {
|
if (!this->autorange_) {
|
||||||
uint32_t sum = 0;
|
auto aggr = Aggregator(this->sampling_mode_);
|
||||||
|
|
||||||
for (uint8_t sample = 0; sample < this->sample_count_; sample++) {
|
for (uint8_t sample = 0; sample < this->sample_count_; sample++) {
|
||||||
int raw = -1;
|
int raw = -1;
|
||||||
if (this->channel1_ != ADC1_CHANNEL_MAX) {
|
if (this->channel1_ != ADC1_CHANNEL_MAX) {
|
||||||
@ -94,13 +96,14 @@ float ADCSensor::sample() {
|
|||||||
if (raw == -1) {
|
if (raw == -1) {
|
||||||
return NAN;
|
return NAN;
|
||||||
}
|
}
|
||||||
sum += raw;
|
|
||||||
|
aggr.add_sample(raw);
|
||||||
}
|
}
|
||||||
sum = (sum + (this->sample_count_ >> 1)) / this->sample_count_; // NOLINT(clang-analyzer-core.DivideZero)
|
|
||||||
if (this->output_raw_) {
|
if (this->output_raw_) {
|
||||||
return sum;
|
return aggr.aggregate();
|
||||||
}
|
}
|
||||||
uint32_t mv = esp_adc_cal_raw_to_voltage(sum, &this->cal_characteristics_[(int32_t) this->attenuation_]);
|
uint32_t mv =
|
||||||
|
esp_adc_cal_raw_to_voltage(aggr.aggregate(), &this->cal_characteristics_[(int32_t) this->attenuation_]);
|
||||||
return mv / 1000.0f;
|
return mv / 1000.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -31,23 +31,27 @@ void ADCSensor::dump_config() {
|
|||||||
LOG_PIN(" Pin: ", this->pin_);
|
LOG_PIN(" Pin: ", this->pin_);
|
||||||
#endif // USE_ADC_SENSOR_VCC
|
#endif // USE_ADC_SENSOR_VCC
|
||||||
ESP_LOGCONFIG(TAG, " Samples: %i", this->sample_count_);
|
ESP_LOGCONFIG(TAG, " Samples: %i", this->sample_count_);
|
||||||
|
ESP_LOGCONFIG(TAG, " Sampling mode: %s", LOG_STR_ARG(sampling_mode_to_str(this->sampling_mode_)));
|
||||||
LOG_UPDATE_INTERVAL(this);
|
LOG_UPDATE_INTERVAL(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
float ADCSensor::sample() {
|
float ADCSensor::sample() {
|
||||||
uint32_t raw = 0;
|
auto aggr = Aggregator(this->sampling_mode_);
|
||||||
|
|
||||||
for (uint8_t sample = 0; sample < this->sample_count_; sample++) {
|
for (uint8_t sample = 0; sample < this->sample_count_; sample++) {
|
||||||
|
uint32_t raw = 0;
|
||||||
#ifdef USE_ADC_SENSOR_VCC
|
#ifdef USE_ADC_SENSOR_VCC
|
||||||
raw += ESP.getVcc(); // NOLINT(readability-static-accessed-through-instance)
|
raw = ESP.getVcc(); // NOLINT(readability-static-accessed-through-instance)
|
||||||
#else
|
#else
|
||||||
raw += analogRead(this->pin_->get_pin()); // NOLINT
|
raw = analogRead(this->pin_->get_pin()); // NOLINT
|
||||||
#endif // USE_ADC_SENSOR_VCC
|
#endif // USE_ADC_SENSOR_VCC
|
||||||
|
aggr.add_sample(raw);
|
||||||
}
|
}
|
||||||
raw = (raw + (this->sample_count_ >> 1)) / this->sample_count_; // NOLINT(clang-analyzer-core.DivideZero)
|
|
||||||
if (this->output_raw_) {
|
if (this->output_raw_) {
|
||||||
return raw;
|
return aggr.aggregate();
|
||||||
}
|
}
|
||||||
return raw / 1024.0f;
|
return aggr.aggregate() / 1024.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string ADCSensor::unique_id() { return get_mac_address() + "-adc"; }
|
std::string ADCSensor::unique_id() { return get_mac_address() + "-adc"; }
|
||||||
|
@ -23,23 +23,28 @@ void ADCSensor::dump_config() {
|
|||||||
LOG_PIN(" Pin: ", this->pin_);
|
LOG_PIN(" Pin: ", this->pin_);
|
||||||
#endif // USE_ADC_SENSOR_VCC
|
#endif // USE_ADC_SENSOR_VCC
|
||||||
ESP_LOGCONFIG(TAG, " Samples: %i", this->sample_count_);
|
ESP_LOGCONFIG(TAG, " Samples: %i", this->sample_count_);
|
||||||
|
ESP_LOGCONFIG(TAG, " Sampling mode: %s", LOG_STR_ARG(sampling_mode_to_str(this->sampling_mode_)));
|
||||||
LOG_UPDATE_INTERVAL(this);
|
LOG_UPDATE_INTERVAL(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
float ADCSensor::sample() {
|
float ADCSensor::sample() {
|
||||||
uint32_t raw = 0;
|
uint32_t raw = 0;
|
||||||
|
auto aggr = Aggregator(this->sampling_mode_);
|
||||||
|
|
||||||
if (this->output_raw_) {
|
if (this->output_raw_) {
|
||||||
for (uint8_t sample = 0; sample < this->sample_count_; sample++) {
|
for (uint8_t sample = 0; sample < this->sample_count_; sample++) {
|
||||||
raw += analogRead(this->pin_->get_pin()); // NOLINT
|
raw = analogRead(this->pin_->get_pin()); // NOLINT
|
||||||
|
aggr.add_sample(raw);
|
||||||
}
|
}
|
||||||
raw = (raw + (this->sample_count_ >> 1)) / this->sample_count_; // NOLINT(clang-analyzer-core.DivideZero)
|
return aggr.aggregate();
|
||||||
return raw;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for (uint8_t sample = 0; sample < this->sample_count_; sample++) {
|
for (uint8_t sample = 0; sample < this->sample_count_; sample++) {
|
||||||
raw += analogReadVoltage(this->pin_->get_pin()); // NOLINT
|
raw = analogReadVoltage(this->pin_->get_pin()); // NOLINT
|
||||||
|
aggr.add_sample(raw);
|
||||||
}
|
}
|
||||||
raw = (raw + (this->sample_count_ >> 1)) / this->sample_count_; // NOLINT(clang-analyzer-core.DivideZero)
|
|
||||||
return raw / 1000.0f;
|
return aggr.aggregate() / 1000.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace adc
|
} // namespace adc
|
||||||
|
@ -34,24 +34,28 @@ void ADCSensor::dump_config() {
|
|||||||
#endif // USE_ADC_SENSOR_VCC
|
#endif // USE_ADC_SENSOR_VCC
|
||||||
}
|
}
|
||||||
ESP_LOGCONFIG(TAG, " Samples: %i", this->sample_count_);
|
ESP_LOGCONFIG(TAG, " Samples: %i", this->sample_count_);
|
||||||
|
ESP_LOGCONFIG(TAG, " Sampling mode: %s", LOG_STR_ARG(sampling_mode_to_str(this->sampling_mode_)));
|
||||||
LOG_UPDATE_INTERVAL(this);
|
LOG_UPDATE_INTERVAL(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
float ADCSensor::sample() {
|
float ADCSensor::sample() {
|
||||||
|
uint32_t raw = 0;
|
||||||
|
auto aggr = Aggregator(this->sampling_mode_);
|
||||||
|
|
||||||
if (this->is_temperature_) {
|
if (this->is_temperature_) {
|
||||||
adc_set_temp_sensor_enabled(true);
|
adc_set_temp_sensor_enabled(true);
|
||||||
delay(1);
|
delay(1);
|
||||||
adc_select_input(4);
|
adc_select_input(4);
|
||||||
uint32_t raw = 0;
|
|
||||||
for (uint8_t sample = 0; sample < this->sample_count_; sample++) {
|
for (uint8_t sample = 0; sample < this->sample_count_; sample++) {
|
||||||
raw += adc_read();
|
raw = adc_read();
|
||||||
|
aggr.add_sample(raw);
|
||||||
}
|
}
|
||||||
raw = (raw + (this->sample_count_ >> 1)) / this->sample_count_; // NOLINT(clang-analyzer-core.DivideZero)
|
|
||||||
adc_set_temp_sensor_enabled(false);
|
adc_set_temp_sensor_enabled(false);
|
||||||
if (this->output_raw_) {
|
if (this->output_raw_) {
|
||||||
return raw;
|
return aggr.aggregate();
|
||||||
}
|
}
|
||||||
return raw * 3.3f / 4096.0f;
|
return aggr.aggregate() * 3.3f / 4096.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t pin = this->pin_->get_pin();
|
uint8_t pin = this->pin_->get_pin();
|
||||||
@ -68,11 +72,10 @@ float ADCSensor::sample() {
|
|||||||
adc_gpio_init(pin);
|
adc_gpio_init(pin);
|
||||||
adc_select_input(pin - 26);
|
adc_select_input(pin - 26);
|
||||||
|
|
||||||
uint32_t raw = 0;
|
|
||||||
for (uint8_t sample = 0; sample < this->sample_count_; sample++) {
|
for (uint8_t sample = 0; sample < this->sample_count_; sample++) {
|
||||||
raw += adc_read();
|
raw = adc_read();
|
||||||
|
aggr.add_sample(raw);
|
||||||
}
|
}
|
||||||
raw = (raw + (this->sample_count_ >> 1)) / this->sample_count_; // NOLINT(clang-analyzer-core.DivideZero)
|
|
||||||
|
|
||||||
#ifdef CYW43_USES_VSYS_PIN
|
#ifdef CYW43_USES_VSYS_PIN
|
||||||
if (pin == PICO_VSYS_PIN) {
|
if (pin == PICO_VSYS_PIN) {
|
||||||
@ -81,10 +84,10 @@ float ADCSensor::sample() {
|
|||||||
#endif // CYW43_USES_VSYS_PIN
|
#endif // CYW43_USES_VSYS_PIN
|
||||||
|
|
||||||
if (this->output_raw_) {
|
if (this->output_raw_) {
|
||||||
return raw;
|
return aggr.aggregate();
|
||||||
}
|
}
|
||||||
float coeff = pin == PICO_VSYS_PIN ? 3.0f : 1.0f;
|
float coeff = pin == PICO_VSYS_PIN ? 3.0f : 1.0f;
|
||||||
return raw * 3.3f / 4096.0f * coeff;
|
return aggr.aggregate() * 3.3f / 4096.0f * coeff;
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace adc
|
} // namespace adc
|
||||||
|
@ -1,11 +1,9 @@
|
|||||||
import logging
|
import logging
|
||||||
|
|
||||||
import esphome.codegen as cg
|
import esphome.codegen as cg
|
||||||
import esphome.config_validation as cv
|
|
||||||
import esphome.final_validate as fv
|
|
||||||
from esphome.core import CORE
|
|
||||||
from esphome.components import sensor, voltage_sampler
|
from esphome.components import sensor, voltage_sampler
|
||||||
from esphome.components.esp32 import get_esp32_variant
|
from esphome.components.esp32 import get_esp32_variant
|
||||||
|
import esphome.config_validation as cv
|
||||||
from esphome.const import (
|
from esphome.const import (
|
||||||
CONF_ATTENUATION,
|
CONF_ATTENUATION,
|
||||||
CONF_ID,
|
CONF_ID,
|
||||||
@ -17,10 +15,14 @@ from esphome.const import (
|
|||||||
STATE_CLASS_MEASUREMENT,
|
STATE_CLASS_MEASUREMENT,
|
||||||
UNIT_VOLT,
|
UNIT_VOLT,
|
||||||
)
|
)
|
||||||
|
from esphome.core import CORE
|
||||||
|
import esphome.final_validate as fv
|
||||||
|
|
||||||
from . import (
|
from . import (
|
||||||
ATTENUATION_MODES,
|
ATTENUATION_MODES,
|
||||||
ESP32_VARIANT_ADC1_PIN_TO_CHANNEL,
|
ESP32_VARIANT_ADC1_PIN_TO_CHANNEL,
|
||||||
ESP32_VARIANT_ADC2_PIN_TO_CHANNEL,
|
ESP32_VARIANT_ADC2_PIN_TO_CHANNEL,
|
||||||
|
SAMPLING_MODES,
|
||||||
adc_ns,
|
adc_ns,
|
||||||
validate_adc_pin,
|
validate_adc_pin,
|
||||||
)
|
)
|
||||||
@ -30,9 +32,11 @@ _LOGGER = logging.getLogger(__name__)
|
|||||||
AUTO_LOAD = ["voltage_sampler"]
|
AUTO_LOAD = ["voltage_sampler"]
|
||||||
|
|
||||||
CONF_SAMPLES = "samples"
|
CONF_SAMPLES = "samples"
|
||||||
|
CONF_SAMPLING_MODE = "sampling_mode"
|
||||||
|
|
||||||
|
|
||||||
_attenuation = cv.enum(ATTENUATION_MODES, lower=True)
|
_attenuation = cv.enum(ATTENUATION_MODES, lower=True)
|
||||||
|
_sampling_mode = cv.enum(SAMPLING_MODES, lower=True)
|
||||||
|
|
||||||
|
|
||||||
def validate_config(config):
|
def validate_config(config):
|
||||||
@ -88,6 +92,7 @@ CONFIG_SCHEMA = cv.All(
|
|||||||
cv.only_on_esp32, _attenuation
|
cv.only_on_esp32, _attenuation
|
||||||
),
|
),
|
||||||
cv.Optional(CONF_SAMPLES, default=1): cv.int_range(min=1, max=255),
|
cv.Optional(CONF_SAMPLES, default=1): cv.int_range(min=1, max=255),
|
||||||
|
cv.Optional(CONF_SAMPLING_MODE, default="avg"): _sampling_mode,
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
.extend(cv.polling_component_schema("60s")),
|
.extend(cv.polling_component_schema("60s")),
|
||||||
@ -112,6 +117,7 @@ async def to_code(config):
|
|||||||
|
|
||||||
cg.add(var.set_output_raw(config[CONF_RAW]))
|
cg.add(var.set_output_raw(config[CONF_RAW]))
|
||||||
cg.add(var.set_sample_count(config[CONF_SAMPLES]))
|
cg.add(var.set_sample_count(config[CONF_SAMPLES]))
|
||||||
|
cg.add(var.set_sampling_mode(config[CONF_SAMPLING_MODE]))
|
||||||
|
|
||||||
if attenuation := config.get(CONF_ATTENUATION):
|
if attenuation := config.get(CONF_ATTENUATION):
|
||||||
if attenuation == "auto":
|
if attenuation == "auto":
|
||||||
|
@ -35,7 +35,7 @@ from esphome.const import (
|
|||||||
PLATFORM_RP2040,
|
PLATFORM_RP2040,
|
||||||
PLATFORM_RTL87XX,
|
PLATFORM_RTL87XX,
|
||||||
)
|
)
|
||||||
from esphome.core import CORE, EsphomeError, Lambda, coroutine_with_priority
|
from esphome.core import CORE, Lambda, coroutine_with_priority
|
||||||
|
|
||||||
CODEOWNERS = ["@esphome/core"]
|
CODEOWNERS = ["@esphome/core"]
|
||||||
logger_ns = cg.esphome_ns.namespace("logger")
|
logger_ns = cg.esphome_ns.namespace("logger")
|
||||||
@ -77,6 +77,9 @@ USB_SERIAL_JTAG = "USB_SERIAL_JTAG"
|
|||||||
USB_CDC = "USB_CDC"
|
USB_CDC = "USB_CDC"
|
||||||
DEFAULT = "DEFAULT"
|
DEFAULT = "DEFAULT"
|
||||||
|
|
||||||
|
CONF_INITIAL_LEVEL = "initial_level"
|
||||||
|
CONF_LOGGER_ID = "logger_id"
|
||||||
|
|
||||||
UART_SELECTION_ESP32 = {
|
UART_SELECTION_ESP32 = {
|
||||||
VARIANT_ESP32: [UART0, UART1, UART2],
|
VARIANT_ESP32: [UART0, UART1, UART2],
|
||||||
VARIANT_ESP32S2: [UART0, UART1, USB_CDC],
|
VARIANT_ESP32S2: [UART0, UART1, USB_CDC],
|
||||||
@ -154,11 +157,11 @@ def uart_selection(value):
|
|||||||
|
|
||||||
|
|
||||||
def validate_local_no_higher_than_global(value):
|
def validate_local_no_higher_than_global(value):
|
||||||
global_level = value.get(CONF_LEVEL, "DEBUG")
|
global_level = LOG_LEVEL_SEVERITY.index(value[CONF_LEVEL])
|
||||||
for tag, level in value.get(CONF_LOGS, {}).items():
|
for tag, level in value.get(CONF_LOGS, {}).items():
|
||||||
if LOG_LEVEL_SEVERITY.index(level) > LOG_LEVEL_SEVERITY.index(global_level):
|
if LOG_LEVEL_SEVERITY.index(level) > global_level:
|
||||||
raise EsphomeError(
|
raise cv.Invalid(
|
||||||
f"The local log level {level} for {tag} must be less severe than the global log level {global_level}."
|
f"The configured log level for {tag} ({level}) must be no more severe than the global log level {value[CONF_LEVEL]}."
|
||||||
)
|
)
|
||||||
return value
|
return value
|
||||||
|
|
||||||
@ -209,6 +212,7 @@ CONFIG_SCHEMA = cv.All(
|
|||||||
cv.string: is_log_level,
|
cv.string: is_log_level,
|
||||||
}
|
}
|
||||||
),
|
),
|
||||||
|
cv.Optional(CONF_INITIAL_LEVEL): is_log_level,
|
||||||
cv.Optional(CONF_ON_MESSAGE): automation.validate_automation(
|
cv.Optional(CONF_ON_MESSAGE): automation.validate_automation(
|
||||||
{
|
{
|
||||||
cv.GenerateID(CONF_TRIGGER_ID): cv.declare_id(LoggerMessageTrigger),
|
cv.GenerateID(CONF_TRIGGER_ID): cv.declare_id(LoggerMessageTrigger),
|
||||||
@ -227,7 +231,14 @@ CONFIG_SCHEMA = cv.All(
|
|||||||
@coroutine_with_priority(90.0)
|
@coroutine_with_priority(90.0)
|
||||||
async def to_code(config):
|
async def to_code(config):
|
||||||
baud_rate = config[CONF_BAUD_RATE]
|
baud_rate = config[CONF_BAUD_RATE]
|
||||||
log = cg.new_Pvariable(config[CONF_ID], baud_rate, config[CONF_TX_BUFFER_SIZE])
|
level = config[CONF_LEVEL]
|
||||||
|
initial_level = LOG_LEVELS[config.get(CONF_INITIAL_LEVEL, level)]
|
||||||
|
log = cg.new_Pvariable(
|
||||||
|
config[CONF_ID],
|
||||||
|
baud_rate,
|
||||||
|
config[CONF_TX_BUFFER_SIZE],
|
||||||
|
)
|
||||||
|
cg.add(log.set_log_level(initial_level))
|
||||||
if CONF_HARDWARE_UART in config:
|
if CONF_HARDWARE_UART in config:
|
||||||
cg.add(
|
cg.add(
|
||||||
log.set_uart_selection(
|
log.set_uart_selection(
|
||||||
@ -239,7 +250,6 @@ async def to_code(config):
|
|||||||
for tag, level in config[CONF_LOGS].items():
|
for tag, level in config[CONF_LOGS].items():
|
||||||
cg.add(log.set_log_level(tag, LOG_LEVELS[level]))
|
cg.add(log.set_log_level(tag, LOG_LEVELS[level]))
|
||||||
|
|
||||||
level = config[CONF_LEVEL]
|
|
||||||
cg.add_define("USE_LOGGER")
|
cg.add_define("USE_LOGGER")
|
||||||
this_severity = LOG_LEVEL_SEVERITY.index(level)
|
this_severity = LOG_LEVEL_SEVERITY.index(level)
|
||||||
cg.add_build_flag(f"-DESPHOME_LOG_LEVEL={LOG_LEVELS[level]}")
|
cg.add_build_flag(f"-DESPHOME_LOG_LEVEL={LOG_LEVELS[level]}")
|
||||||
@ -367,3 +377,27 @@ async def logger_log_action_to_code(config, action_id, template_arg, args):
|
|||||||
|
|
||||||
lambda_ = await cg.process_lambda(Lambda(text), args, return_type=cg.void)
|
lambda_ = await cg.process_lambda(Lambda(text), args, return_type=cg.void)
|
||||||
return cg.new_Pvariable(action_id, template_arg, lambda_)
|
return cg.new_Pvariable(action_id, template_arg, lambda_)
|
||||||
|
|
||||||
|
|
||||||
|
@automation.register_action(
|
||||||
|
"logger.set_level",
|
||||||
|
LambdaAction,
|
||||||
|
cv.maybe_simple_value(
|
||||||
|
{
|
||||||
|
cv.GenerateID(CONF_LOGGER_ID): cv.use_id(Logger),
|
||||||
|
cv.Required(CONF_LEVEL): is_log_level,
|
||||||
|
cv.Optional(CONF_TAG): cv.string,
|
||||||
|
},
|
||||||
|
key=CONF_LEVEL,
|
||||||
|
),
|
||||||
|
)
|
||||||
|
async def logger_set_level_to_code(config, action_id, template_arg, args):
|
||||||
|
level = LOG_LEVELS[config[CONF_LEVEL]]
|
||||||
|
logger = await cg.get_variable(config[CONF_LOGGER_ID])
|
||||||
|
if tag := config.get(CONF_TAG):
|
||||||
|
text = str(cg.statement(logger.set_log_level(tag, level)))
|
||||||
|
else:
|
||||||
|
text = str(cg.statement(logger.set_log_level(level)))
|
||||||
|
|
||||||
|
lambda_ = await cg.process_lambda(Lambda(text), args, return_type=cg.void)
|
||||||
|
return cg.new_Pvariable(action_id, template_arg, lambda_)
|
||||||
|
@ -105,12 +105,9 @@ int HOT Logger::level_for(const char *tag) {
|
|||||||
// Uses std::vector<> for low memory footprint, though the vector
|
// Uses std::vector<> for low memory footprint, though the vector
|
||||||
// could be sorted to minimize lookup times. This feature isn't used that
|
// could be sorted to minimize lookup times. This feature isn't used that
|
||||||
// much anyway so it doesn't matter too much.
|
// much anyway so it doesn't matter too much.
|
||||||
for (auto &it : this->log_levels_) {
|
if (this->log_levels_.count(tag) != 0)
|
||||||
if (it.tag == tag) {
|
return this->log_levels_[tag];
|
||||||
return it.level;
|
return this->current_level_;
|
||||||
}
|
|
||||||
}
|
|
||||||
return ESPHOME_LOG_LEVEL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void HOT Logger::log_message_(int level, const char *tag, int offset) {
|
void HOT Logger::log_message_(int level, const char *tag, int offset) {
|
||||||
@ -167,9 +164,7 @@ void Logger::loop() {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
void Logger::set_baud_rate(uint32_t baud_rate) { this->baud_rate_ = baud_rate; }
|
void Logger::set_baud_rate(uint32_t baud_rate) { this->baud_rate_ = baud_rate; }
|
||||||
void Logger::set_log_level(const std::string &tag, int log_level) {
|
void Logger::set_log_level(const std::string &tag, int log_level) { this->log_levels_[tag] = log_level; }
|
||||||
this->log_levels_.push_back(LogLevelOverride{tag, log_level});
|
|
||||||
}
|
|
||||||
|
|
||||||
#if defined(USE_ESP32) || defined(USE_ESP8266) || defined(USE_RP2040) || defined(USE_LIBRETINY)
|
#if defined(USE_ESP32) || defined(USE_ESP8266) || defined(USE_RP2040) || defined(USE_LIBRETINY)
|
||||||
UARTSelection Logger::get_uart() const { return this->uart_; }
|
UARTSelection Logger::get_uart() const { return this->uart_; }
|
||||||
@ -183,18 +178,28 @@ const char *const LOG_LEVELS[] = {"NONE", "ERROR", "WARN", "INFO", "CONFIG", "DE
|
|||||||
|
|
||||||
void Logger::dump_config() {
|
void Logger::dump_config() {
|
||||||
ESP_LOGCONFIG(TAG, "Logger:");
|
ESP_LOGCONFIG(TAG, "Logger:");
|
||||||
ESP_LOGCONFIG(TAG, " Level: %s", LOG_LEVELS[ESPHOME_LOG_LEVEL]);
|
ESP_LOGCONFIG(TAG, " Max Level: %s", LOG_LEVELS[ESPHOME_LOG_LEVEL]);
|
||||||
|
ESP_LOGCONFIG(TAG, " Initial Level: %s", LOG_LEVELS[this->current_level_]);
|
||||||
#ifndef USE_HOST
|
#ifndef USE_HOST
|
||||||
ESP_LOGCONFIG(TAG, " Log Baud Rate: %" PRIu32, this->baud_rate_);
|
ESP_LOGCONFIG(TAG, " Log Baud Rate: %" PRIu32, this->baud_rate_);
|
||||||
ESP_LOGCONFIG(TAG, " Hardware UART: %s", get_uart_selection_());
|
ESP_LOGCONFIG(TAG, " Hardware UART: %s", get_uart_selection_());
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
for (auto &it : this->log_levels_) {
|
for (auto &it : this->log_levels_) {
|
||||||
ESP_LOGCONFIG(TAG, " Level for '%s': %s", it.tag.c_str(), LOG_LEVELS[it.level]);
|
ESP_LOGCONFIG(TAG, " Level for '%s': %s", it.first.c_str(), LOG_LEVELS[it.second]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
void Logger::write_footer_() { this->write_to_buffer_(ESPHOME_LOG_RESET_COLOR, strlen(ESPHOME_LOG_RESET_COLOR)); }
|
void Logger::write_footer_() { this->write_to_buffer_(ESPHOME_LOG_RESET_COLOR, strlen(ESPHOME_LOG_RESET_COLOR)); }
|
||||||
|
|
||||||
|
void Logger::set_log_level(int level) {
|
||||||
|
if (level > ESPHOME_LOG_LEVEL) {
|
||||||
|
level = ESPHOME_LOG_LEVEL;
|
||||||
|
ESP_LOGW(TAG, "Cannot set log level higher than pre-compiled %s", LOG_LEVELS[ESPHOME_LOG_LEVEL]);
|
||||||
|
}
|
||||||
|
this->current_level_ = level;
|
||||||
|
this->level_callback_.call(level);
|
||||||
|
}
|
||||||
|
|
||||||
Logger *global_logger = nullptr; // NOLINT(cppcoreguidelines-avoid-non-const-global-variables)
|
Logger *global_logger = nullptr; // NOLINT(cppcoreguidelines-avoid-non-const-global-variables)
|
||||||
|
|
||||||
} // namespace logger
|
} // namespace logger
|
||||||
|
@ -1,11 +1,12 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <cstdarg>
|
#include <cstdarg>
|
||||||
#include <vector>
|
#include <map>
|
||||||
#include "esphome/core/automation.h"
|
#include "esphome/core/automation.h"
|
||||||
#include "esphome/core/component.h"
|
#include "esphome/core/component.h"
|
||||||
#include "esphome/core/defines.h"
|
#include "esphome/core/defines.h"
|
||||||
#include "esphome/core/helpers.h"
|
#include "esphome/core/helpers.h"
|
||||||
|
#include "esphome/core/log.h"
|
||||||
|
|
||||||
#ifdef USE_ARDUINO
|
#ifdef USE_ARDUINO
|
||||||
#if defined(USE_ESP8266) || defined(USE_ESP32)
|
#if defined(USE_ESP8266) || defined(USE_ESP32)
|
||||||
@ -74,8 +75,11 @@ class Logger : public Component {
|
|||||||
UARTSelection get_uart() const;
|
UARTSelection get_uart() const;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/// Set the default log level for this logger.
|
||||||
|
void set_log_level(int level);
|
||||||
/// Set the log level of the specified tag.
|
/// Set the log level of the specified tag.
|
||||||
void set_log_level(const std::string &tag, int log_level);
|
void set_log_level(const std::string &tag, int log_level);
|
||||||
|
int get_log_level() { return this->current_level_; }
|
||||||
|
|
||||||
// ========== INTERNAL METHODS ==========
|
// ========== INTERNAL METHODS ==========
|
||||||
// (In most use cases you won't need these)
|
// (In most use cases you won't need these)
|
||||||
@ -88,6 +92,9 @@ class Logger : public Component {
|
|||||||
/// Register a callback that will be called for every log message sent
|
/// Register a callback that will be called for every log message sent
|
||||||
void add_on_log_callback(std::function<void(int, const char *, const char *)> &&callback);
|
void add_on_log_callback(std::function<void(int, const char *, const char *)> &&callback);
|
||||||
|
|
||||||
|
// add a listener for log level changes
|
||||||
|
void add_listener(std::function<void(int)> &&callback) { this->level_callback_.add(std::move(callback)); }
|
||||||
|
|
||||||
float get_setup_priority() const override;
|
float get_setup_priority() const override;
|
||||||
|
|
||||||
void log_vprintf_(int level, const char *tag, int line, const char *format, va_list args); // NOLINT
|
void log_vprintf_(int level, const char *tag, int line, const char *format, va_list args); // NOLINT
|
||||||
@ -159,17 +166,14 @@ class Logger : public Component {
|
|||||||
#ifdef USE_ESP_IDF
|
#ifdef USE_ESP_IDF
|
||||||
uart_port_t uart_num_;
|
uart_port_t uart_num_;
|
||||||
#endif
|
#endif
|
||||||
struct LogLevelOverride {
|
std::map<std::string, int> log_levels_{};
|
||||||
std::string tag;
|
|
||||||
int level;
|
|
||||||
};
|
|
||||||
std::vector<LogLevelOverride> log_levels_;
|
|
||||||
CallbackManager<void(int, const char *, const char *)> log_callback_{};
|
CallbackManager<void(int, const char *, const char *)> log_callback_{};
|
||||||
|
int current_level_{ESPHOME_LOG_LEVEL_VERY_VERBOSE};
|
||||||
/// Prevents recursive log calls, if true a log message is already being processed.
|
/// Prevents recursive log calls, if true a log message is already being processed.
|
||||||
bool recursion_guard_ = false;
|
bool recursion_guard_ = false;
|
||||||
void *main_task_ = nullptr;
|
void *main_task_ = nullptr;
|
||||||
|
CallbackManager<void(int)> level_callback_{};
|
||||||
};
|
};
|
||||||
|
|
||||||
extern Logger *global_logger; // NOLINT(cppcoreguidelines-avoid-non-const-global-variables)
|
extern Logger *global_logger; // NOLINT(cppcoreguidelines-avoid-non-const-global-variables)
|
||||||
|
|
||||||
class LoggerMessageTrigger : public Trigger<int, const char *, const char *> {
|
class LoggerMessageTrigger : public Trigger<int, const char *, const char *> {
|
||||||
|
29
esphome/components/logger/select/__init__.py
Normal file
29
esphome/components/logger/select/__init__.py
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
import esphome.codegen as cg
|
||||||
|
from esphome.components import select
|
||||||
|
import esphome.config_validation as cv
|
||||||
|
from esphome.const import CONF_LEVEL, CONF_LOGGER, ENTITY_CATEGORY_CONFIG, ICON_BUG
|
||||||
|
from esphome.core import CORE
|
||||||
|
from esphome.cpp_helpers import register_component, register_parented
|
||||||
|
|
||||||
|
from .. import CONF_LOGGER_ID, LOG_LEVEL_SEVERITY, Logger, logger_ns
|
||||||
|
|
||||||
|
CODEOWNERS = ["@clydebarrow"]
|
||||||
|
|
||||||
|
LoggerLevelSelect = logger_ns.class_("LoggerLevelSelect", select.Select, cg.Component)
|
||||||
|
|
||||||
|
CONFIG_SCHEMA = select.select_schema(
|
||||||
|
LoggerLevelSelect, icon=ICON_BUG, entity_category=ENTITY_CATEGORY_CONFIG
|
||||||
|
).extend(
|
||||||
|
{
|
||||||
|
cv.GenerateID(CONF_LOGGER_ID): cv.use_id(Logger),
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
async def to_code(config):
|
||||||
|
levels = LOG_LEVEL_SEVERITY
|
||||||
|
index = levels.index(CORE.config[CONF_LOGGER][CONF_LEVEL])
|
||||||
|
levels = levels[: index + 1]
|
||||||
|
var = await select.new_select(config, options=levels)
|
||||||
|
await register_parented(var, config[CONF_LOGGER_ID])
|
||||||
|
await register_component(var, config)
|
27
esphome/components/logger/select/logger_level_select.cpp
Normal file
27
esphome/components/logger/select/logger_level_select.cpp
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
#include "logger_level_select.h"
|
||||||
|
|
||||||
|
namespace esphome {
|
||||||
|
namespace logger {
|
||||||
|
|
||||||
|
void LoggerLevelSelect::publish_state(int level) {
|
||||||
|
auto value = this->at(level);
|
||||||
|
if (!value) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Select::publish_state(value.value());
|
||||||
|
}
|
||||||
|
|
||||||
|
void LoggerLevelSelect::setup() {
|
||||||
|
this->parent_->add_listener([this](int level) { this->publish_state(level); });
|
||||||
|
this->publish_state(this->parent_->get_log_level());
|
||||||
|
}
|
||||||
|
|
||||||
|
void LoggerLevelSelect::control(const std::string &value) {
|
||||||
|
auto level = this->index_of(value);
|
||||||
|
if (!level)
|
||||||
|
return;
|
||||||
|
this->parent_->set_log_level(level.value());
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace logger
|
||||||
|
} // namespace esphome
|
15
esphome/components/logger/select/logger_level_select.h
Normal file
15
esphome/components/logger/select/logger_level_select.h
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "esphome/components/select/select.h"
|
||||||
|
#include "esphome/core/component.h"
|
||||||
|
#include "esphome/components/logger/logger.h"
|
||||||
|
namespace esphome {
|
||||||
|
namespace logger {
|
||||||
|
class LoggerLevelSelect : public Component, public select::Select, public Parented<Logger> {
|
||||||
|
public:
|
||||||
|
void publish_state(int level);
|
||||||
|
void setup() override;
|
||||||
|
void control(const std::string &value) override;
|
||||||
|
};
|
||||||
|
} // namespace logger
|
||||||
|
} // namespace esphome
|
@ -66,7 +66,7 @@ class JPEGFormat(Format):
|
|||||||
|
|
||||||
def actions(self):
|
def actions(self):
|
||||||
cg.add_define("USE_ONLINE_IMAGE_JPEG_SUPPORT")
|
cg.add_define("USE_ONLINE_IMAGE_JPEG_SUPPORT")
|
||||||
cg.add_library("JPEGDEC", "1.6.2", "https://github.com/bitbank2/JPEGDEC")
|
cg.add_library("JPEGDEC", None, "https://github.com/bitbank2/JPEGDEC#ca1e0f2")
|
||||||
|
|
||||||
|
|
||||||
class PNGFormat(Format):
|
class PNGFormat(Format):
|
||||||
|
@ -100,7 +100,35 @@ void OnlineImage::update() {
|
|||||||
}
|
}
|
||||||
ESP_LOGI(TAG, "Updating image %s", this->url_.c_str());
|
ESP_LOGI(TAG, "Updating image %s", this->url_.c_str());
|
||||||
|
|
||||||
this->downloader_ = this->parent_->get(this->url_);
|
std::list<http_request::Header> headers = {};
|
||||||
|
|
||||||
|
http_request::Header accept_header;
|
||||||
|
accept_header.name = "Accept";
|
||||||
|
std::string accept_mime_type;
|
||||||
|
switch (this->format_) {
|
||||||
|
#ifdef USE_ONLINE_IMAGE_BMP_SUPPORT
|
||||||
|
case ImageFormat::BMP:
|
||||||
|
accept_mime_type = "image/bmp";
|
||||||
|
break;
|
||||||
|
#endif // ONLINE_IMAGE_BMP_SUPPORT
|
||||||
|
#ifdef USE_ONLINE_IMAGE_JPEG_SUPPORT
|
||||||
|
case ImageFormat::JPEG:
|
||||||
|
accept_mime_type = "image/jpeg";
|
||||||
|
break;
|
||||||
|
#endif // USE_ONLINE_IMAGE_JPEG_SUPPORT
|
||||||
|
#ifdef USE_ONLINE_IMAGE_PNG_SUPPORT
|
||||||
|
case ImageFormat::PNG:
|
||||||
|
accept_mime_type = "image/png";
|
||||||
|
break;
|
||||||
|
#endif // ONLINE_IMAGE_PNG_SUPPORT
|
||||||
|
default:
|
||||||
|
accept_mime_type = "image/*";
|
||||||
|
}
|
||||||
|
accept_header.value = (accept_mime_type + ",*/*;q=0.8").c_str();
|
||||||
|
|
||||||
|
headers.push_back(accept_header);
|
||||||
|
|
||||||
|
this->downloader_ = this->parent_->get(this->url_, headers);
|
||||||
|
|
||||||
if (this->downloader_ == nullptr) {
|
if (this->downloader_ == nullptr) {
|
||||||
ESP_LOGE(TAG, "Download failed.");
|
ESP_LOGE(TAG, "Download failed.");
|
||||||
|
@ -120,7 +120,7 @@ MODELS = {
|
|||||||
"2.13in-ttgo-b74": ("a", WaveshareEPaperTypeAModel.TTGO_EPAPER_2_13_IN_B74),
|
"2.13in-ttgo-b74": ("a", WaveshareEPaperTypeAModel.TTGO_EPAPER_2_13_IN_B74),
|
||||||
"2.90in": ("a", WaveshareEPaperTypeAModel.WAVESHARE_EPAPER_2_9_IN),
|
"2.90in": ("a", WaveshareEPaperTypeAModel.WAVESHARE_EPAPER_2_9_IN),
|
||||||
"2.90inv2": ("a", WaveshareEPaperTypeAModel.WAVESHARE_EPAPER_2_9_IN_V2),
|
"2.90inv2": ("a", WaveshareEPaperTypeAModel.WAVESHARE_EPAPER_2_9_IN_V2),
|
||||||
"gdew029t5": ("c", GDEW029T5),
|
"gdew029t5": ("b", GDEW029T5),
|
||||||
"2.70in": ("b", WaveshareEPaper2P7In),
|
"2.70in": ("b", WaveshareEPaper2P7In),
|
||||||
"2.70in-b": ("b", WaveshareEPaper2P7InB),
|
"2.70in-b": ("b", WaveshareEPaper2P7InB),
|
||||||
"2.70in-bv2": ("b", WaveshareEPaper2P7InBV2),
|
"2.70in-bv2": ("b", WaveshareEPaper2P7InBV2),
|
||||||
@ -143,7 +143,7 @@ MODELS = {
|
|||||||
"7.50in-hd-b": ("b", WaveshareEPaper7P5InHDB),
|
"7.50in-hd-b": ("b", WaveshareEPaper7P5InHDB),
|
||||||
"2.13in-ttgo-dke": ("c", WaveshareEPaper2P13InDKE),
|
"2.13in-ttgo-dke": ("c", WaveshareEPaper2P13InDKE),
|
||||||
"2.13inv3": ("c", WaveshareEPaper2P13InV3),
|
"2.13inv3": ("c", WaveshareEPaper2P13InV3),
|
||||||
"1.54in-m5coreink-m09": ("c", GDEW0154M09),
|
"1.54in-m5coreink-m09": ("b", GDEW0154M09),
|
||||||
"13.3in-k": ("b", WaveshareEPaper13P3InK),
|
"13.3in-k": ("b", WaveshareEPaper13P3InK),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -66,7 +66,7 @@ void WiFiComponent::start() {
|
|||||||
|
|
||||||
this->pref_ = global_preferences->make_preference<wifi::SavedWifiSettings>(hash, true);
|
this->pref_ = global_preferences->make_preference<wifi::SavedWifiSettings>(hash, true);
|
||||||
if (this->fast_connect_) {
|
if (this->fast_connect_) {
|
||||||
this->fast_connect_pref_ = global_preferences->make_preference<wifi::SavedWifiFastConnectSettings>(hash, false);
|
this->fast_connect_pref_ = global_preferences->make_preference<wifi::SavedWifiFastConnectSettings>(hash + 1, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
SavedWifiSettings save{};
|
SavedWifiSettings save{};
|
||||||
|
@ -14,6 +14,9 @@
|
|||||||
#define ESPHOME_PROJECT_VERSION_30 "v2"
|
#define ESPHOME_PROJECT_VERSION_30 "v2"
|
||||||
#define ESPHOME_VARIANT "ESP32"
|
#define ESPHOME_VARIANT "ESP32"
|
||||||
|
|
||||||
|
// logger
|
||||||
|
#define ESPHOME_LOG_LEVEL ESPHOME_LOG_LEVEL_VERY_VERBOSE
|
||||||
|
|
||||||
// Feature flags
|
// Feature flags
|
||||||
#define USE_ALARM_CONTROL_PANEL
|
#define USE_ALARM_CONTROL_PANEL
|
||||||
#define USE_AUDIO_FLAC_SUPPORT
|
#define USE_AUDIO_FLAC_SUPPORT
|
||||||
|
@ -249,6 +249,9 @@ def perform_ota(
|
|||||||
send_check(sock, result, "auth result")
|
send_check(sock, result, "auth result")
|
||||||
receive_exactly(sock, 1, "auth result", RESPONSE_AUTH_OK)
|
receive_exactly(sock, 1, "auth result", RESPONSE_AUTH_OK)
|
||||||
|
|
||||||
|
# Set higher timeout during upload
|
||||||
|
sock.settimeout(30.0)
|
||||||
|
|
||||||
upload_size = len(upload_contents)
|
upload_size = len(upload_contents)
|
||||||
upload_size_encoded = [
|
upload_size_encoded = [
|
||||||
(upload_size >> 24) & 0xFF,
|
(upload_size >> 24) & 0xFF,
|
||||||
@ -271,8 +274,6 @@ def perform_ota(
|
|||||||
# show the actual progress
|
# show the actual progress
|
||||||
|
|
||||||
sock.setsockopt(socket.SOL_SOCKET, socket.SO_SNDBUF, UPLOAD_BUFFER_SIZE)
|
sock.setsockopt(socket.SOL_SOCKET, socket.SO_SNDBUF, UPLOAD_BUFFER_SIZE)
|
||||||
# Set higher timeout during upload
|
|
||||||
sock.settimeout(30.0)
|
|
||||||
start_time = time.perf_counter()
|
start_time = time.perf_counter()
|
||||||
|
|
||||||
offset = 0
|
offset = 0
|
||||||
|
@ -42,7 +42,7 @@ lib_deps =
|
|||||||
pavlodn/HaierProtocol@0.9.31 ; haier
|
pavlodn/HaierProtocol@0.9.31 ; haier
|
||||||
kikuchan98/pngle@1.0.2 ; online_image
|
kikuchan98/pngle@1.0.2 ; online_image
|
||||||
; Using the repository directly, otherwise ESP-IDF can't use the library
|
; Using the repository directly, otherwise ESP-IDF can't use the library
|
||||||
https://github.com/bitbank2/JPEGDEC.git#1.6.2 ; online_image
|
https://github.com/bitbank2/JPEGDEC.git#ca1e0f2 ; online_image
|
||||||
; This is using the repository until a new release is published to PlatformIO
|
; This is using the repository until a new release is published to PlatformIO
|
||||||
https://github.com/Sensirion/arduino-gas-index-algorithm.git#3.2.1 ; Sensirion Gas Index Algorithm Arduino Library
|
https://github.com/Sensirion/arduino-gas-index-algorithm.git#3.2.1 ; Sensirion Gas Index Algorithm Arduino Library
|
||||||
lvgl/lvgl@8.4.0 ; lvgl
|
lvgl/lvgl@8.4.0 ; lvgl
|
||||||
|
@ -7,6 +7,13 @@ import sys
|
|||||||
|
|
||||||
|
|
||||||
def find_and_activate_virtualenv():
|
def find_and_activate_virtualenv():
|
||||||
|
if (
|
||||||
|
("VIRTUAL_ENV" in os.environ)
|
||||||
|
or os.environ.get("DEVCONTAINER", False)
|
||||||
|
or os.environ.get("ESPHOME_NO_VENV", False)
|
||||||
|
):
|
||||||
|
return
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# Get the top-level directory of the git repository
|
# Get the top-level directory of the git repository
|
||||||
my_path = subprocess.check_output(
|
my_path = subprocess.check_output(
|
||||||
@ -17,7 +24,7 @@ def find_and_activate_virtualenv():
|
|||||||
"Error: Not a git repository or unable to determine the top-level directory.",
|
"Error: Not a git repository or unable to determine the top-level directory.",
|
||||||
file=sys.stderr,
|
file=sys.stderr,
|
||||||
)
|
)
|
||||||
sys.exit(1)
|
return
|
||||||
|
|
||||||
# Check for virtual environments
|
# Check for virtual environments
|
||||||
for venv in ["venv", ".venv", "."]:
|
for venv in ["venv", ".venv", "."]:
|
||||||
@ -29,25 +36,26 @@ def find_and_activate_virtualenv():
|
|||||||
)
|
)
|
||||||
if activate_path.exists():
|
if activate_path.exists():
|
||||||
# Activate the virtual environment by updating PATH
|
# Activate the virtual environment by updating PATH
|
||||||
env = os.environ.copy()
|
|
||||||
venv_bin_dir = activate_path.parent
|
venv_bin_dir = activate_path.parent
|
||||||
env["PATH"] = f"{venv_bin_dir}{os.pathsep}{env['PATH']}"
|
os.environ["PATH"] = f"{venv_bin_dir}{os.pathsep}{os.environ['PATH']}"
|
||||||
env["VIRTUAL_ENV"] = str(venv_bin_dir.parent)
|
os.environ["VIRTUAL_ENV"] = str(venv_bin_dir.parent)
|
||||||
print(f"Activated virtual environment: {venv_bin_dir.parent}")
|
print(f"Activated virtual environment: {venv_bin_dir.parent}")
|
||||||
|
|
||||||
# Execute the remaining arguments in the new environment
|
|
||||||
if len(sys.argv) > 1:
|
|
||||||
subprocess.run(sys.argv[1:], env=env, check=False)
|
|
||||||
else:
|
|
||||||
print(
|
|
||||||
"No command provided to run in the virtual environment.",
|
|
||||||
file=sys.stderr,
|
|
||||||
)
|
|
||||||
return
|
return
|
||||||
|
|
||||||
print("No virtual environment found.", file=sys.stderr)
|
print("No virtual environment found.", file=sys.stderr)
|
||||||
sys.exit(1)
|
|
||||||
|
|
||||||
|
def run_command():
|
||||||
|
# Execute the remaining arguments in the new environment
|
||||||
|
if len(sys.argv) > 1:
|
||||||
|
subprocess.run(sys.argv[1:], check=False)
|
||||||
|
else:
|
||||||
|
print(
|
||||||
|
"No command provided to run in the virtual environment.",
|
||||||
|
file=sys.stderr,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
find_and_activate_virtualenv()
|
find_and_activate_virtualenv()
|
||||||
|
run_command()
|
@ -10,5 +10,6 @@ sensor:
|
|||||||
pin: A0
|
pin: A0
|
||||||
id: s_1
|
id: s_1
|
||||||
name: test s1
|
name: test s1
|
||||||
|
sampling_mode: min
|
||||||
update_interval: 60s
|
update_interval: 60s
|
||||||
device_class: voltage
|
device_class: voltage
|
||||||
|
@ -1,7 +1,17 @@
|
|||||||
esphome:
|
esphome:
|
||||||
on_boot:
|
on_boot:
|
||||||
then:
|
then:
|
||||||
- logger.log: Hello world
|
- logger.log:
|
||||||
|
level: warn
|
||||||
|
format: "Warning: Logger level is %d"
|
||||||
|
args: [id(logger_id).get_log_level()]
|
||||||
|
- logger.set_level: WARN
|
||||||
|
|
||||||
logger:
|
logger:
|
||||||
|
id: logger_id
|
||||||
level: DEBUG
|
level: DEBUG
|
||||||
|
initial_level: INFO
|
||||||
|
|
||||||
|
select:
|
||||||
|
- platform: logger
|
||||||
|
name: Logger Level
|
||||||
|
20
tests/components/scd30/common.yaml
Normal file
20
tests/components/scd30/common.yaml
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
i2c:
|
||||||
|
- id: i2c_scd30
|
||||||
|
scl: ${scl_pin}
|
||||||
|
sda: ${sda_pin}
|
||||||
|
|
||||||
|
sensor:
|
||||||
|
- platform: scd30
|
||||||
|
co2:
|
||||||
|
name: SCD30 CO2
|
||||||
|
temperature:
|
||||||
|
id: scd30_temperature
|
||||||
|
name: SCD30 Temperature
|
||||||
|
humidity:
|
||||||
|
name: SCD30 Humidity
|
||||||
|
address: 0x61
|
||||||
|
automatic_self_calibration: true
|
||||||
|
altitude_compensation: 10m
|
||||||
|
ambient_pressure_compensation: 961mBar
|
||||||
|
temperature_offset: 4.2C
|
||||||
|
update_interval: 15s
|
@ -1,20 +1,5 @@
|
|||||||
i2c:
|
substitutions:
|
||||||
- id: i2c_scd30
|
scl_pin: GPIO16
|
||||||
scl: 16
|
sda_pin: GPIO17
|
||||||
sda: 17
|
|
||||||
|
|
||||||
sensor:
|
<<: !include common.yaml
|
||||||
- platform: scd30
|
|
||||||
co2:
|
|
||||||
name: SCD30 CO2
|
|
||||||
temperature:
|
|
||||||
id: scd30_temperature
|
|
||||||
name: SCD30 Temperature
|
|
||||||
humidity:
|
|
||||||
name: SCD30 Humidity
|
|
||||||
address: 0x61
|
|
||||||
automatic_self_calibration: true
|
|
||||||
altitude_compensation: 10m
|
|
||||||
ambient_pressure_compensation: 961mBar
|
|
||||||
temperature_offset: 4.2C
|
|
||||||
update_interval: 15s
|
|
||||||
|
@ -1,20 +1,5 @@
|
|||||||
i2c:
|
substitutions:
|
||||||
- id: i2c_scd30
|
scl_pin: GPIO5
|
||||||
scl: 5
|
sda_pin: GPIO4
|
||||||
sda: 4
|
|
||||||
|
|
||||||
sensor:
|
<<: !include common.yaml
|
||||||
- platform: scd30
|
|
||||||
co2:
|
|
||||||
name: SCD30 CO2
|
|
||||||
temperature:
|
|
||||||
id: scd30_temperature
|
|
||||||
name: SCD30 Temperature
|
|
||||||
humidity:
|
|
||||||
name: SCD30 Humidity
|
|
||||||
address: 0x61
|
|
||||||
automatic_self_calibration: true
|
|
||||||
altitude_compensation: 10m
|
|
||||||
ambient_pressure_compensation: 961mBar
|
|
||||||
temperature_offset: 4.2C
|
|
||||||
update_interval: 15s
|
|
||||||
|
@ -1,20 +1,5 @@
|
|||||||
i2c:
|
substitutions:
|
||||||
- id: i2c_scd30
|
scl_pin: GPIO5
|
||||||
scl: 5
|
sda_pin: GPIO4
|
||||||
sda: 4
|
|
||||||
|
|
||||||
sensor:
|
<<: !include common.yaml
|
||||||
- platform: scd30
|
|
||||||
co2:
|
|
||||||
name: SCD30 CO2
|
|
||||||
temperature:
|
|
||||||
id: scd30_temperature
|
|
||||||
name: SCD30 Temperature
|
|
||||||
humidity:
|
|
||||||
name: SCD30 Humidity
|
|
||||||
address: 0x61
|
|
||||||
automatic_self_calibration: true
|
|
||||||
altitude_compensation: 10m
|
|
||||||
ambient_pressure_compensation: 961mBar
|
|
||||||
temperature_offset: 4.2C
|
|
||||||
update_interval: 15s
|
|
||||||
|
@ -1,20 +1,5 @@
|
|||||||
i2c:
|
substitutions:
|
||||||
- id: i2c_scd30
|
scl_pin: GPIO16
|
||||||
scl: 16
|
sda_pin: GPIO17
|
||||||
sda: 17
|
|
||||||
|
|
||||||
sensor:
|
<<: !include common.yaml
|
||||||
- platform: scd30
|
|
||||||
co2:
|
|
||||||
name: SCD30 CO2
|
|
||||||
temperature:
|
|
||||||
id: scd30_temperature
|
|
||||||
name: SCD30 Temperature
|
|
||||||
humidity:
|
|
||||||
name: SCD30 Humidity
|
|
||||||
address: 0x61
|
|
||||||
automatic_self_calibration: true
|
|
||||||
altitude_compensation: 10m
|
|
||||||
ambient_pressure_compensation: 961mBar
|
|
||||||
temperature_offset: 4.2C
|
|
||||||
update_interval: 15s
|
|
||||||
|
@ -1,20 +1,5 @@
|
|||||||
i2c:
|
substitutions:
|
||||||
- id: i2c_scd30
|
scl_pin: GPIO5
|
||||||
scl: 5
|
sda_pin: GPIO4
|
||||||
sda: 4
|
|
||||||
|
|
||||||
sensor:
|
<<: !include common.yaml
|
||||||
- platform: scd30
|
|
||||||
co2:
|
|
||||||
name: SCD30 CO2
|
|
||||||
temperature:
|
|
||||||
id: scd30_temperature
|
|
||||||
name: SCD30 Temperature
|
|
||||||
humidity:
|
|
||||||
name: SCD30 Humidity
|
|
||||||
address: 0x61
|
|
||||||
automatic_self_calibration: true
|
|
||||||
altitude_compensation: 10m
|
|
||||||
ambient_pressure_compensation: 961mBar
|
|
||||||
temperature_offset: 4.2C
|
|
||||||
update_interval: 15s
|
|
||||||
|
@ -1,20 +1,5 @@
|
|||||||
i2c:
|
substitutions:
|
||||||
- id: i2c_scd30
|
scl_pin: GPIO5
|
||||||
scl: 5
|
sda_pin: GPIO4
|
||||||
sda: 4
|
|
||||||
|
|
||||||
sensor:
|
<<: !include common.yaml
|
||||||
- platform: scd30
|
|
||||||
co2:
|
|
||||||
name: SCD30 CO2
|
|
||||||
temperature:
|
|
||||||
id: scd30_temperature
|
|
||||||
name: SCD30 Temperature
|
|
||||||
humidity:
|
|
||||||
name: SCD30 Humidity
|
|
||||||
address: 0x61
|
|
||||||
automatic_self_calibration: true
|
|
||||||
altitude_compensation: 10m
|
|
||||||
ambient_pressure_compensation: 961mBar
|
|
||||||
temperature_offset: 4.2C
|
|
||||||
update_interval: 15s
|
|
||||||
|
20
tests/components/scd4x/common.yaml
Normal file
20
tests/components/scd4x/common.yaml
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
i2c:
|
||||||
|
- id: i2c_scd4x
|
||||||
|
scl: ${scl_pin}
|
||||||
|
sda: ${sda_pin}
|
||||||
|
|
||||||
|
sensor:
|
||||||
|
- platform: scd4x
|
||||||
|
id: scd40
|
||||||
|
co2:
|
||||||
|
name: SCD4X CO2
|
||||||
|
temperature:
|
||||||
|
id: scd4x_temperature
|
||||||
|
name: SCD4X Temperature
|
||||||
|
humidity:
|
||||||
|
name: SCD4X Humidity
|
||||||
|
automatic_self_calibration: true
|
||||||
|
altitude_compensation: 10m
|
||||||
|
ambient_pressure_compensation: 961mBar
|
||||||
|
temperature_offset: 4.2C
|
||||||
|
update_interval: 15s
|
@ -1,20 +1,5 @@
|
|||||||
i2c:
|
substitutions:
|
||||||
- id: i2c_scd4x
|
scl_pin: GPIO16
|
||||||
scl: 16
|
sda_pin: GPIO17
|
||||||
sda: 17
|
|
||||||
|
|
||||||
sensor:
|
<<: !include common.yaml
|
||||||
- platform: scd4x
|
|
||||||
id: scd40
|
|
||||||
co2:
|
|
||||||
name: SCD4X CO2
|
|
||||||
temperature:
|
|
||||||
id: scd4x_temperature
|
|
||||||
name: SCD4X Temperature
|
|
||||||
humidity:
|
|
||||||
name: SCD4X Humidity
|
|
||||||
automatic_self_calibration: true
|
|
||||||
altitude_compensation: 10m
|
|
||||||
ambient_pressure_compensation: 961mBar
|
|
||||||
temperature_offset: 4.2C
|
|
||||||
update_interval: 15s
|
|
||||||
|
@ -1,20 +1,5 @@
|
|||||||
i2c:
|
substitutions:
|
||||||
- id: i2c_scd4x
|
scl_pin: GPIO5
|
||||||
scl: 5
|
sda_pin: GPIO4
|
||||||
sda: 4
|
|
||||||
|
|
||||||
sensor:
|
<<: !include common.yaml
|
||||||
- platform: scd4x
|
|
||||||
id: scd40
|
|
||||||
co2:
|
|
||||||
name: SCD4X CO2
|
|
||||||
temperature:
|
|
||||||
id: scd4x_temperature
|
|
||||||
name: SCD4X Temperature
|
|
||||||
humidity:
|
|
||||||
name: SCD4X Humidity
|
|
||||||
automatic_self_calibration: true
|
|
||||||
altitude_compensation: 10m
|
|
||||||
ambient_pressure_compensation: 961mBar
|
|
||||||
temperature_offset: 4.2C
|
|
||||||
update_interval: 15s
|
|
||||||
|
@ -1,20 +1,5 @@
|
|||||||
i2c:
|
substitutions:
|
||||||
- id: i2c_scd4x
|
scl_pin: GPIO5
|
||||||
scl: 5
|
sda_pin: GPIO4
|
||||||
sda: 4
|
|
||||||
|
|
||||||
sensor:
|
<<: !include common.yaml
|
||||||
- platform: scd4x
|
|
||||||
id: scd40
|
|
||||||
co2:
|
|
||||||
name: SCD4X CO2
|
|
||||||
temperature:
|
|
||||||
id: scd4x_temperature
|
|
||||||
name: SCD4X Temperature
|
|
||||||
humidity:
|
|
||||||
name: SCD4X Humidity
|
|
||||||
automatic_self_calibration: true
|
|
||||||
altitude_compensation: 10m
|
|
||||||
ambient_pressure_compensation: 961mBar
|
|
||||||
temperature_offset: 4.2C
|
|
||||||
update_interval: 15s
|
|
||||||
|
@ -1,20 +1,5 @@
|
|||||||
i2c:
|
substitutions:
|
||||||
- id: i2c_scd4x
|
scl_pin: GPIO16
|
||||||
scl: 16
|
sda_pin: GPIO17
|
||||||
sda: 17
|
|
||||||
|
|
||||||
sensor:
|
<<: !include common.yaml
|
||||||
- platform: scd4x
|
|
||||||
id: scd40
|
|
||||||
co2:
|
|
||||||
name: SCD4X CO2
|
|
||||||
temperature:
|
|
||||||
id: scd4x_temperature
|
|
||||||
name: SCD4X Temperature
|
|
||||||
humidity:
|
|
||||||
name: SCD4X Humidity
|
|
||||||
automatic_self_calibration: true
|
|
||||||
altitude_compensation: 10m
|
|
||||||
ambient_pressure_compensation: 961mBar
|
|
||||||
temperature_offset: 4.2C
|
|
||||||
update_interval: 15s
|
|
||||||
|
@ -1,20 +1,5 @@
|
|||||||
i2c:
|
substitutions:
|
||||||
- id: i2c_scd4x
|
scl_pin: GPIO5
|
||||||
scl: 5
|
sda_pin: GPIO4
|
||||||
sda: 4
|
|
||||||
|
|
||||||
sensor:
|
<<: !include common.yaml
|
||||||
- platform: scd4x
|
|
||||||
id: scd40
|
|
||||||
co2:
|
|
||||||
name: SCD4X CO2
|
|
||||||
temperature:
|
|
||||||
id: scd4x_temperature
|
|
||||||
name: SCD4X Temperature
|
|
||||||
humidity:
|
|
||||||
name: SCD4X Humidity
|
|
||||||
automatic_self_calibration: true
|
|
||||||
altitude_compensation: 10m
|
|
||||||
ambient_pressure_compensation: 961mBar
|
|
||||||
temperature_offset: 4.2C
|
|
||||||
update_interval: 15s
|
|
||||||
|
@ -1,20 +1,5 @@
|
|||||||
i2c:
|
substitutions:
|
||||||
- id: i2c_scd4x
|
scl_pin: GPIO5
|
||||||
scl: 5
|
sda_pin: GPIO4
|
||||||
sda: 4
|
|
||||||
|
|
||||||
sensor:
|
<<: !include common.yaml
|
||||||
- platform: scd4x
|
|
||||||
id: scd40
|
|
||||||
co2:
|
|
||||||
name: SCD4X CO2
|
|
||||||
temperature:
|
|
||||||
id: scd4x_temperature
|
|
||||||
name: SCD4X Temperature
|
|
||||||
humidity:
|
|
||||||
name: SCD4X Humidity
|
|
||||||
automatic_self_calibration: true
|
|
||||||
altitude_compensation: 10m
|
|
||||||
ambient_pressure_compensation: 961mBar
|
|
||||||
temperature_offset: 4.2C
|
|
||||||
update_interval: 15s
|
|
||||||
|
23
tests/components/sdm_meter/common.yaml
Normal file
23
tests/components/sdm_meter/common.yaml
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
uart:
|
||||||
|
- id: uart_sdm_meter
|
||||||
|
tx_pin: ${tx_pin}
|
||||||
|
rx_pin: ${rx_pin}
|
||||||
|
baud_rate: 9600
|
||||||
|
|
||||||
|
sensor:
|
||||||
|
- platform: sdm_meter
|
||||||
|
phase_a:
|
||||||
|
current:
|
||||||
|
name: Phase A Current
|
||||||
|
voltage:
|
||||||
|
name: Phase A Voltage
|
||||||
|
active_power:
|
||||||
|
name: Phase A Power
|
||||||
|
power_factor:
|
||||||
|
name: Phase A Power Factor
|
||||||
|
apparent_power:
|
||||||
|
name: Phase A Apparent Power
|
||||||
|
reactive_power:
|
||||||
|
name: Phase A Reactive Power
|
||||||
|
phase_angle:
|
||||||
|
name: Phase A Phase Angle
|
@ -1,23 +1,5 @@
|
|||||||
uart:
|
substitutions:
|
||||||
- id: uart_sdm_meter
|
tx_pin: GPIO17
|
||||||
tx_pin: 17
|
rx_pin: GPIO16
|
||||||
rx_pin: 16
|
|
||||||
baud_rate: 9600
|
|
||||||
|
|
||||||
sensor:
|
<<: !include common.yaml
|
||||||
- platform: sdm_meter
|
|
||||||
phase_a:
|
|
||||||
current:
|
|
||||||
name: Phase A Current
|
|
||||||
voltage:
|
|
||||||
name: Phase A Voltage
|
|
||||||
active_power:
|
|
||||||
name: Phase A Power
|
|
||||||
power_factor:
|
|
||||||
name: Phase A Power Factor
|
|
||||||
apparent_power:
|
|
||||||
name: Phase A Apparent Power
|
|
||||||
reactive_power:
|
|
||||||
name: Phase A Reactive Power
|
|
||||||
phase_angle:
|
|
||||||
name: Phase A Phase Angle
|
|
||||||
|
@ -1,23 +1,5 @@
|
|||||||
uart:
|
substitutions:
|
||||||
- id: uart_sdm_meter
|
tx_pin: GPIO4
|
||||||
tx_pin: 4
|
rx_pin: GPIO5
|
||||||
rx_pin: 5
|
|
||||||
baud_rate: 9600
|
|
||||||
|
|
||||||
sensor:
|
<<: !include common.yaml
|
||||||
- platform: sdm_meter
|
|
||||||
phase_a:
|
|
||||||
current:
|
|
||||||
name: Phase A Current
|
|
||||||
voltage:
|
|
||||||
name: Phase A Voltage
|
|
||||||
active_power:
|
|
||||||
name: Phase A Power
|
|
||||||
power_factor:
|
|
||||||
name: Phase A Power Factor
|
|
||||||
apparent_power:
|
|
||||||
name: Phase A Apparent Power
|
|
||||||
reactive_power:
|
|
||||||
name: Phase A Reactive Power
|
|
||||||
phase_angle:
|
|
||||||
name: Phase A Phase Angle
|
|
||||||
|
@ -1,23 +1,5 @@
|
|||||||
uart:
|
substitutions:
|
||||||
- id: uart_sdm_meter
|
tx_pin: GPIO4
|
||||||
tx_pin: 4
|
rx_pin: GPIO5
|
||||||
rx_pin: 5
|
|
||||||
baud_rate: 9600
|
|
||||||
|
|
||||||
sensor:
|
<<: !include common.yaml
|
||||||
- platform: sdm_meter
|
|
||||||
phase_a:
|
|
||||||
current:
|
|
||||||
name: Phase A Current
|
|
||||||
voltage:
|
|
||||||
name: Phase A Voltage
|
|
||||||
active_power:
|
|
||||||
name: Phase A Power
|
|
||||||
power_factor:
|
|
||||||
name: Phase A Power Factor
|
|
||||||
apparent_power:
|
|
||||||
name: Phase A Apparent Power
|
|
||||||
reactive_power:
|
|
||||||
name: Phase A Reactive Power
|
|
||||||
phase_angle:
|
|
||||||
name: Phase A Phase Angle
|
|
||||||
|
@ -1,23 +1,5 @@
|
|||||||
uart:
|
substitutions:
|
||||||
- id: uart_sdm_meter
|
tx_pin: GPIO17
|
||||||
tx_pin: 17
|
rx_pin: GPIO16
|
||||||
rx_pin: 16
|
|
||||||
baud_rate: 9600
|
|
||||||
|
|
||||||
sensor:
|
<<: !include common.yaml
|
||||||
- platform: sdm_meter
|
|
||||||
phase_a:
|
|
||||||
current:
|
|
||||||
name: Phase A Current
|
|
||||||
voltage:
|
|
||||||
name: Phase A Voltage
|
|
||||||
active_power:
|
|
||||||
name: Phase A Power
|
|
||||||
power_factor:
|
|
||||||
name: Phase A Power Factor
|
|
||||||
apparent_power:
|
|
||||||
name: Phase A Apparent Power
|
|
||||||
reactive_power:
|
|
||||||
name: Phase A Reactive Power
|
|
||||||
phase_angle:
|
|
||||||
name: Phase A Phase Angle
|
|
||||||
|
@ -1,23 +1,5 @@
|
|||||||
uart:
|
substitutions:
|
||||||
- id: uart_sdm_meter
|
tx_pin: GPIO4
|
||||||
tx_pin: 4
|
rx_pin: GPIO5
|
||||||
rx_pin: 5
|
|
||||||
baud_rate: 9600
|
|
||||||
|
|
||||||
sensor:
|
<<: !include common.yaml
|
||||||
- platform: sdm_meter
|
|
||||||
phase_a:
|
|
||||||
current:
|
|
||||||
name: Phase A Current
|
|
||||||
voltage:
|
|
||||||
name: Phase A Voltage
|
|
||||||
active_power:
|
|
||||||
name: Phase A Power
|
|
||||||
power_factor:
|
|
||||||
name: Phase A Power Factor
|
|
||||||
apparent_power:
|
|
||||||
name: Phase A Apparent Power
|
|
||||||
reactive_power:
|
|
||||||
name: Phase A Reactive Power
|
|
||||||
phase_angle:
|
|
||||||
name: Phase A Phase Angle
|
|
||||||
|
@ -1,23 +1,5 @@
|
|||||||
uart:
|
substitutions:
|
||||||
- id: uart_sdm_meter
|
tx_pin: GPIO4
|
||||||
tx_pin: 4
|
rx_pin: GPIO5
|
||||||
rx_pin: 5
|
|
||||||
baud_rate: 9600
|
|
||||||
|
|
||||||
sensor:
|
<<: !include common.yaml
|
||||||
- platform: sdm_meter
|
|
||||||
phase_a:
|
|
||||||
current:
|
|
||||||
name: Phase A Current
|
|
||||||
voltage:
|
|
||||||
name: Phase A Voltage
|
|
||||||
active_power:
|
|
||||||
name: Phase A Power
|
|
||||||
power_factor:
|
|
||||||
name: Phase A Power Factor
|
|
||||||
apparent_power:
|
|
||||||
name: Phase A Apparent Power
|
|
||||||
reactive_power:
|
|
||||||
name: Phase A Reactive Power
|
|
||||||
phase_angle:
|
|
||||||
name: Phase A Phase Angle
|
|
||||||
|
11
tests/components/sdp3x/common.yaml
Normal file
11
tests/components/sdp3x/common.yaml
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
i2c:
|
||||||
|
- id: i2c_sdp3x
|
||||||
|
scl: ${scl_pin}
|
||||||
|
sda: ${sda_pin}
|
||||||
|
|
||||||
|
sensor:
|
||||||
|
- platform: sdp3x
|
||||||
|
id: filter_pressure
|
||||||
|
name: HVAC Filter Pressure drop
|
||||||
|
accuracy_decimals: 3
|
||||||
|
update_interval: 5s
|
@ -1,11 +1,5 @@
|
|||||||
i2c:
|
substitutions:
|
||||||
- id: i2c_sdp3x
|
scl_pin: GPIO16
|
||||||
scl: 16
|
sda_pin: GPIO17
|
||||||
sda: 17
|
|
||||||
|
|
||||||
sensor:
|
<<: !include common.yaml
|
||||||
- platform: sdp3x
|
|
||||||
id: filter_pressure
|
|
||||||
name: HVAC Filter Pressure drop
|
|
||||||
accuracy_decimals: 3
|
|
||||||
update_interval: 5s
|
|
||||||
|
@ -1,11 +1,5 @@
|
|||||||
i2c:
|
substitutions:
|
||||||
- id: i2c_sdp3x
|
scl_pin: GPIO5
|
||||||
scl: 5
|
sda_pin: GPIO4
|
||||||
sda: 4
|
|
||||||
|
|
||||||
sensor:
|
<<: !include common.yaml
|
||||||
- platform: sdp3x
|
|
||||||
id: filter_pressure
|
|
||||||
name: HVAC Filter Pressure drop
|
|
||||||
accuracy_decimals: 3
|
|
||||||
update_interval: 5s
|
|
||||||
|
@ -1,11 +1,5 @@
|
|||||||
i2c:
|
substitutions:
|
||||||
- id: i2c_sdp3x
|
scl_pin: GPIO5
|
||||||
scl: 5
|
sda_pin: GPIO4
|
||||||
sda: 4
|
|
||||||
|
|
||||||
sensor:
|
<<: !include common.yaml
|
||||||
- platform: sdp3x
|
|
||||||
id: filter_pressure
|
|
||||||
name: HVAC Filter Pressure drop
|
|
||||||
accuracy_decimals: 3
|
|
||||||
update_interval: 5s
|
|
||||||
|
@ -1,11 +1,5 @@
|
|||||||
i2c:
|
substitutions:
|
||||||
- id: i2c_sdp3x
|
scl_pin: GPIO16
|
||||||
scl: 16
|
sda_pin: GPIO17
|
||||||
sda: 17
|
|
||||||
|
|
||||||
sensor:
|
<<: !include common.yaml
|
||||||
- platform: sdp3x
|
|
||||||
id: filter_pressure
|
|
||||||
name: HVAC Filter Pressure drop
|
|
||||||
accuracy_decimals: 3
|
|
||||||
update_interval: 5s
|
|
||||||
|
@ -1,11 +1,5 @@
|
|||||||
i2c:
|
substitutions:
|
||||||
- id: i2c_sdp3x
|
scl_pin: GPIO5
|
||||||
scl: 5
|
sda_pin: GPIO4
|
||||||
sda: 4
|
|
||||||
|
|
||||||
sensor:
|
<<: !include common.yaml
|
||||||
- platform: sdp3x
|
|
||||||
id: filter_pressure
|
|
||||||
name: HVAC Filter Pressure drop
|
|
||||||
accuracy_decimals: 3
|
|
||||||
update_interval: 5s
|
|
||||||
|
@ -1,11 +1,5 @@
|
|||||||
i2c:
|
substitutions:
|
||||||
- id: i2c_sdp3x
|
scl_pin: GPIO5
|
||||||
scl: 5
|
sda_pin: GPIO4
|
||||||
sda: 4
|
|
||||||
|
|
||||||
sensor:
|
<<: !include common.yaml
|
||||||
- platform: sdp3x
|
|
||||||
id: filter_pressure
|
|
||||||
name: HVAC Filter Pressure drop
|
|
||||||
accuracy_decimals: 3
|
|
||||||
update_interval: 5s
|
|
||||||
|
14
tests/components/sds011/common.yaml
Normal file
14
tests/components/sds011/common.yaml
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
uart:
|
||||||
|
- id: uart_sdm_sds011
|
||||||
|
tx_pin: ${tx_pin}
|
||||||
|
rx_pin: ${rx_pin}
|
||||||
|
baud_rate: 115200
|
||||||
|
|
||||||
|
sensor:
|
||||||
|
- platform: sds011
|
||||||
|
pm_2_5:
|
||||||
|
name: SDS011 PM2.5
|
||||||
|
pm_10_0:
|
||||||
|
name: SDS011 PM10.0
|
||||||
|
rx_only: false
|
||||||
|
update_interval: 5min
|
@ -1,14 +1,5 @@
|
|||||||
uart:
|
substitutions:
|
||||||
- id: uart_sdm_sds011
|
tx_pin: GPIO17
|
||||||
tx_pin: 17
|
rx_pin: GPIO16
|
||||||
rx_pin: 16
|
|
||||||
baud_rate: 115200
|
|
||||||
|
|
||||||
sensor:
|
<<: !include common.yaml
|
||||||
- platform: sds011
|
|
||||||
pm_2_5:
|
|
||||||
name: SDS011 PM2.5
|
|
||||||
pm_10_0:
|
|
||||||
name: SDS011 PM10.0
|
|
||||||
rx_only: false
|
|
||||||
update_interval: 5min
|
|
||||||
|
@ -1,14 +1,5 @@
|
|||||||
uart:
|
substitutions:
|
||||||
- id: uart_sdm_sds011
|
tx_pin: GPIO4
|
||||||
tx_pin: 4
|
rx_pin: GPIO5
|
||||||
rx_pin: 5
|
|
||||||
baud_rate: 115200
|
|
||||||
|
|
||||||
sensor:
|
<<: !include common.yaml
|
||||||
- platform: sds011
|
|
||||||
pm_2_5:
|
|
||||||
name: SDS011 PM2.5
|
|
||||||
pm_10_0:
|
|
||||||
name: SDS011 PM10.0
|
|
||||||
rx_only: false
|
|
||||||
update_interval: 5min
|
|
||||||
|
@ -1,14 +1,5 @@
|
|||||||
uart:
|
substitutions:
|
||||||
- id: uart_sdm_sds011
|
tx_pin: GPIO4
|
||||||
tx_pin: 4
|
rx_pin: GPIO5
|
||||||
rx_pin: 5
|
|
||||||
baud_rate: 115200
|
|
||||||
|
|
||||||
sensor:
|
<<: !include common.yaml
|
||||||
- platform: sds011
|
|
||||||
pm_2_5:
|
|
||||||
name: SDS011 PM2.5
|
|
||||||
pm_10_0:
|
|
||||||
name: SDS011 PM10.0
|
|
||||||
rx_only: false
|
|
||||||
update_interval: 5min
|
|
||||||
|
@ -1,14 +1,5 @@
|
|||||||
uart:
|
substitutions:
|
||||||
- id: uart_sdm_sds011
|
tx_pin: GPIO17
|
||||||
tx_pin: 17
|
rx_pin: GPIO16
|
||||||
rx_pin: 16
|
|
||||||
baud_rate: 115200
|
|
||||||
|
|
||||||
sensor:
|
<<: !include common.yaml
|
||||||
- platform: sds011
|
|
||||||
pm_2_5:
|
|
||||||
name: SDS011 PM2.5
|
|
||||||
pm_10_0:
|
|
||||||
name: SDS011 PM10.0
|
|
||||||
rx_only: false
|
|
||||||
update_interval: 5min
|
|
||||||
|
@ -1,14 +1,5 @@
|
|||||||
uart:
|
substitutions:
|
||||||
- id: uart_sdm_sds011
|
tx_pin: GPIO4
|
||||||
tx_pin: 4
|
rx_pin: GPIO5
|
||||||
rx_pin: 5
|
|
||||||
baud_rate: 115200
|
|
||||||
|
|
||||||
sensor:
|
<<: !include common.yaml
|
||||||
- platform: sds011
|
|
||||||
pm_2_5:
|
|
||||||
name: SDS011 PM2.5
|
|
||||||
pm_10_0:
|
|
||||||
name: SDS011 PM10.0
|
|
||||||
rx_only: false
|
|
||||||
update_interval: 5min
|
|
||||||
|
@ -1,14 +1,5 @@
|
|||||||
uart:
|
substitutions:
|
||||||
- id: uart_sdm_sds011
|
tx_pin: GPIO4
|
||||||
tx_pin: 4
|
rx_pin: GPIO5
|
||||||
rx_pin: 5
|
|
||||||
baud_rate: 115200
|
|
||||||
|
|
||||||
sensor:
|
<<: !include common.yaml
|
||||||
- platform: sds011
|
|
||||||
pm_2_5:
|
|
||||||
name: SDS011 PM2.5
|
|
||||||
pm_10_0:
|
|
||||||
name: SDS011 PM10.0
|
|
||||||
rx_only: false
|
|
||||||
update_interval: 5min
|
|
||||||
|
45
tests/components/selec_meter/common.yaml
Normal file
45
tests/components/selec_meter/common.yaml
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
uart:
|
||||||
|
- id: uart_selec_meter
|
||||||
|
tx_pin: ${tx_pin}
|
||||||
|
rx_pin: ${rx_pin}
|
||||||
|
baud_rate: 9600
|
||||||
|
|
||||||
|
sensor:
|
||||||
|
- platform: selec_meter
|
||||||
|
total_active_energy:
|
||||||
|
name: SelecEM2M Total Active Energy
|
||||||
|
import_active_energy:
|
||||||
|
name: SelecEM2M Import Active Energy
|
||||||
|
export_active_energy:
|
||||||
|
name: SelecEM2M Export Active Energy
|
||||||
|
total_reactive_energy:
|
||||||
|
name: SelecEM2M Total Reactive Energy
|
||||||
|
import_reactive_energy:
|
||||||
|
name: SelecEM2M Import Reactive Energy
|
||||||
|
export_reactive_energy:
|
||||||
|
name: SelecEM2M Export Reactive Energy
|
||||||
|
apparent_energy:
|
||||||
|
name: SelecEM2M Apparent Energy
|
||||||
|
active_power:
|
||||||
|
name: SelecEM2M Active Power
|
||||||
|
reactive_power:
|
||||||
|
name: SelecEM2M Reactive Power
|
||||||
|
apparent_power:
|
||||||
|
name: SelecEM2M Apparent Power
|
||||||
|
voltage:
|
||||||
|
name: SelecEM2M Voltage
|
||||||
|
current:
|
||||||
|
name: SelecEM2M Current
|
||||||
|
power_factor:
|
||||||
|
name: SelecEM2M Power Factor
|
||||||
|
frequency:
|
||||||
|
name: SelecEM2M Frequency
|
||||||
|
maximum_demand_active_power:
|
||||||
|
name: SelecEM2M Maximum Demand Active Power
|
||||||
|
disabled_by_default: true
|
||||||
|
maximum_demand_reactive_power:
|
||||||
|
name: SelecEM2M Maximum Demand Reactive Power
|
||||||
|
disabled_by_default: true
|
||||||
|
maximum_demand_apparent_power:
|
||||||
|
name: SelecEM2M Maximum Demand Apparent Power
|
||||||
|
disabled_by_default: true
|
@ -1,45 +1,5 @@
|
|||||||
uart:
|
substitutions:
|
||||||
- id: uart_selec_meter
|
tx_pin: GPIO17
|
||||||
tx_pin: 17
|
rx_pin: GPIO16
|
||||||
rx_pin: 16
|
|
||||||
baud_rate: 9600
|
|
||||||
|
|
||||||
sensor:
|
<<: !include common.yaml
|
||||||
- platform: selec_meter
|
|
||||||
total_active_energy:
|
|
||||||
name: SelecEM2M Total Active Energy
|
|
||||||
import_active_energy:
|
|
||||||
name: SelecEM2M Import Active Energy
|
|
||||||
export_active_energy:
|
|
||||||
name: SelecEM2M Export Active Energy
|
|
||||||
total_reactive_energy:
|
|
||||||
name: SelecEM2M Total Reactive Energy
|
|
||||||
import_reactive_energy:
|
|
||||||
name: SelecEM2M Import Reactive Energy
|
|
||||||
export_reactive_energy:
|
|
||||||
name: SelecEM2M Export Reactive Energy
|
|
||||||
apparent_energy:
|
|
||||||
name: SelecEM2M Apparent Energy
|
|
||||||
active_power:
|
|
||||||
name: SelecEM2M Active Power
|
|
||||||
reactive_power:
|
|
||||||
name: SelecEM2M Reactive Power
|
|
||||||
apparent_power:
|
|
||||||
name: SelecEM2M Apparent Power
|
|
||||||
voltage:
|
|
||||||
name: SelecEM2M Voltage
|
|
||||||
current:
|
|
||||||
name: SelecEM2M Current
|
|
||||||
power_factor:
|
|
||||||
name: SelecEM2M Power Factor
|
|
||||||
frequency:
|
|
||||||
name: SelecEM2M Frequency
|
|
||||||
maximum_demand_active_power:
|
|
||||||
name: SelecEM2M Maximum Demand Active Power
|
|
||||||
disabled_by_default: true
|
|
||||||
maximum_demand_reactive_power:
|
|
||||||
name: SelecEM2M Maximum Demand Reactive Power
|
|
||||||
disabled_by_default: true
|
|
||||||
maximum_demand_apparent_power:
|
|
||||||
name: SelecEM2M Maximum Demand Apparent Power
|
|
||||||
disabled_by_default: true
|
|
||||||
|
@ -1,45 +1,5 @@
|
|||||||
uart:
|
substitutions:
|
||||||
- id: uart_selec_meter
|
tx_pin: GPIO4
|
||||||
tx_pin: 4
|
rx_pin: GPIO5
|
||||||
rx_pin: 5
|
|
||||||
baud_rate: 9600
|
|
||||||
|
|
||||||
sensor:
|
<<: !include common.yaml
|
||||||
- platform: selec_meter
|
|
||||||
total_active_energy:
|
|
||||||
name: SelecEM2M Total Active Energy
|
|
||||||
import_active_energy:
|
|
||||||
name: SelecEM2M Import Active Energy
|
|
||||||
export_active_energy:
|
|
||||||
name: SelecEM2M Export Active Energy
|
|
||||||
total_reactive_energy:
|
|
||||||
name: SelecEM2M Total Reactive Energy
|
|
||||||
import_reactive_energy:
|
|
||||||
name: SelecEM2M Import Reactive Energy
|
|
||||||
export_reactive_energy:
|
|
||||||
name: SelecEM2M Export Reactive Energy
|
|
||||||
apparent_energy:
|
|
||||||
name: SelecEM2M Apparent Energy
|
|
||||||
active_power:
|
|
||||||
name: SelecEM2M Active Power
|
|
||||||
reactive_power:
|
|
||||||
name: SelecEM2M Reactive Power
|
|
||||||
apparent_power:
|
|
||||||
name: SelecEM2M Apparent Power
|
|
||||||
voltage:
|
|
||||||
name: SelecEM2M Voltage
|
|
||||||
current:
|
|
||||||
name: SelecEM2M Current
|
|
||||||
power_factor:
|
|
||||||
name: SelecEM2M Power Factor
|
|
||||||
frequency:
|
|
||||||
name: SelecEM2M Frequency
|
|
||||||
maximum_demand_active_power:
|
|
||||||
name: SelecEM2M Maximum Demand Active Power
|
|
||||||
disabled_by_default: true
|
|
||||||
maximum_demand_reactive_power:
|
|
||||||
name: SelecEM2M Maximum Demand Reactive Power
|
|
||||||
disabled_by_default: true
|
|
||||||
maximum_demand_apparent_power:
|
|
||||||
name: SelecEM2M Maximum Demand Apparent Power
|
|
||||||
disabled_by_default: true
|
|
||||||
|
@ -1,45 +1,5 @@
|
|||||||
uart:
|
substitutions:
|
||||||
- id: uart_selec_meter
|
tx_pin: GPIO4
|
||||||
tx_pin: 4
|
rx_pin: GPIO5
|
||||||
rx_pin: 5
|
|
||||||
baud_rate: 9600
|
|
||||||
|
|
||||||
sensor:
|
<<: !include common.yaml
|
||||||
- platform: selec_meter
|
|
||||||
total_active_energy:
|
|
||||||
name: SelecEM2M Total Active Energy
|
|
||||||
import_active_energy:
|
|
||||||
name: SelecEM2M Import Active Energy
|
|
||||||
export_active_energy:
|
|
||||||
name: SelecEM2M Export Active Energy
|
|
||||||
total_reactive_energy:
|
|
||||||
name: SelecEM2M Total Reactive Energy
|
|
||||||
import_reactive_energy:
|
|
||||||
name: SelecEM2M Import Reactive Energy
|
|
||||||
export_reactive_energy:
|
|
||||||
name: SelecEM2M Export Reactive Energy
|
|
||||||
apparent_energy:
|
|
||||||
name: SelecEM2M Apparent Energy
|
|
||||||
active_power:
|
|
||||||
name: SelecEM2M Active Power
|
|
||||||
reactive_power:
|
|
||||||
name: SelecEM2M Reactive Power
|
|
||||||
apparent_power:
|
|
||||||
name: SelecEM2M Apparent Power
|
|
||||||
voltage:
|
|
||||||
name: SelecEM2M Voltage
|
|
||||||
current:
|
|
||||||
name: SelecEM2M Current
|
|
||||||
power_factor:
|
|
||||||
name: SelecEM2M Power Factor
|
|
||||||
frequency:
|
|
||||||
name: SelecEM2M Frequency
|
|
||||||
maximum_demand_active_power:
|
|
||||||
name: SelecEM2M Maximum Demand Active Power
|
|
||||||
disabled_by_default: true
|
|
||||||
maximum_demand_reactive_power:
|
|
||||||
name: SelecEM2M Maximum Demand Reactive Power
|
|
||||||
disabled_by_default: true
|
|
||||||
maximum_demand_apparent_power:
|
|
||||||
name: SelecEM2M Maximum Demand Apparent Power
|
|
||||||
disabled_by_default: true
|
|
||||||
|
@ -1,45 +1,5 @@
|
|||||||
uart:
|
substitutions:
|
||||||
- id: uart_selec_meter
|
tx_pin: GPIO17
|
||||||
tx_pin: 17
|
rx_pin: GPIO16
|
||||||
rx_pin: 16
|
|
||||||
baud_rate: 9600
|
|
||||||
|
|
||||||
sensor:
|
<<: !include common.yaml
|
||||||
- platform: selec_meter
|
|
||||||
total_active_energy:
|
|
||||||
name: SelecEM2M Total Active Energy
|
|
||||||
import_active_energy:
|
|
||||||
name: SelecEM2M Import Active Energy
|
|
||||||
export_active_energy:
|
|
||||||
name: SelecEM2M Export Active Energy
|
|
||||||
total_reactive_energy:
|
|
||||||
name: SelecEM2M Total Reactive Energy
|
|
||||||
import_reactive_energy:
|
|
||||||
name: SelecEM2M Import Reactive Energy
|
|
||||||
export_reactive_energy:
|
|
||||||
name: SelecEM2M Export Reactive Energy
|
|
||||||
apparent_energy:
|
|
||||||
name: SelecEM2M Apparent Energy
|
|
||||||
active_power:
|
|
||||||
name: SelecEM2M Active Power
|
|
||||||
reactive_power:
|
|
||||||
name: SelecEM2M Reactive Power
|
|
||||||
apparent_power:
|
|
||||||
name: SelecEM2M Apparent Power
|
|
||||||
voltage:
|
|
||||||
name: SelecEM2M Voltage
|
|
||||||
current:
|
|
||||||
name: SelecEM2M Current
|
|
||||||
power_factor:
|
|
||||||
name: SelecEM2M Power Factor
|
|
||||||
frequency:
|
|
||||||
name: SelecEM2M Frequency
|
|
||||||
maximum_demand_active_power:
|
|
||||||
name: SelecEM2M Maximum Demand Active Power
|
|
||||||
disabled_by_default: true
|
|
||||||
maximum_demand_reactive_power:
|
|
||||||
name: SelecEM2M Maximum Demand Reactive Power
|
|
||||||
disabled_by_default: true
|
|
||||||
maximum_demand_apparent_power:
|
|
||||||
name: SelecEM2M Maximum Demand Apparent Power
|
|
||||||
disabled_by_default: true
|
|
||||||
|
@ -1,45 +1,5 @@
|
|||||||
uart:
|
substitutions:
|
||||||
- id: uart_selec_meter
|
tx_pin: GPIO4
|
||||||
tx_pin: 4
|
rx_pin: GPIO5
|
||||||
rx_pin: 5
|
|
||||||
baud_rate: 9600
|
|
||||||
|
|
||||||
sensor:
|
<<: !include common.yaml
|
||||||
- platform: selec_meter
|
|
||||||
total_active_energy:
|
|
||||||
name: SelecEM2M Total Active Energy
|
|
||||||
import_active_energy:
|
|
||||||
name: SelecEM2M Import Active Energy
|
|
||||||
export_active_energy:
|
|
||||||
name: SelecEM2M Export Active Energy
|
|
||||||
total_reactive_energy:
|
|
||||||
name: SelecEM2M Total Reactive Energy
|
|
||||||
import_reactive_energy:
|
|
||||||
name: SelecEM2M Import Reactive Energy
|
|
||||||
export_reactive_energy:
|
|
||||||
name: SelecEM2M Export Reactive Energy
|
|
||||||
apparent_energy:
|
|
||||||
name: SelecEM2M Apparent Energy
|
|
||||||
active_power:
|
|
||||||
name: SelecEM2M Active Power
|
|
||||||
reactive_power:
|
|
||||||
name: SelecEM2M Reactive Power
|
|
||||||
apparent_power:
|
|
||||||
name: SelecEM2M Apparent Power
|
|
||||||
voltage:
|
|
||||||
name: SelecEM2M Voltage
|
|
||||||
current:
|
|
||||||
name: SelecEM2M Current
|
|
||||||
power_factor:
|
|
||||||
name: SelecEM2M Power Factor
|
|
||||||
frequency:
|
|
||||||
name: SelecEM2M Frequency
|
|
||||||
maximum_demand_active_power:
|
|
||||||
name: SelecEM2M Maximum Demand Active Power
|
|
||||||
disabled_by_default: true
|
|
||||||
maximum_demand_reactive_power:
|
|
||||||
name: SelecEM2M Maximum Demand Reactive Power
|
|
||||||
disabled_by_default: true
|
|
||||||
maximum_demand_apparent_power:
|
|
||||||
name: SelecEM2M Maximum Demand Apparent Power
|
|
||||||
disabled_by_default: true
|
|
||||||
|
@ -1,45 +1,5 @@
|
|||||||
uart:
|
substitutions:
|
||||||
- id: uart_selec_meter
|
tx_pin: GPIO4
|
||||||
tx_pin: 4
|
rx_pin: GPIO5
|
||||||
rx_pin: 5
|
|
||||||
baud_rate: 9600
|
|
||||||
|
|
||||||
sensor:
|
<<: !include common.yaml
|
||||||
- platform: selec_meter
|
|
||||||
total_active_energy:
|
|
||||||
name: SelecEM2M Total Active Energy
|
|
||||||
import_active_energy:
|
|
||||||
name: SelecEM2M Import Active Energy
|
|
||||||
export_active_energy:
|
|
||||||
name: SelecEM2M Export Active Energy
|
|
||||||
total_reactive_energy:
|
|
||||||
name: SelecEM2M Total Reactive Energy
|
|
||||||
import_reactive_energy:
|
|
||||||
name: SelecEM2M Import Reactive Energy
|
|
||||||
export_reactive_energy:
|
|
||||||
name: SelecEM2M Export Reactive Energy
|
|
||||||
apparent_energy:
|
|
||||||
name: SelecEM2M Apparent Energy
|
|
||||||
active_power:
|
|
||||||
name: SelecEM2M Active Power
|
|
||||||
reactive_power:
|
|
||||||
name: SelecEM2M Reactive Power
|
|
||||||
apparent_power:
|
|
||||||
name: SelecEM2M Apparent Power
|
|
||||||
voltage:
|
|
||||||
name: SelecEM2M Voltage
|
|
||||||
current:
|
|
||||||
name: SelecEM2M Current
|
|
||||||
power_factor:
|
|
||||||
name: SelecEM2M Power Factor
|
|
||||||
frequency:
|
|
||||||
name: SelecEM2M Frequency
|
|
||||||
maximum_demand_active_power:
|
|
||||||
name: SelecEM2M Maximum Demand Active Power
|
|
||||||
disabled_by_default: true
|
|
||||||
maximum_demand_reactive_power:
|
|
||||||
name: SelecEM2M Maximum Demand Reactive Power
|
|
||||||
disabled_by_default: true
|
|
||||||
maximum_demand_apparent_power:
|
|
||||||
name: SelecEM2M Maximum Demand Apparent Power
|
|
||||||
disabled_by_default: true
|
|
||||||
|
10
tests/components/sen0321/common.yaml
Normal file
10
tests/components/sen0321/common.yaml
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
i2c:
|
||||||
|
- id: i2c_sen0321
|
||||||
|
scl: ${scl_pin}
|
||||||
|
sda: ${sda_pin}
|
||||||
|
|
||||||
|
sensor:
|
||||||
|
- platform: sen0321
|
||||||
|
name: Workshop Ozone Sensor
|
||||||
|
id: sen0321_ozone
|
||||||
|
update_interval: 10s
|
@ -1,10 +1,5 @@
|
|||||||
i2c:
|
substitutions:
|
||||||
- id: i2c_sen0321
|
scl_pin: GPIO16
|
||||||
scl: 16
|
sda_pin: GPIO17
|
||||||
sda: 17
|
|
||||||
|
|
||||||
sensor:
|
<<: !include common.yaml
|
||||||
- platform: sen0321
|
|
||||||
name: Workshop Ozone Sensor
|
|
||||||
id: sen0321_ozone
|
|
||||||
update_interval: 10s
|
|
||||||
|
@ -1,10 +1,5 @@
|
|||||||
i2c:
|
substitutions:
|
||||||
- id: i2c_sen0321
|
scl_pin: GPIO5
|
||||||
scl: 5
|
sda_pin: GPIO4
|
||||||
sda: 4
|
|
||||||
|
|
||||||
sensor:
|
<<: !include common.yaml
|
||||||
- platform: sen0321
|
|
||||||
name: Workshop Ozone Sensor
|
|
||||||
id: sen0321_ozone
|
|
||||||
update_interval: 10s
|
|
||||||
|
@ -1,10 +1,5 @@
|
|||||||
i2c:
|
substitutions:
|
||||||
- id: i2c_sen0321
|
scl_pin: GPIO5
|
||||||
scl: 5
|
sda_pin: GPIO4
|
||||||
sda: 4
|
|
||||||
|
|
||||||
sensor:
|
<<: !include common.yaml
|
||||||
- platform: sen0321
|
|
||||||
name: Workshop Ozone Sensor
|
|
||||||
id: sen0321_ozone
|
|
||||||
update_interval: 10s
|
|
||||||
|
@ -1,10 +1,5 @@
|
|||||||
i2c:
|
substitutions:
|
||||||
- id: i2c_sen0321
|
scl_pin: GPIO16
|
||||||
scl: 16
|
sda_pin: GPIO17
|
||||||
sda: 17
|
|
||||||
|
|
||||||
sensor:
|
<<: !include common.yaml
|
||||||
- platform: sen0321
|
|
||||||
name: Workshop Ozone Sensor
|
|
||||||
id: sen0321_ozone
|
|
||||||
update_interval: 10s
|
|
||||||
|
@ -1,10 +1,5 @@
|
|||||||
i2c:
|
substitutions:
|
||||||
- id: i2c_sen0321
|
scl_pin: GPIO5
|
||||||
scl: 5
|
sda_pin: GPIO4
|
||||||
sda: 4
|
|
||||||
|
|
||||||
sensor:
|
<<: !include common.yaml
|
||||||
- platform: sen0321
|
|
||||||
name: Workshop Ozone Sensor
|
|
||||||
id: sen0321_ozone
|
|
||||||
update_interval: 10s
|
|
||||||
|
@ -1,10 +1,5 @@
|
|||||||
i2c:
|
substitutions:
|
||||||
- id: i2c_sen0321
|
scl_pin: GPIO5
|
||||||
scl: 5
|
sda_pin: GPIO4
|
||||||
sda: 4
|
|
||||||
|
|
||||||
sensor:
|
<<: !include common.yaml
|
||||||
- platform: sen0321
|
|
||||||
name: Workshop Ozone Sensor
|
|
||||||
id: sen0321_ozone
|
|
||||||
update_interval: 10s
|
|
||||||
|
9
tests/components/sen21231/common.yaml
Normal file
9
tests/components/sen21231/common.yaml
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
i2c:
|
||||||
|
- id: i2c_sen21231
|
||||||
|
scl: ${scl_pin}
|
||||||
|
sda: ${sda_pin}
|
||||||
|
|
||||||
|
sensor:
|
||||||
|
- platform: sen21231
|
||||||
|
id: sen21231_sensor1
|
||||||
|
name: Person Sensor
|
@ -1,9 +1,5 @@
|
|||||||
i2c:
|
substitutions:
|
||||||
- id: i2c_sen21231
|
scl_pin: GPIO16
|
||||||
scl: 16
|
sda_pin: GPIO17
|
||||||
sda: 17
|
|
||||||
|
|
||||||
sensor:
|
<<: !include common.yaml
|
||||||
- platform: sen21231
|
|
||||||
id: sen21231_sensor1
|
|
||||||
name: Person Sensor
|
|
||||||
|
@ -1,9 +1,5 @@
|
|||||||
i2c:
|
substitutions:
|
||||||
- id: i2c_sen21231
|
scl_pin: GPIO5
|
||||||
scl: 5
|
sda_pin: GPIO4
|
||||||
sda: 4
|
|
||||||
|
|
||||||
sensor:
|
<<: !include common.yaml
|
||||||
- platform: sen21231
|
|
||||||
id: sen21231_sensor1
|
|
||||||
name: Person Sensor
|
|
||||||
|
@ -1,9 +1,5 @@
|
|||||||
i2c:
|
substitutions:
|
||||||
- id: i2c_sen21231
|
scl_pin: GPIO5
|
||||||
scl: 5
|
sda_pin: GPIO4
|
||||||
sda: 4
|
|
||||||
|
|
||||||
sensor:
|
<<: !include common.yaml
|
||||||
- platform: sen21231
|
|
||||||
id: sen21231_sensor1
|
|
||||||
name: Person Sensor
|
|
||||||
|
@ -1,9 +1,5 @@
|
|||||||
i2c:
|
substitutions:
|
||||||
- id: i2c_sen21231
|
scl_pin: GPIO16
|
||||||
scl: 16
|
sda_pin: GPIO17
|
||||||
sda: 17
|
|
||||||
|
|
||||||
sensor:
|
<<: !include common.yaml
|
||||||
- platform: sen21231
|
|
||||||
id: sen21231_sensor1
|
|
||||||
name: Person Sensor
|
|
||||||
|
@ -1,9 +1,5 @@
|
|||||||
i2c:
|
substitutions:
|
||||||
- id: i2c_sen21231
|
scl_pin: GPIO5
|
||||||
scl: 5
|
sda_pin: GPIO4
|
||||||
sda: 4
|
|
||||||
|
|
||||||
sensor:
|
<<: !include common.yaml
|
||||||
- platform: sen21231
|
|
||||||
id: sen21231_sensor1
|
|
||||||
name: Person Sensor
|
|
||||||
|
@ -1,9 +1,5 @@
|
|||||||
i2c:
|
substitutions:
|
||||||
- id: i2c_sen21231
|
scl_pin: GPIO5
|
||||||
scl: 5
|
sda_pin: GPIO4
|
||||||
sda: 4
|
|
||||||
|
|
||||||
sensor:
|
<<: !include common.yaml
|
||||||
- platform: sen21231
|
|
||||||
id: sen21231_sensor1
|
|
||||||
name: Person Sensor
|
|
||||||
|
49
tests/components/sen5x/common.yaml
Normal file
49
tests/components/sen5x/common.yaml
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
i2c:
|
||||||
|
- id: i2c_sen5x
|
||||||
|
scl: ${scl_pin}
|
||||||
|
sda: ${sda_pin}
|
||||||
|
|
||||||
|
sensor:
|
||||||
|
- platform: sen5x
|
||||||
|
id: sen54
|
||||||
|
temperature:
|
||||||
|
name: Temperature
|
||||||
|
accuracy_decimals: 1
|
||||||
|
humidity:
|
||||||
|
name: Humidity
|
||||||
|
accuracy_decimals: 0
|
||||||
|
pm_1_0:
|
||||||
|
name: PM <1µm Weight concentration
|
||||||
|
id: pm_1_0
|
||||||
|
accuracy_decimals: 1
|
||||||
|
pm_2_5:
|
||||||
|
name: PM <2.5µm Weight concentration
|
||||||
|
id: pm_2_5
|
||||||
|
accuracy_decimals: 1
|
||||||
|
pm_4_0:
|
||||||
|
name: PM <4µm Weight concentration
|
||||||
|
id: pm_4_0
|
||||||
|
accuracy_decimals: 1
|
||||||
|
pm_10_0:
|
||||||
|
name: PM <10µm Weight concentration
|
||||||
|
id: pm_10_0
|
||||||
|
accuracy_decimals: 1
|
||||||
|
nox:
|
||||||
|
name: NOx
|
||||||
|
voc:
|
||||||
|
name: VOC
|
||||||
|
algorithm_tuning:
|
||||||
|
index_offset: 100
|
||||||
|
learning_time_offset_hours: 12
|
||||||
|
learning_time_gain_hours: 12
|
||||||
|
gating_max_duration_minutes: 180
|
||||||
|
std_initial: 50
|
||||||
|
gain_factor: 230
|
||||||
|
temperature_compensation:
|
||||||
|
offset: 0
|
||||||
|
normalized_offset_slope: 0
|
||||||
|
time_constant: 0
|
||||||
|
auto_cleaning_interval: 604800s
|
||||||
|
acceleration_mode: low
|
||||||
|
store_baseline: true
|
||||||
|
address: 0x69
|
@ -1,49 +1,5 @@
|
|||||||
i2c:
|
substitutions:
|
||||||
- id: i2c_sen5x
|
scl_pin: GPIO16
|
||||||
scl: 16
|
sda_pin: GPIO17
|
||||||
sda: 17
|
|
||||||
|
|
||||||
sensor:
|
<<: !include common.yaml
|
||||||
- platform: sen5x
|
|
||||||
id: sen54
|
|
||||||
temperature:
|
|
||||||
name: Temperature
|
|
||||||
accuracy_decimals: 1
|
|
||||||
humidity:
|
|
||||||
name: Humidity
|
|
||||||
accuracy_decimals: 0
|
|
||||||
pm_1_0:
|
|
||||||
name: PM <1µm Weight concentration
|
|
||||||
id: pm_1_0
|
|
||||||
accuracy_decimals: 1
|
|
||||||
pm_2_5:
|
|
||||||
name: PM <2.5µm Weight concentration
|
|
||||||
id: pm_2_5
|
|
||||||
accuracy_decimals: 1
|
|
||||||
pm_4_0:
|
|
||||||
name: PM <4µm Weight concentration
|
|
||||||
id: pm_4_0
|
|
||||||
accuracy_decimals: 1
|
|
||||||
pm_10_0:
|
|
||||||
name: PM <10µm Weight concentration
|
|
||||||
id: pm_10_0
|
|
||||||
accuracy_decimals: 1
|
|
||||||
nox:
|
|
||||||
name: NOx
|
|
||||||
voc:
|
|
||||||
name: VOC
|
|
||||||
algorithm_tuning:
|
|
||||||
index_offset: 100
|
|
||||||
learning_time_offset_hours: 12
|
|
||||||
learning_time_gain_hours: 12
|
|
||||||
gating_max_duration_minutes: 180
|
|
||||||
std_initial: 50
|
|
||||||
gain_factor: 230
|
|
||||||
temperature_compensation:
|
|
||||||
offset: 0
|
|
||||||
normalized_offset_slope: 0
|
|
||||||
time_constant: 0
|
|
||||||
auto_cleaning_interval: 604800s
|
|
||||||
acceleration_mode: low
|
|
||||||
store_baseline: true
|
|
||||||
address: 0x69
|
|
||||||
|
@ -1,49 +1,5 @@
|
|||||||
i2c:
|
substitutions:
|
||||||
- id: i2c_sen5x
|
scl_pin: GPIO5
|
||||||
scl: 5
|
sda_pin: GPIO4
|
||||||
sda: 4
|
|
||||||
|
|
||||||
sensor:
|
<<: !include common.yaml
|
||||||
- platform: sen5x
|
|
||||||
id: sen54
|
|
||||||
temperature:
|
|
||||||
name: Temperature
|
|
||||||
accuracy_decimals: 1
|
|
||||||
humidity:
|
|
||||||
name: Humidity
|
|
||||||
accuracy_decimals: 0
|
|
||||||
pm_1_0:
|
|
||||||
name: PM <1µm Weight concentration
|
|
||||||
id: pm_1_0
|
|
||||||
accuracy_decimals: 1
|
|
||||||
pm_2_5:
|
|
||||||
name: PM <2.5µm Weight concentration
|
|
||||||
id: pm_2_5
|
|
||||||
accuracy_decimals: 1
|
|
||||||
pm_4_0:
|
|
||||||
name: PM <4µm Weight concentration
|
|
||||||
id: pm_4_0
|
|
||||||
accuracy_decimals: 1
|
|
||||||
pm_10_0:
|
|
||||||
name: PM <10µm Weight concentration
|
|
||||||
id: pm_10_0
|
|
||||||
accuracy_decimals: 1
|
|
||||||
nox:
|
|
||||||
name: NOx
|
|
||||||
voc:
|
|
||||||
name: VOC
|
|
||||||
algorithm_tuning:
|
|
||||||
index_offset: 100
|
|
||||||
learning_time_offset_hours: 12
|
|
||||||
learning_time_gain_hours: 12
|
|
||||||
gating_max_duration_minutes: 180
|
|
||||||
std_initial: 50
|
|
||||||
gain_factor: 230
|
|
||||||
temperature_compensation:
|
|
||||||
offset: 0
|
|
||||||
normalized_offset_slope: 0
|
|
||||||
time_constant: 0
|
|
||||||
auto_cleaning_interval: 604800s
|
|
||||||
acceleration_mode: low
|
|
||||||
store_baseline: true
|
|
||||||
address: 0x69
|
|
||||||
|
@ -1,49 +1,5 @@
|
|||||||
i2c:
|
substitutions:
|
||||||
- id: i2c_sen5x
|
scl_pin: GPIO5
|
||||||
scl: 5
|
sda_pin: GPIO4
|
||||||
sda: 4
|
|
||||||
|
|
||||||
sensor:
|
<<: !include common.yaml
|
||||||
- platform: sen5x
|
|
||||||
id: sen54
|
|
||||||
temperature:
|
|
||||||
name: Temperature
|
|
||||||
accuracy_decimals: 1
|
|
||||||
humidity:
|
|
||||||
name: Humidity
|
|
||||||
accuracy_decimals: 0
|
|
||||||
pm_1_0:
|
|
||||||
name: PM <1µm Weight concentration
|
|
||||||
id: pm_1_0
|
|
||||||
accuracy_decimals: 1
|
|
||||||
pm_2_5:
|
|
||||||
name: PM <2.5µm Weight concentration
|
|
||||||
id: pm_2_5
|
|
||||||
accuracy_decimals: 1
|
|
||||||
pm_4_0:
|
|
||||||
name: PM <4µm Weight concentration
|
|
||||||
id: pm_4_0
|
|
||||||
accuracy_decimals: 1
|
|
||||||
pm_10_0:
|
|
||||||
name: PM <10µm Weight concentration
|
|
||||||
id: pm_10_0
|
|
||||||
accuracy_decimals: 1
|
|
||||||
nox:
|
|
||||||
name: NOx
|
|
||||||
voc:
|
|
||||||
name: VOC
|
|
||||||
algorithm_tuning:
|
|
||||||
index_offset: 100
|
|
||||||
learning_time_offset_hours: 12
|
|
||||||
learning_time_gain_hours: 12
|
|
||||||
gating_max_duration_minutes: 180
|
|
||||||
std_initial: 50
|
|
||||||
gain_factor: 230
|
|
||||||
temperature_compensation:
|
|
||||||
offset: 0
|
|
||||||
normalized_offset_slope: 0
|
|
||||||
time_constant: 0
|
|
||||||
auto_cleaning_interval: 604800s
|
|
||||||
acceleration_mode: low
|
|
||||||
store_baseline: true
|
|
||||||
address: 0x69
|
|
||||||
|
@ -1,49 +1,5 @@
|
|||||||
i2c:
|
substitutions:
|
||||||
- id: i2c_sen5x
|
scl_pin: GPIO16
|
||||||
scl: 16
|
sda_pin: GPIO17
|
||||||
sda: 17
|
|
||||||
|
|
||||||
sensor:
|
<<: !include common.yaml
|
||||||
- platform: sen5x
|
|
||||||
id: sen54
|
|
||||||
temperature:
|
|
||||||
name: Temperature
|
|
||||||
accuracy_decimals: 1
|
|
||||||
humidity:
|
|
||||||
name: Humidity
|
|
||||||
accuracy_decimals: 0
|
|
||||||
pm_1_0:
|
|
||||||
name: PM <1µm Weight concentration
|
|
||||||
id: pm_1_0
|
|
||||||
accuracy_decimals: 1
|
|
||||||
pm_2_5:
|
|
||||||
name: PM <2.5µm Weight concentration
|
|
||||||
id: pm_2_5
|
|
||||||
accuracy_decimals: 1
|
|
||||||
pm_4_0:
|
|
||||||
name: PM <4µm Weight concentration
|
|
||||||
id: pm_4_0
|
|
||||||
accuracy_decimals: 1
|
|
||||||
pm_10_0:
|
|
||||||
name: PM <10µm Weight concentration
|
|
||||||
id: pm_10_0
|
|
||||||
accuracy_decimals: 1
|
|
||||||
nox:
|
|
||||||
name: NOx
|
|
||||||
voc:
|
|
||||||
name: VOC
|
|
||||||
algorithm_tuning:
|
|
||||||
index_offset: 100
|
|
||||||
learning_time_offset_hours: 12
|
|
||||||
learning_time_gain_hours: 12
|
|
||||||
gating_max_duration_minutes: 180
|
|
||||||
std_initial: 50
|
|
||||||
gain_factor: 230
|
|
||||||
temperature_compensation:
|
|
||||||
offset: 0
|
|
||||||
normalized_offset_slope: 0
|
|
||||||
time_constant: 0
|
|
||||||
auto_cleaning_interval: 604800s
|
|
||||||
acceleration_mode: low
|
|
||||||
store_baseline: true
|
|
||||||
address: 0x69
|
|
||||||
|
@ -1,49 +1,5 @@
|
|||||||
i2c:
|
substitutions:
|
||||||
- id: i2c_sen5x
|
scl_pin: GPIO5
|
||||||
scl: 5
|
sda_pin: GPIO4
|
||||||
sda: 4
|
|
||||||
|
|
||||||
sensor:
|
<<: !include common.yaml
|
||||||
- platform: sen5x
|
|
||||||
id: sen54
|
|
||||||
temperature:
|
|
||||||
name: Temperature
|
|
||||||
accuracy_decimals: 1
|
|
||||||
humidity:
|
|
||||||
name: Humidity
|
|
||||||
accuracy_decimals: 0
|
|
||||||
pm_1_0:
|
|
||||||
name: PM <1µm Weight concentration
|
|
||||||
id: pm_1_0
|
|
||||||
accuracy_decimals: 1
|
|
||||||
pm_2_5:
|
|
||||||
name: PM <2.5µm Weight concentration
|
|
||||||
id: pm_2_5
|
|
||||||
accuracy_decimals: 1
|
|
||||||
pm_4_0:
|
|
||||||
name: PM <4µm Weight concentration
|
|
||||||
id: pm_4_0
|
|
||||||
accuracy_decimals: 1
|
|
||||||
pm_10_0:
|
|
||||||
name: PM <10µm Weight concentration
|
|
||||||
id: pm_10_0
|
|
||||||
accuracy_decimals: 1
|
|
||||||
nox:
|
|
||||||
name: NOx
|
|
||||||
voc:
|
|
||||||
name: VOC
|
|
||||||
algorithm_tuning:
|
|
||||||
index_offset: 100
|
|
||||||
learning_time_offset_hours: 12
|
|
||||||
learning_time_gain_hours: 12
|
|
||||||
gating_max_duration_minutes: 180
|
|
||||||
std_initial: 50
|
|
||||||
gain_factor: 230
|
|
||||||
temperature_compensation:
|
|
||||||
offset: 0
|
|
||||||
normalized_offset_slope: 0
|
|
||||||
time_constant: 0
|
|
||||||
auto_cleaning_interval: 604800s
|
|
||||||
acceleration_mode: low
|
|
||||||
store_baseline: true
|
|
||||||
address: 0x69
|
|
||||||
|
@ -1,49 +1,5 @@
|
|||||||
i2c:
|
substitutions:
|
||||||
- id: i2c_sen5x
|
scl_pin: GPIO5
|
||||||
scl: 5
|
sda_pin: GPIO4
|
||||||
sda: 4
|
|
||||||
|
|
||||||
sensor:
|
<<: !include common.yaml
|
||||||
- platform: sen5x
|
|
||||||
id: sen54
|
|
||||||
temperature:
|
|
||||||
name: Temperature
|
|
||||||
accuracy_decimals: 1
|
|
||||||
humidity:
|
|
||||||
name: Humidity
|
|
||||||
accuracy_decimals: 0
|
|
||||||
pm_1_0:
|
|
||||||
name: PM <1µm Weight concentration
|
|
||||||
id: pm_1_0
|
|
||||||
accuracy_decimals: 1
|
|
||||||
pm_2_5:
|
|
||||||
name: PM <2.5µm Weight concentration
|
|
||||||
id: pm_2_5
|
|
||||||
accuracy_decimals: 1
|
|
||||||
pm_4_0:
|
|
||||||
name: PM <4µm Weight concentration
|
|
||||||
id: pm_4_0
|
|
||||||
accuracy_decimals: 1
|
|
||||||
pm_10_0:
|
|
||||||
name: PM <10µm Weight concentration
|
|
||||||
id: pm_10_0
|
|
||||||
accuracy_decimals: 1
|
|
||||||
nox:
|
|
||||||
name: NOx
|
|
||||||
voc:
|
|
||||||
name: VOC
|
|
||||||
algorithm_tuning:
|
|
||||||
index_offset: 100
|
|
||||||
learning_time_offset_hours: 12
|
|
||||||
learning_time_gain_hours: 12
|
|
||||||
gating_max_duration_minutes: 180
|
|
||||||
std_initial: 50
|
|
||||||
gain_factor: 230
|
|
||||||
temperature_compensation:
|
|
||||||
offset: 0
|
|
||||||
normalized_offset_slope: 0
|
|
||||||
time_constant: 0
|
|
||||||
auto_cleaning_interval: 604800s
|
|
||||||
acceleration_mode: low
|
|
||||||
store_baseline: true
|
|
||||||
address: 0x69
|
|
||||||
|
19
tests/components/senseair/common.yaml
Normal file
19
tests/components/senseair/common.yaml
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
uart:
|
||||||
|
- id: uart_senseair
|
||||||
|
tx_pin: ${tx_pin}
|
||||||
|
rx_pin: ${rx_pin}
|
||||||
|
baud_rate: 9600
|
||||||
|
|
||||||
|
sensor:
|
||||||
|
- platform: senseair
|
||||||
|
id: senseair0
|
||||||
|
co2:
|
||||||
|
name: SenseAir CO2 Value
|
||||||
|
on_value:
|
||||||
|
then:
|
||||||
|
- senseair.background_calibration: senseair0
|
||||||
|
- senseair.background_calibration_result: senseair0
|
||||||
|
- senseair.abc_get_period: senseair0
|
||||||
|
- senseair.abc_enable: senseair0
|
||||||
|
- senseair.abc_disable: senseair0
|
||||||
|
update_interval: 15s
|
@ -1,19 +1,5 @@
|
|||||||
uart:
|
substitutions:
|
||||||
- id: uart_senseair
|
tx_pin: GPIO17
|
||||||
tx_pin: 17
|
rx_pin: GPIO16
|
||||||
rx_pin: 16
|
|
||||||
baud_rate: 9600
|
|
||||||
|
|
||||||
sensor:
|
<<: !include common.yaml
|
||||||
- platform: senseair
|
|
||||||
id: senseair0
|
|
||||||
co2:
|
|
||||||
name: SenseAir CO2 Value
|
|
||||||
on_value:
|
|
||||||
then:
|
|
||||||
- senseair.background_calibration: senseair0
|
|
||||||
- senseair.background_calibration_result: senseair0
|
|
||||||
- senseair.abc_get_period: senseair0
|
|
||||||
- senseair.abc_enable: senseair0
|
|
||||||
- senseair.abc_disable: senseair0
|
|
||||||
update_interval: 15s
|
|
||||||
|
@ -1,19 +1,5 @@
|
|||||||
uart:
|
substitutions:
|
||||||
- id: uart_senseair
|
tx_pin: GPIO4
|
||||||
tx_pin: 4
|
rx_pin: GPIO5
|
||||||
rx_pin: 5
|
|
||||||
baud_rate: 9600
|
|
||||||
|
|
||||||
sensor:
|
<<: !include common.yaml
|
||||||
- platform: senseair
|
|
||||||
id: senseair0
|
|
||||||
co2:
|
|
||||||
name: SenseAir CO2 Value
|
|
||||||
on_value:
|
|
||||||
then:
|
|
||||||
- senseair.background_calibration: senseair0
|
|
||||||
- senseair.background_calibration_result: senseair0
|
|
||||||
- senseair.abc_get_period: senseair0
|
|
||||||
- senseair.abc_enable: senseair0
|
|
||||||
- senseair.abc_disable: senseair0
|
|
||||||
update_interval: 15s
|
|
||||||
|
@ -1,19 +1,5 @@
|
|||||||
uart:
|
substitutions:
|
||||||
- id: uart_senseair
|
tx_pin: GPIO4
|
||||||
tx_pin: 4
|
rx_pin: GPIO5
|
||||||
rx_pin: 5
|
|
||||||
baud_rate: 9600
|
|
||||||
|
|
||||||
sensor:
|
<<: !include common.yaml
|
||||||
- platform: senseair
|
|
||||||
id: senseair0
|
|
||||||
co2:
|
|
||||||
name: SenseAir CO2 Value
|
|
||||||
on_value:
|
|
||||||
then:
|
|
||||||
- senseair.background_calibration: senseair0
|
|
||||||
- senseair.background_calibration_result: senseair0
|
|
||||||
- senseair.abc_get_period: senseair0
|
|
||||||
- senseair.abc_enable: senseair0
|
|
||||||
- senseair.abc_disable: senseair0
|
|
||||||
update_interval: 15s
|
|
||||||
|
@ -1,19 +1,5 @@
|
|||||||
uart:
|
substitutions:
|
||||||
- id: uart_senseair
|
tx_pin: GPIO17
|
||||||
tx_pin: 17
|
rx_pin: GPIO16
|
||||||
rx_pin: 16
|
|
||||||
baud_rate: 9600
|
|
||||||
|
|
||||||
sensor:
|
<<: !include common.yaml
|
||||||
- platform: senseair
|
|
||||||
id: senseair0
|
|
||||||
co2:
|
|
||||||
name: SenseAir CO2 Value
|
|
||||||
on_value:
|
|
||||||
then:
|
|
||||||
- senseair.background_calibration: senseair0
|
|
||||||
- senseair.background_calibration_result: senseair0
|
|
||||||
- senseair.abc_get_period: senseair0
|
|
||||||
- senseair.abc_enable: senseair0
|
|
||||||
- senseair.abc_disable: senseair0
|
|
||||||
update_interval: 15s
|
|
||||||
|
@ -1,19 +1,5 @@
|
|||||||
uart:
|
substitutions:
|
||||||
- id: uart_senseair
|
tx_pin: GPIO4
|
||||||
tx_pin: 4
|
rx_pin: GPIO5
|
||||||
rx_pin: 5
|
|
||||||
baud_rate: 9600
|
|
||||||
|
|
||||||
sensor:
|
<<: !include common.yaml
|
||||||
- platform: senseair
|
|
||||||
id: senseair0
|
|
||||||
co2:
|
|
||||||
name: SenseAir CO2 Value
|
|
||||||
on_value:
|
|
||||||
then:
|
|
||||||
- senseair.background_calibration: senseair0
|
|
||||||
- senseair.background_calibration_result: senseair0
|
|
||||||
- senseair.abc_get_period: senseair0
|
|
||||||
- senseair.abc_enable: senseair0
|
|
||||||
- senseair.abc_disable: senseair0
|
|
||||||
update_interval: 15s
|
|
||||||
|
@ -1,19 +1,5 @@
|
|||||||
uart:
|
substitutions:
|
||||||
- id: uart_senseair
|
tx_pin: GPIO4
|
||||||
tx_pin: 4
|
rx_pin: GPIO5
|
||||||
rx_pin: 5
|
|
||||||
baud_rate: 9600
|
|
||||||
|
|
||||||
sensor:
|
<<: !include common.yaml
|
||||||
- platform: senseair
|
|
||||||
id: senseair0
|
|
||||||
co2:
|
|
||||||
name: SenseAir CO2 Value
|
|
||||||
on_value:
|
|
||||||
then:
|
|
||||||
- senseair.background_calibration: senseair0
|
|
||||||
- senseair.background_calibration_result: senseair0
|
|
||||||
- senseair.abc_get_period: senseair0
|
|
||||||
- senseair.abc_enable: senseair0
|
|
||||||
- senseair.abc_disable: senseair0
|
|
||||||
update_interval: 15s
|
|
||||||
|
19
tests/components/servo/common.yaml
Normal file
19
tests/components/servo/common.yaml
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
esphome:
|
||||||
|
on_boot:
|
||||||
|
then:
|
||||||
|
- servo.write:
|
||||||
|
id: test_servo
|
||||||
|
level: -100.0%
|
||||||
|
- servo.detach: test_servo
|
||||||
|
|
||||||
|
output:
|
||||||
|
- platform: ${output_platform}
|
||||||
|
id: servo_output_1
|
||||||
|
pin: ${pin}
|
||||||
|
|
||||||
|
servo:
|
||||||
|
id: test_servo
|
||||||
|
output: servo_output_1
|
||||||
|
restore: true
|
||||||
|
min_level: 4%
|
||||||
|
max_level: 8%
|
@ -1,19 +1,5 @@
|
|||||||
esphome:
|
substitutions:
|
||||||
on_boot:
|
output_platform: ledc
|
||||||
then:
|
pin: GPIO14
|
||||||
- servo.write:
|
|
||||||
id: test_servo
|
|
||||||
level: -100.0%
|
|
||||||
- servo.detach: test_servo
|
|
||||||
|
|
||||||
output:
|
<<: !include common.yaml
|
||||||
- platform: ledc
|
|
||||||
id: servo_output_1
|
|
||||||
pin: 12
|
|
||||||
|
|
||||||
servo:
|
|
||||||
id: test_servo
|
|
||||||
output: servo_output_1
|
|
||||||
restore: true
|
|
||||||
min_level: 4%
|
|
||||||
max_level: 8%
|
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user