mirror of
				https://github.com/esphome/esphome.git
				synced 2025-10-31 15:12:06 +00:00 
			
		
		
		
	Merge branch 'dev' into vornado-ir
This commit is contained in:
		
							
								
								
									
										4
									
								
								.github/workflows/ci-docker.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										4
									
								
								.github/workflows/ci-docker.yml
									
									
									
									
										vendored
									
									
								
							| @@ -46,9 +46,9 @@ jobs: | ||||
|         with: | ||||
|           python-version: "3.9" | ||||
|       - name: Set up Docker Buildx | ||||
|         uses: docker/setup-buildx-action@v3.8.0 | ||||
|         uses: docker/setup-buildx-action@v3.9.0 | ||||
|       - name: Set up QEMU | ||||
|         uses: docker/setup-qemu-action@v3.3.0 | ||||
|         uses: docker/setup-qemu-action@v3.4.0 | ||||
|  | ||||
|       - name: Set TAG | ||||
|         run: | | ||||
|   | ||||
							
								
								
									
										6
									
								
								.github/workflows/release.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										6
									
								
								.github/workflows/release.yml
									
									
									
									
										vendored
									
									
								
							| @@ -89,10 +89,10 @@ jobs: | ||||
|           python-version: "3.9" | ||||
|  | ||||
|       - name: Set up Docker Buildx | ||||
|         uses: docker/setup-buildx-action@v3.8.0 | ||||
|         uses: docker/setup-buildx-action@v3.9.0 | ||||
|       - name: Set up QEMU | ||||
|         if: matrix.platform != 'linux/amd64' | ||||
|         uses: docker/setup-qemu-action@v3.3.0 | ||||
|         uses: docker/setup-qemu-action@v3.4.0 | ||||
|  | ||||
|       - name: Log in to docker hub | ||||
|         uses: docker/login-action@v3.3.0 | ||||
| @@ -183,7 +183,7 @@ jobs: | ||||
|           merge-multiple: true | ||||
|  | ||||
|       - name: Set up Docker Buildx | ||||
|         uses: docker/setup-buildx-action@v3.8.0 | ||||
|         uses: docker/setup-buildx-action@v3.9.0 | ||||
|  | ||||
|       - name: Log in to docker hub | ||||
|         if: matrix.registry == 'dockerhub' | ||||
|   | ||||
| @@ -45,6 +45,6 @@ repos: | ||||
|     hooks: | ||||
|       - id: pylint | ||||
|         name: pylint | ||||
|         entry: python script/run-in-env pylint | ||||
|         entry: python3 script/run-in-env.py pylint | ||||
|         language: system | ||||
|         types: [python] | ||||
|   | ||||
| @@ -242,6 +242,7 @@ esphome/components/lightwaverf/* @max246 | ||||
| esphome/components/lilygo_t5_47/touchscreen/* @jesserockz | ||||
| esphome/components/lock/* @esphome/core | ||||
| esphome/components/logger/* @esphome/core | ||||
| esphome/components/logger/select/* @clydebarrow | ||||
| esphome/components/ltr390/* @latonita @sjtrny | ||||
| esphome/components/ltr501/* @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 :) | ||||
|  - 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) | ||||
|    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. | ||||
| **See also:** | ||||
|  | ||||
| [Documentation](https://esphome.io) -- [Issues](https://github.com/esphome/issues/issues) -- [Feature requests](https://github.com/esphome/feature-requests/issues) | ||||
|  | ||||
| --- | ||||
|  | ||||
| [](https://www.openhomefoundation.org/) | ||||
|   | ||||
| @@ -7,10 +7,10 @@ | ||||
|   </picture> | ||||
| </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/) | ||||
|   | ||||
| @@ -36,6 +36,14 @@ ATTENUATION_MODES = { | ||||
|     "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") | ||||
| 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  // 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 { | ||||
|  public: | ||||
| #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_output_raw(bool output_raw) { this->output_raw_ = output_raw; } | ||||
|   void set_sample_count(uint8_t sample_count); | ||||
|   void set_sampling_mode(SamplingMode sampling_mode); | ||||
|   float sample() override; | ||||
|  | ||||
| #ifdef USE_ESP8266 | ||||
| @@ -68,6 +84,7 @@ class ADCSensor : public sensor::Sensor, public PollingComponent, public voltage | ||||
|   InternalGPIOPin *pin_; | ||||
|   bool output_raw_{false}; | ||||
|   uint8_t sample_count_{1}; | ||||
|   SamplingMode sampling_mode_{SamplingMode::AVG}; | ||||
|  | ||||
| #ifdef USE_RP2040 | ||||
|   bool is_temperature_{false}; | ||||
|   | ||||
| @@ -6,6 +6,59 @@ namespace adc { | ||||
|  | ||||
| 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() { | ||||
|   float value_v = this->sample(); | ||||
|   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; } | ||||
|  | ||||
| }  // namespace adc | ||||
|   | ||||
| @@ -78,12 +78,14 @@ void ADCSensor::dump_config() { | ||||
|     } | ||||
|   } | ||||
|   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); | ||||
| } | ||||
|  | ||||
| float ADCSensor::sample() { | ||||
|   if (!this->autorange_) { | ||||
|     uint32_t sum = 0; | ||||
|     auto aggr = Aggregator(this->sampling_mode_); | ||||
|  | ||||
|     for (uint8_t sample = 0; sample < this->sample_count_; sample++) { | ||||
|       int raw = -1; | ||||
|       if (this->channel1_ != ADC1_CHANNEL_MAX) { | ||||
| @@ -94,13 +96,14 @@ float ADCSensor::sample() { | ||||
|       if (raw == -1) { | ||||
|         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_) { | ||||
|       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; | ||||
|   } | ||||
|  | ||||
|   | ||||
| @@ -31,23 +31,27 @@ void ADCSensor::dump_config() { | ||||
|   LOG_PIN("  Pin: ", this->pin_); | ||||
| #endif  // USE_ADC_SENSOR_VCC | ||||
|   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); | ||||
| } | ||||
|  | ||||
| float ADCSensor::sample() { | ||||
|   uint32_t raw = 0; | ||||
|   auto aggr = Aggregator(this->sampling_mode_); | ||||
|  | ||||
|   for (uint8_t sample = 0; sample < this->sample_count_; sample++) { | ||||
|     uint32_t raw = 0; | ||||
| #ifdef USE_ADC_SENSOR_VCC | ||||
|     raw += ESP.getVcc();  // NOLINT(readability-static-accessed-through-instance) | ||||
|     raw = ESP.getVcc();  // NOLINT(readability-static-accessed-through-instance) | ||||
| #else | ||||
|     raw += analogRead(this->pin_->get_pin());  // NOLINT | ||||
|     raw = analogRead(this->pin_->get_pin());  // NOLINT | ||||
| #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_) { | ||||
|     return raw; | ||||
|     return aggr.aggregate(); | ||||
|   } | ||||
|   return raw / 1024.0f; | ||||
|   return aggr.aggregate() / 1024.0f; | ||||
| } | ||||
|  | ||||
| std::string ADCSensor::unique_id() { return get_mac_address() + "-adc"; } | ||||
|   | ||||
| @@ -23,23 +23,28 @@ void ADCSensor::dump_config() { | ||||
|   LOG_PIN("  Pin: ", this->pin_); | ||||
| #endif  // USE_ADC_SENSOR_VCC | ||||
|   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); | ||||
| } | ||||
|  | ||||
| float ADCSensor::sample() { | ||||
|   uint32_t raw = 0; | ||||
|   auto aggr = Aggregator(this->sampling_mode_); | ||||
|  | ||||
|   if (this->output_raw_) { | ||||
|     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 raw; | ||||
|     return aggr.aggregate(); | ||||
|   } | ||||
|  | ||||
|   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 | ||||
|   | ||||
| @@ -34,24 +34,28 @@ void ADCSensor::dump_config() { | ||||
| #endif  // USE_ADC_SENSOR_VCC | ||||
|   } | ||||
|   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); | ||||
| } | ||||
|  | ||||
| float ADCSensor::sample() { | ||||
|   uint32_t raw = 0; | ||||
|   auto aggr = Aggregator(this->sampling_mode_); | ||||
|  | ||||
|   if (this->is_temperature_) { | ||||
|     adc_set_temp_sensor_enabled(true); | ||||
|     delay(1); | ||||
|     adc_select_input(4); | ||||
|     uint32_t raw = 0; | ||||
|  | ||||
|     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); | ||||
|     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(); | ||||
| @@ -68,11 +72,10 @@ float ADCSensor::sample() { | ||||
|   adc_gpio_init(pin); | ||||
|   adc_select_input(pin - 26); | ||||
|  | ||||
|   uint32_t raw = 0; | ||||
|   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 | ||||
|   if (pin == PICO_VSYS_PIN) { | ||||
| @@ -81,10 +84,10 @@ float ADCSensor::sample() { | ||||
| #endif  // CYW43_USES_VSYS_PIN | ||||
|  | ||||
|   if (this->output_raw_) { | ||||
|     return raw; | ||||
|     return aggr.aggregate(); | ||||
|   } | ||||
|   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 | ||||
|   | ||||
| @@ -1,11 +1,9 @@ | ||||
| import logging | ||||
|  | ||||
| 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.esp32 import get_esp32_variant | ||||
| import esphome.config_validation as cv | ||||
| from esphome.const import ( | ||||
|     CONF_ATTENUATION, | ||||
|     CONF_ID, | ||||
| @@ -17,10 +15,14 @@ from esphome.const import ( | ||||
|     STATE_CLASS_MEASUREMENT, | ||||
|     UNIT_VOLT, | ||||
| ) | ||||
| from esphome.core import CORE | ||||
| import esphome.final_validate as fv | ||||
|  | ||||
| from . import ( | ||||
|     ATTENUATION_MODES, | ||||
|     ESP32_VARIANT_ADC1_PIN_TO_CHANNEL, | ||||
|     ESP32_VARIANT_ADC2_PIN_TO_CHANNEL, | ||||
|     SAMPLING_MODES, | ||||
|     adc_ns, | ||||
|     validate_adc_pin, | ||||
| ) | ||||
| @@ -30,9 +32,11 @@ _LOGGER = logging.getLogger(__name__) | ||||
| AUTO_LOAD = ["voltage_sampler"] | ||||
|  | ||||
| CONF_SAMPLES = "samples" | ||||
| CONF_SAMPLING_MODE = "sampling_mode" | ||||
|  | ||||
|  | ||||
| _attenuation = cv.enum(ATTENUATION_MODES, lower=True) | ||||
| _sampling_mode = cv.enum(SAMPLING_MODES, lower=True) | ||||
|  | ||||
|  | ||||
| def validate_config(config): | ||||
| @@ -88,6 +92,7 @@ CONFIG_SCHEMA = cv.All( | ||||
|                 cv.only_on_esp32, _attenuation | ||||
|             ), | ||||
|             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")), | ||||
| @@ -112,6 +117,7 @@ async def to_code(config): | ||||
|  | ||||
|     cg.add(var.set_output_raw(config[CONF_RAW])) | ||||
|     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 == "auto": | ||||
|   | ||||
| @@ -35,7 +35,7 @@ from esphome.const import ( | ||||
|     PLATFORM_RP2040, | ||||
|     PLATFORM_RTL87XX, | ||||
| ) | ||||
| from esphome.core import CORE, EsphomeError, Lambda, coroutine_with_priority | ||||
| from esphome.core import CORE, Lambda, coroutine_with_priority | ||||
|  | ||||
| CODEOWNERS = ["@esphome/core"] | ||||
| logger_ns = cg.esphome_ns.namespace("logger") | ||||
| @@ -77,6 +77,9 @@ USB_SERIAL_JTAG = "USB_SERIAL_JTAG" | ||||
| USB_CDC = "USB_CDC" | ||||
| DEFAULT = "DEFAULT" | ||||
|  | ||||
| CONF_INITIAL_LEVEL = "initial_level" | ||||
| CONF_LOGGER_ID = "logger_id" | ||||
|  | ||||
| UART_SELECTION_ESP32 = { | ||||
|     VARIANT_ESP32: [UART0, UART1, UART2], | ||||
|     VARIANT_ESP32S2: [UART0, UART1, USB_CDC], | ||||
| @@ -154,11 +157,11 @@ def uart_selection(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(): | ||||
|         if LOG_LEVEL_SEVERITY.index(level) > LOG_LEVEL_SEVERITY.index(global_level): | ||||
|             raise EsphomeError( | ||||
|                 f"The local log level {level} for {tag} must be less severe than the global log level {global_level}." | ||||
|         if LOG_LEVEL_SEVERITY.index(level) > global_level: | ||||
|             raise cv.Invalid( | ||||
|                 f"The configured log level for {tag} ({level}) must be no more severe than the global log level {value[CONF_LEVEL]}." | ||||
|             ) | ||||
|     return value | ||||
|  | ||||
| @@ -209,6 +212,7 @@ CONFIG_SCHEMA = cv.All( | ||||
|                     cv.string: is_log_level, | ||||
|                 } | ||||
|             ), | ||||
|             cv.Optional(CONF_INITIAL_LEVEL): is_log_level, | ||||
|             cv.Optional(CONF_ON_MESSAGE): automation.validate_automation( | ||||
|                 { | ||||
|                     cv.GenerateID(CONF_TRIGGER_ID): cv.declare_id(LoggerMessageTrigger), | ||||
| @@ -227,7 +231,14 @@ CONFIG_SCHEMA = cv.All( | ||||
| @coroutine_with_priority(90.0) | ||||
| async def to_code(config): | ||||
|     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: | ||||
|         cg.add( | ||||
|             log.set_uart_selection( | ||||
| @@ -239,7 +250,6 @@ async def to_code(config): | ||||
|     for tag, level in config[CONF_LOGS].items(): | ||||
|         cg.add(log.set_log_level(tag, LOG_LEVELS[level])) | ||||
|  | ||||
|     level = config[CONF_LEVEL] | ||||
|     cg.add_define("USE_LOGGER") | ||||
|     this_severity = LOG_LEVEL_SEVERITY.index(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) | ||||
|     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 | ||||
|   // could be sorted to minimize lookup times. This feature isn't used that | ||||
|   // much anyway so it doesn't matter too much. | ||||
|   for (auto &it : this->log_levels_) { | ||||
|     if (it.tag == tag) { | ||||
|       return it.level; | ||||
|     } | ||||
|   } | ||||
|   return ESPHOME_LOG_LEVEL; | ||||
|   if (this->log_levels_.count(tag) != 0) | ||||
|     return this->log_levels_[tag]; | ||||
|   return this->current_level_; | ||||
| } | ||||
|  | ||||
| void HOT Logger::log_message_(int level, const char *tag, int offset) { | ||||
| @@ -167,9 +164,7 @@ void Logger::loop() { | ||||
| #endif | ||||
|  | ||||
| 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) { | ||||
|   this->log_levels_.push_back(LogLevelOverride{tag, log_level}); | ||||
| } | ||||
| void Logger::set_log_level(const std::string &tag, int log_level) { this->log_levels_[tag] = log_level; } | ||||
|  | ||||
| #if defined(USE_ESP32) || defined(USE_ESP8266) || defined(USE_RP2040) || defined(USE_LIBRETINY) | ||||
| 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() { | ||||
|   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 | ||||
|   ESP_LOGCONFIG(TAG, "  Log Baud Rate: %" PRIu32, this->baud_rate_); | ||||
|   ESP_LOGCONFIG(TAG, "  Hardware UART: %s", get_uart_selection_()); | ||||
| #endif | ||||
|  | ||||
|   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::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) | ||||
|  | ||||
| }  // namespace logger | ||||
|   | ||||
| @@ -1,11 +1,12 @@ | ||||
| #pragma once | ||||
|  | ||||
| #include <cstdarg> | ||||
| #include <vector> | ||||
| #include <map> | ||||
| #include "esphome/core/automation.h" | ||||
| #include "esphome/core/component.h" | ||||
| #include "esphome/core/defines.h" | ||||
| #include "esphome/core/helpers.h" | ||||
| #include "esphome/core/log.h" | ||||
|  | ||||
| #ifdef USE_ARDUINO | ||||
| #if defined(USE_ESP8266) || defined(USE_ESP32) | ||||
| @@ -74,8 +75,11 @@ class Logger : public Component { | ||||
|   UARTSelection get_uart() const; | ||||
| #endif | ||||
|  | ||||
|   /// Set the default log level for this logger. | ||||
|   void set_log_level(int level); | ||||
|   /// Set the log level of the specified tag. | ||||
|   void set_log_level(const std::string &tag, int log_level); | ||||
|   int get_log_level() { return this->current_level_; } | ||||
|  | ||||
|   // ========== INTERNAL METHODS ========== | ||||
|   // (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 | ||||
|   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; | ||||
|  | ||||
|   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 | ||||
|   uart_port_t uart_num_; | ||||
| #endif | ||||
|   struct LogLevelOverride { | ||||
|     std::string tag; | ||||
|     int level; | ||||
|   }; | ||||
|   std::vector<LogLevelOverride> log_levels_; | ||||
|   std::map<std::string, int> log_levels_{}; | ||||
|   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. | ||||
|   bool recursion_guard_ = false; | ||||
|   void *main_task_ = nullptr; | ||||
|   CallbackManager<void(int)> level_callback_{}; | ||||
| }; | ||||
|  | ||||
| extern Logger *global_logger;  // NOLINT(cppcoreguidelines-avoid-non-const-global-variables) | ||||
|  | ||||
| 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): | ||||
|         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): | ||||
|   | ||||
| @@ -100,7 +100,35 @@ void OnlineImage::update() { | ||||
|   } | ||||
|   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) { | ||||
|     ESP_LOGE(TAG, "Download failed."); | ||||
|   | ||||
| @@ -1,41 +1,41 @@ | ||||
| import esphome.codegen as cg | ||||
| import esphome.config_validation as cv | ||||
| from esphome import automation | ||||
| import esphome.codegen as cg | ||||
| from esphome.components import binary_sensor | ||||
| import esphome.config_validation as cv | ||||
| from esphome.const import ( | ||||
|     CONF_ADDRESS, | ||||
|     CONF_BUTTON, | ||||
|     CONF_CARRIER_FREQUENCY, | ||||
|     CONF_CHANNEL, | ||||
|     CONF_CHECK, | ||||
|     CONF_CODE, | ||||
|     CONF_COMMAND, | ||||
|     CONF_COMMAND_REPEATS, | ||||
|     CONF_DATA, | ||||
|     CONF_TRIGGER_ID, | ||||
|     CONF_NBITS, | ||||
|     CONF_ADDRESS, | ||||
|     CONF_COMMAND, | ||||
|     CONF_CODE, | ||||
|     CONF_PULSE_LENGTH, | ||||
|     CONF_SYNC, | ||||
|     CONF_ZERO, | ||||
|     CONF_ONE, | ||||
|     CONF_INVERTED, | ||||
|     CONF_PROTOCOL, | ||||
|     CONF_GROUP, | ||||
|     CONF_DELTA, | ||||
|     CONF_DEVICE, | ||||
|     CONF_SECOND, | ||||
|     CONF_STATE, | ||||
|     CONF_CHANNEL, | ||||
|     CONF_FAMILY, | ||||
|     CONF_REPEAT, | ||||
|     CONF_WAIT_TIME, | ||||
|     CONF_TIMES, | ||||
|     CONF_TYPE_ID, | ||||
|     CONF_CARRIER_FREQUENCY, | ||||
|     CONF_GROUP, | ||||
|     CONF_ID, | ||||
|     CONF_INVERTED, | ||||
|     CONF_LEVEL, | ||||
|     CONF_MAGNITUDE, | ||||
|     CONF_NBITS, | ||||
|     CONF_ONE, | ||||
|     CONF_PROTOCOL, | ||||
|     CONF_PULSE_LENGTH, | ||||
|     CONF_RC_CODE_1, | ||||
|     CONF_RC_CODE_2, | ||||
|     CONF_MAGNITUDE, | ||||
|     CONF_REPEAT, | ||||
|     CONF_SECOND, | ||||
|     CONF_STATE, | ||||
|     CONF_SYNC, | ||||
|     CONF_TIMES, | ||||
|     CONF_TRIGGER_ID, | ||||
|     CONF_TYPE_ID, | ||||
|     CONF_WAIT_TIME, | ||||
|     CONF_WAND_ID, | ||||
|     CONF_LEVEL, | ||||
|     CONF_DELTA, | ||||
|     CONF_ID, | ||||
|     CONF_BUTTON, | ||||
|     CONF_CHECK, | ||||
|     CONF_ZERO, | ||||
| ) | ||||
| from esphome.core import coroutine | ||||
| from esphome.schema_extractors import SCHEMA_EXTRACT, schema_extractor | ||||
| @@ -1963,3 +1963,55 @@ async def mirage_action(var, config, args): | ||||
|     vec_ = cg.std_vector.template(cg.uint8) | ||||
|     template_ = await cg.templatable(config[CONF_CODE], args, vec_, vec_) | ||||
|     cg.add(var.set_code(template_)) | ||||
|  | ||||
|  | ||||
| # Toto | ||||
| ( | ||||
|     TotoData, | ||||
|     TotoBinarySensor, | ||||
|     TotoTrigger, | ||||
|     TotoAction, | ||||
|     TotoDumper, | ||||
| ) = declare_protocol("Toto") | ||||
|  | ||||
| TOTO_SCHEMA = cv.Schema( | ||||
|     { | ||||
|         cv.Optional(CONF_RC_CODE_1, default=0): cv.hex_int_range(0, 0xF), | ||||
|         cv.Optional(CONF_RC_CODE_2, default=0): cv.hex_int_range(0, 0xF), | ||||
|         cv.Required(CONF_COMMAND): cv.hex_uint8_t, | ||||
|     } | ||||
| ) | ||||
|  | ||||
|  | ||||
| @register_binary_sensor("toto", TotoBinarySensor, TOTO_SCHEMA) | ||||
| def toto_binary_sensor(var, config): | ||||
|     cg.add( | ||||
|         var.set_data( | ||||
|             cg.StructInitializer( | ||||
|                 TotoData, | ||||
|                 ("rc_code_1", config[CONF_RC_CODE_1]), | ||||
|                 ("rc_code_2", config[CONF_RC_CODE_2]), | ||||
|                 ("command", config[CONF_COMMAND]), | ||||
|             ) | ||||
|         ) | ||||
|     ) | ||||
|  | ||||
|  | ||||
| @register_trigger("toto", TotoTrigger, TotoData) | ||||
| def toto_trigger(var, config): | ||||
|     pass | ||||
|  | ||||
|  | ||||
| @register_dumper("toto", TotoDumper) | ||||
| def toto_dumper(var, config): | ||||
|     pass | ||||
|  | ||||
|  | ||||
| @register_action("toto", TotoAction, TOTO_SCHEMA) | ||||
| async def Toto_action(var, config, args): | ||||
|     template_ = await cg.templatable(config[CONF_RC_CODE_1], args, cg.uint8) | ||||
|     cg.add(var.set_rc_code_1(template_)) | ||||
|     template_ = await cg.templatable(config[CONF_RC_CODE_2], args, cg.uint8) | ||||
|     cg.add(var.set_rc_code_2(template_)) | ||||
|     template_ = await cg.templatable(config[CONF_COMMAND], args, cg.uint8) | ||||
|     cg.add(var.set_command(template_)) | ||||
|   | ||||
							
								
								
									
										100
									
								
								esphome/components/remote_base/toto_protocol.cpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										100
									
								
								esphome/components/remote_base/toto_protocol.cpp
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,100 @@ | ||||
| #include "toto_protocol.h" | ||||
| #include "esphome/core/log.h" | ||||
|  | ||||
| namespace esphome { | ||||
| namespace remote_base { | ||||
|  | ||||
| static const char *const TAG = "remote.toto"; | ||||
|  | ||||
| static const uint32_t PREAMBLE_HIGH_US = 6200; | ||||
| static const uint32_t PREAMBLE_LOW_US = 2800; | ||||
| static const uint32_t BIT_HIGH_US = 550; | ||||
| static const uint32_t BIT_ONE_LOW_US = 1700; | ||||
| static const uint32_t BIT_ZERO_LOW_US = 550; | ||||
| static const uint32_t TOTO_HEADER = 0x2008; | ||||
|  | ||||
| void TotoProtocol::encode(RemoteTransmitData *dst, const TotoData &data) { | ||||
|   uint32_t payload = 0; | ||||
|  | ||||
|   payload = data.rc_code_1 << 20; | ||||
|   payload |= data.rc_code_2 << 16; | ||||
|   payload |= data.command << 8; | ||||
|   payload |= ((payload & 0xFF0000) >> 16) ^ ((payload & 0x00FF00) >> 8); | ||||
|  | ||||
|   dst->reserve(80); | ||||
|   dst->set_carrier_frequency(38000); | ||||
|   dst->item(PREAMBLE_HIGH_US, PREAMBLE_LOW_US); | ||||
|  | ||||
|   for (uint32_t mask = 1UL << 14; mask; mask >>= 1) { | ||||
|     if (TOTO_HEADER & mask) { | ||||
|       dst->item(BIT_HIGH_US, BIT_ONE_LOW_US); | ||||
|     } else { | ||||
|       dst->item(BIT_HIGH_US, BIT_ZERO_LOW_US); | ||||
|     } | ||||
|   } | ||||
|  | ||||
|   for (uint32_t mask = 1UL << 23; mask; mask >>= 1) { | ||||
|     if (payload & mask) { | ||||
|       dst->item(BIT_HIGH_US, BIT_ONE_LOW_US); | ||||
|     } else { | ||||
|       dst->item(BIT_HIGH_US, BIT_ZERO_LOW_US); | ||||
|     } | ||||
|   } | ||||
|  | ||||
|   dst->mark(BIT_HIGH_US); | ||||
| } | ||||
| optional<TotoData> TotoProtocol::decode(RemoteReceiveData src) { | ||||
|   uint16_t header = 0; | ||||
|   uint32_t payload = 0; | ||||
|  | ||||
|   TotoData data{ | ||||
|       .rc_code_1 = 0, | ||||
|       .rc_code_2 = 0, | ||||
|       .command = 0, | ||||
|   }; | ||||
|  | ||||
|   if (!src.expect_item(PREAMBLE_HIGH_US, PREAMBLE_LOW_US)) { | ||||
|     return {}; | ||||
|   } | ||||
|  | ||||
|   for (uint32_t mask = 1UL << 14; mask; mask >>= 1) { | ||||
|     if (src.expect_item(BIT_HIGH_US, BIT_ONE_LOW_US)) { | ||||
|       header |= mask; | ||||
|     } else if (src.expect_item(BIT_HIGH_US, BIT_ZERO_LOW_US)) { | ||||
|       header &= ~mask; | ||||
|     } else { | ||||
|       return {}; | ||||
|     } | ||||
|   } | ||||
|  | ||||
|   if (header != TOTO_HEADER) { | ||||
|     return {}; | ||||
|   } | ||||
|  | ||||
|   for (uint32_t mask = 1UL << 23; mask; mask >>= 1) { | ||||
|     if (src.expect_item(BIT_HIGH_US, BIT_ONE_LOW_US)) { | ||||
|       payload |= mask; | ||||
|     } else if (src.expect_item(BIT_HIGH_US, BIT_ZERO_LOW_US)) { | ||||
|       payload &= ~mask; | ||||
|     } else { | ||||
|       return {}; | ||||
|     } | ||||
|   } | ||||
|  | ||||
|   if ((((payload & 0xFF0000) >> 16) ^ ((payload & 0x00FF00) >> 8)) != (payload & 0x0000FF)) { | ||||
|     return {}; | ||||
|   } | ||||
|  | ||||
|   data.rc_code_1 = (payload & 0xF00000) >> 20; | ||||
|   data.rc_code_2 = (payload & 0x0F0000) >> 16; | ||||
|   data.command = (payload & 0x00FF00) >> 8; | ||||
|  | ||||
|   return data; | ||||
| } | ||||
| void TotoProtocol::dump(const TotoData &data) { | ||||
|   ESP_LOGI(TAG, "Received Toto data: rc_code_1=0x%01X, rc_code_2=0x%01X, command=0x%02X", data.rc_code_1, | ||||
|            data.rc_code_2, data.command); | ||||
| } | ||||
|  | ||||
| }  // namespace remote_base | ||||
| }  // namespace esphome | ||||
							
								
								
									
										45
									
								
								esphome/components/remote_base/toto_protocol.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										45
									
								
								esphome/components/remote_base/toto_protocol.h
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,45 @@ | ||||
| #pragma once | ||||
|  | ||||
| #include "remote_base.h" | ||||
|  | ||||
| namespace esphome { | ||||
| namespace remote_base { | ||||
|  | ||||
| struct TotoData { | ||||
|   uint8_t rc_code_1 : 4; | ||||
|   uint8_t rc_code_2 : 4; | ||||
|   uint8_t command; | ||||
|  | ||||
|   bool operator==(const TotoData &rhs) const { | ||||
|     return (rc_code_1 == rhs.rc_code_1) && (rc_code_2 == rhs.rc_code_2) && (command == rhs.command); | ||||
|   } | ||||
| }; | ||||
|  | ||||
| class TotoProtocol : public RemoteProtocol<TotoData> { | ||||
|  public: | ||||
|   void encode(RemoteTransmitData *dst, const TotoData &data) override; | ||||
|   optional<TotoData> decode(RemoteReceiveData src) override; | ||||
|   void dump(const TotoData &data) override; | ||||
| }; | ||||
|  | ||||
| DECLARE_REMOTE_PROTOCOL(Toto) | ||||
|  | ||||
| template<typename... Ts> class TotoAction : public RemoteTransmitterActionBase<Ts...> { | ||||
|  public: | ||||
|   TEMPLATABLE_VALUE(uint8_t, rc_code_1) | ||||
|   TEMPLATABLE_VALUE(uint8_t, rc_code_2) | ||||
|   TEMPLATABLE_VALUE(uint8_t, command) | ||||
|  | ||||
|   void encode(RemoteTransmitData *dst, Ts... x) override { | ||||
|     TotoData data{}; | ||||
|     data.rc_code_1 = this->rc_code_1_.value(x...); | ||||
|     data.rc_code_2 = this->rc_code_2_.value(x...); | ||||
|     data.command = this->command_.value(x...); | ||||
|     this->set_send_times(this->send_times_.value_or(x..., 3)); | ||||
|     this->set_send_wait(this->send_wait_.value_or(x..., 32000)); | ||||
|     TotoProtocol().encode(dst, data); | ||||
|   } | ||||
| }; | ||||
|  | ||||
| }  // namespace remote_base | ||||
| }  // namespace esphome | ||||
| @@ -2,6 +2,7 @@ | ||||
| #include "esphome/core/log.h" | ||||
|  | ||||
| #ifdef USE_ESP32 | ||||
| #include <driver/gpio.h> | ||||
|  | ||||
| namespace esphome { | ||||
| namespace remote_receiver { | ||||
| @@ -62,6 +63,11 @@ void RemoteReceiverComponent::setup() { | ||||
|     this->mark_failed(); | ||||
|     return; | ||||
|   } | ||||
|   if (this->pin_->get_flags() & gpio::FLAG_PULLUP) { | ||||
|     gpio_pullup_en(gpio_num_t(this->pin_->get_pin())); | ||||
|   } else { | ||||
|     gpio_pullup_dis(gpio_num_t(this->pin_->get_pin())); | ||||
|   } | ||||
|   error = rmt_enable(this->channel_); | ||||
|   if (error != ESP_OK) { | ||||
|     this->error_code_ = error; | ||||
|   | ||||
| @@ -8,6 +8,8 @@ from esphome.const import ( | ||||
|     CONF_CLOCK_RESOLUTION, | ||||
|     CONF_ID, | ||||
|     CONF_INVERTED, | ||||
|     CONF_MODE, | ||||
|     CONF_OPEN_DRAIN, | ||||
|     CONF_PIN, | ||||
|     CONF_RMT_CHANNEL, | ||||
|     CONF_RMT_SYMBOLS, | ||||
| @@ -20,7 +22,6 @@ AUTO_LOAD = ["remote_base"] | ||||
| CONF_EOT_LEVEL = "eot_level" | ||||
| CONF_ON_TRANSMIT = "on_transmit" | ||||
| CONF_ON_COMPLETE = "on_complete" | ||||
| CONF_ONE_WIRE = "one_wire" | ||||
|  | ||||
| remote_transmitter_ns = cg.esphome_ns.namespace("remote_transmitter") | ||||
| RemoteTransmitterComponent = remote_transmitter_ns.class_( | ||||
| @@ -44,7 +45,6 @@ CONFIG_SCHEMA = cv.Schema( | ||||
|             cv.only_on_esp32, cv.only_with_arduino, cv.int_range(min=1, max=255) | ||||
|         ), | ||||
|         cv.Optional(CONF_EOT_LEVEL): cv.All(cv.only_with_esp_idf, cv.boolean), | ||||
|         cv.Optional(CONF_ONE_WIRE): cv.All(cv.only_with_esp_idf, cv.boolean), | ||||
|         cv.Optional(CONF_USE_DMA): cv.All(cv.only_with_esp_idf, cv.boolean), | ||||
|         cv.SplitDefault( | ||||
|             CONF_RMT_SYMBOLS, | ||||
| @@ -74,14 +74,15 @@ async def to_code(config): | ||||
|                 cg.add(var.set_clock_resolution(config[CONF_CLOCK_RESOLUTION])) | ||||
|             if CONF_USE_DMA in config: | ||||
|                 cg.add(var.set_with_dma(config[CONF_USE_DMA])) | ||||
|             if CONF_ONE_WIRE in config: | ||||
|                 cg.add(var.set_one_wire(config[CONF_ONE_WIRE])) | ||||
|             if CONF_EOT_LEVEL in config: | ||||
|                 cg.add(var.set_eot_level(config[CONF_EOT_LEVEL])) | ||||
|             elif CONF_ONE_WIRE in config and config[CONF_ONE_WIRE]: | ||||
|                 cg.add(var.set_eot_level(True)) | ||||
|             elif CONF_INVERTED in config[CONF_PIN] and config[CONF_PIN][CONF_INVERTED]: | ||||
|                 cg.add(var.set_eot_level(True)) | ||||
|             else: | ||||
|                 cg.add( | ||||
|                     var.set_eot_level( | ||||
|                         config[CONF_PIN][CONF_MODE][CONF_OPEN_DRAIN] | ||||
|                         or config[CONF_PIN][CONF_INVERTED] | ||||
|                     ) | ||||
|                 ) | ||||
|         else: | ||||
|             if (rmt_channel := config.get(CONF_RMT_CHANNEL, None)) is not None: | ||||
|                 var = cg.new_Pvariable(config[CONF_ID], pin, rmt_channel) | ||||
|   | ||||
| @@ -40,7 +40,6 @@ class RemoteTransmitterComponent : public remote_base::RemoteTransmitterBase, | ||||
|  | ||||
| #if defined(USE_ESP32) && ESP_IDF_VERSION_MAJOR >= 5 | ||||
|   void set_with_dma(bool with_dma) { this->with_dma_ = with_dma; } | ||||
|   void set_one_wire(bool one_wire) { this->one_wire_ = one_wire; } | ||||
|   void set_eot_level(bool eot_level) { this->eot_level_ = eot_level; } | ||||
|   void digital_write(bool value); | ||||
| #endif | ||||
| @@ -69,7 +68,6 @@ class RemoteTransmitterComponent : public remote_base::RemoteTransmitterBase, | ||||
| #if ESP_IDF_VERSION_MAJOR >= 5 | ||||
|   std::vector<rmt_symbol_word_t> rmt_temp_; | ||||
|   bool with_dma_{false}; | ||||
|   bool one_wire_{false}; | ||||
|   bool eot_level_{false}; | ||||
|   rmt_channel_handle_t channel_{NULL}; | ||||
|   rmt_encoder_handle_t encoder_{NULL}; | ||||
|   | ||||
| @@ -3,6 +3,7 @@ | ||||
| #include "esphome/core/application.h" | ||||
|  | ||||
| #ifdef USE_ESP32 | ||||
| #include <driver/gpio.h> | ||||
|  | ||||
| namespace esphome { | ||||
| namespace remote_transmitter { | ||||
| @@ -18,7 +19,6 @@ void RemoteTransmitterComponent::setup() { | ||||
| void RemoteTransmitterComponent::dump_config() { | ||||
|   ESP_LOGCONFIG(TAG, "Remote Transmitter:"); | ||||
| #if ESP_IDF_VERSION_MAJOR >= 5 | ||||
|   ESP_LOGCONFIG(TAG, "  One wire: %s", this->one_wire_ ? "true" : "false"); | ||||
|   ESP_LOGCONFIG(TAG, "  Clock resolution: %" PRIu32 " hz", this->clock_resolution_); | ||||
|   ESP_LOGCONFIG(TAG, "  RMT symbols: %" PRIu32, this->rmt_symbols_); | ||||
| #else | ||||
| @@ -68,6 +68,7 @@ void RemoteTransmitterComponent::configure_rmt_() { | ||||
|   esp_err_t error; | ||||
|  | ||||
|   if (!this->initialized_) { | ||||
|     bool open_drain = (this->pin_->get_flags() & gpio::FLAG_OPEN_DRAIN) != 0; | ||||
|     rmt_tx_channel_config_t channel; | ||||
|     memset(&channel, 0, sizeof(channel)); | ||||
|     channel.clk_src = RMT_CLK_SRC_DEFAULT; | ||||
| @@ -75,8 +76,8 @@ void RemoteTransmitterComponent::configure_rmt_() { | ||||
|     channel.gpio_num = gpio_num_t(this->pin_->get_pin()); | ||||
|     channel.mem_block_symbols = this->rmt_symbols_; | ||||
|     channel.trans_queue_depth = 1; | ||||
|     channel.flags.io_loop_back = this->one_wire_; | ||||
|     channel.flags.io_od_mode = this->one_wire_; | ||||
|     channel.flags.io_loop_back = open_drain; | ||||
|     channel.flags.io_od_mode = open_drain; | ||||
|     channel.flags.invert_out = 0; | ||||
|     channel.flags.with_dma = this->with_dma_; | ||||
|     channel.intr_priority = 0; | ||||
| @@ -91,6 +92,11 @@ void RemoteTransmitterComponent::configure_rmt_() { | ||||
|       this->mark_failed(); | ||||
|       return; | ||||
|     } | ||||
|     if (this->pin_->get_flags() & gpio::FLAG_PULLUP) { | ||||
|       gpio_pullup_en(gpio_num_t(this->pin_->get_pin())); | ||||
|     } else { | ||||
|       gpio_pullup_dis(gpio_num_t(this->pin_->get_pin())); | ||||
|     } | ||||
|  | ||||
|     rmt_copy_encoder_config_t encoder; | ||||
|     memset(&encoder, 0, sizeof(encoder)); | ||||
| @@ -109,7 +115,7 @@ void RemoteTransmitterComponent::configure_rmt_() { | ||||
|       this->mark_failed(); | ||||
|       return; | ||||
|     } | ||||
|     this->digital_write(this->one_wire_ || this->inverted_); | ||||
|     this->digital_write(open_drain || this->inverted_); | ||||
|     this->initialized_ = true; | ||||
|   } | ||||
|  | ||||
|   | ||||
| @@ -120,7 +120,7 @@ MODELS = { | ||||
|     "2.13in-ttgo-b74": ("a", WaveshareEPaperTypeAModel.TTGO_EPAPER_2_13_IN_B74), | ||||
|     "2.90in": ("a", WaveshareEPaperTypeAModel.WAVESHARE_EPAPER_2_9_IN), | ||||
|     "2.90inv2": ("a", WaveshareEPaperTypeAModel.WAVESHARE_EPAPER_2_9_IN_V2), | ||||
|     "gdew029t5": ("c", GDEW029T5), | ||||
|     "gdew029t5": ("b", GDEW029T5), | ||||
|     "2.70in": ("b", WaveshareEPaper2P7In), | ||||
|     "2.70in-b": ("b", WaveshareEPaper2P7InB), | ||||
|     "2.70in-bv2": ("b", WaveshareEPaper2P7InBV2), | ||||
| @@ -143,7 +143,7 @@ MODELS = { | ||||
|     "7.50in-hd-b": ("b", WaveshareEPaper7P5InHDB), | ||||
|     "2.13in-ttgo-dke": ("c", WaveshareEPaper2P13InDKE), | ||||
|     "2.13inv3": ("c", WaveshareEPaper2P13InV3), | ||||
|     "1.54in-m5coreink-m09": ("c", GDEW0154M09), | ||||
|     "1.54in-m5coreink-m09": ("b", GDEW0154M09), | ||||
|     "13.3in-k": ("b", WaveshareEPaper13P3InK), | ||||
| } | ||||
|  | ||||
|   | ||||
| @@ -66,7 +66,7 @@ void WiFiComponent::start() { | ||||
|  | ||||
|   this->pref_ = global_preferences->make_preference<wifi::SavedWifiSettings>(hash, true); | ||||
|   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{}; | ||||
|   | ||||
| @@ -14,6 +14,9 @@ | ||||
| #define ESPHOME_PROJECT_VERSION_30 "v2" | ||||
| #define ESPHOME_VARIANT "ESP32" | ||||
|  | ||||
| // logger | ||||
| #define ESPHOME_LOG_LEVEL ESPHOME_LOG_LEVEL_VERY_VERBOSE | ||||
|  | ||||
| // Feature flags | ||||
| #define USE_ALARM_CONTROL_PANEL | ||||
| #define USE_AUDIO_FLAC_SUPPORT | ||||
|   | ||||
| @@ -249,6 +249,9 @@ def perform_ota( | ||||
|         send_check(sock, result, "auth result") | ||||
|         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_encoded = [ | ||||
|         (upload_size >> 24) & 0xFF, | ||||
| @@ -271,8 +274,6 @@ def perform_ota( | ||||
|     # show the actual progress | ||||
|  | ||||
|     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() | ||||
|  | ||||
|     offset = 0 | ||||
|   | ||||
| @@ -42,7 +42,7 @@ lib_deps = | ||||
|     pavlodn/HaierProtocol@0.9.31           ; haier | ||||
|     kikuchan98/pngle@1.0.2                 ; online_image | ||||
|     ; 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 | ||||
|     https://github.com/Sensirion/arduino-gas-index-algorithm.git#3.2.1 ; Sensirion Gas Index Algorithm Arduino Library | ||||
|     lvgl/lvgl@8.4.0                                       ; lvgl | ||||
|   | ||||
| @@ -7,6 +7,13 @@ import sys | ||||
| 
 | ||||
| 
 | ||||
| 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: | ||||
|         # Get the top-level directory of the git repository | ||||
|         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.", | ||||
|             file=sys.stderr, | ||||
|         ) | ||||
|         sys.exit(1) | ||||
|         return | ||||
| 
 | ||||
|     # Check for virtual environments | ||||
|     for venv in ["venv", ".venv", "."]: | ||||
| @@ -29,25 +36,26 @@ def find_and_activate_virtualenv(): | ||||
|         ) | ||||
|         if activate_path.exists(): | ||||
|             # Activate the virtual environment by updating PATH | ||||
|             env = os.environ.copy() | ||||
|             venv_bin_dir = activate_path.parent | ||||
|             env["PATH"] = f"{venv_bin_dir}{os.pathsep}{env['PATH']}" | ||||
|             env["VIRTUAL_ENV"] = str(venv_bin_dir.parent) | ||||
|             os.environ["PATH"] = f"{venv_bin_dir}{os.pathsep}{os.environ['PATH']}" | ||||
|             os.environ["VIRTUAL_ENV"] = str(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 | ||||
| 
 | ||||
|     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__": | ||||
|     find_and_activate_virtualenv() | ||||
|     run_command() | ||||
| @@ -10,5 +10,6 @@ sensor: | ||||
|     pin: A0 | ||||
|     id: s_1 | ||||
|     name: test s1 | ||||
|     sampling_mode: min | ||||
|     update_interval: 60s | ||||
|     device_class: voltage | ||||
|   | ||||
| @@ -1,7 +1,17 @@ | ||||
| esphome: | ||||
|   on_boot: | ||||
|     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: | ||||
|   id: logger_id | ||||
|   level: DEBUG | ||||
|   initial_level: INFO | ||||
|  | ||||
| select: | ||||
|   - platform: logger | ||||
|     name: Logger Level | ||||
|   | ||||
| @@ -142,3 +142,8 @@ on_mirage: | ||||
|   then: | ||||
|     - lambda: |- | ||||
|         ESP_LOGD("mirage", "Mirage data: %s", format_hex(x.data).c_str()); | ||||
| on_toto: | ||||
|   then: | ||||
|     - logger.log: | ||||
|         format: "on_toto: %u %u %u" | ||||
|         args: ["x.rc_code_1", "x.rc_code_2", "x.command"] | ||||
|   | ||||
| @@ -190,3 +190,10 @@ button: | ||||
|         channel: 1 | ||||
|         button: 1 | ||||
|         check: 1 | ||||
|   - platform: template | ||||
|     name: Toto | ||||
|     on_press: | ||||
|       - remote_transmitter.transmit_toto: | ||||
|           command: 0xEC | ||||
|           rc_code_1: 0x0D | ||||
|           rc_code_2: 0x0D | ||||
|   | ||||
| @@ -3,7 +3,6 @@ remote_transmitter: | ||||
|     pin: ${pin} | ||||
|     carrier_duty_percent: 50% | ||||
|     clock_resolution: ${clock_resolution} | ||||
|     one_wire: ${one_wire} | ||||
|     rmt_symbols: ${rmt_symbols} | ||||
|     use_dma: ${use_dma} | ||||
|  | ||||
|   | ||||
| @@ -1,7 +1,6 @@ | ||||
| substitutions: | ||||
|   pin: GPIO2 | ||||
|   clock_resolution: "2000000" | ||||
|   one_wire: "true" | ||||
|   rmt_symbols: "64" | ||||
|   use_dma: "true" | ||||
|  | ||||
|   | ||||
| @@ -1,7 +1,6 @@ | ||||
| substitutions: | ||||
|   pin: GPIO2 | ||||
|   clock_resolution: "2000000" | ||||
|   one_wire: "true" | ||||
|   rmt_symbols: "64" | ||||
|   use_dma: "true" | ||||
|  | ||||
|   | ||||
| @@ -1,7 +1,6 @@ | ||||
| substitutions: | ||||
|   pin: GPIO38 | ||||
|   clock_resolution: "2000000" | ||||
|   one_wire: "true" | ||||
|   rmt_symbols: "64" | ||||
|   use_dma: "true" | ||||
|  | ||||
|   | ||||
							
								
								
									
										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: | ||||
|   - id: i2c_scd30 | ||||
|     scl: 16 | ||||
|     sda: 17 | ||||
| substitutions: | ||||
|   scl_pin: GPIO16 | ||||
|   sda_pin: GPIO17 | ||||
|  | ||||
| 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 | ||||
| <<: !include common.yaml | ||||
|   | ||||
| @@ -1,20 +1,5 @@ | ||||
| i2c: | ||||
|   - id: i2c_scd30 | ||||
|     scl: 5 | ||||
|     sda: 4 | ||||
| substitutions: | ||||
|   scl_pin: GPIO5 | ||||
|   sda_pin: GPIO4 | ||||
|  | ||||
| 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 | ||||
| <<: !include common.yaml | ||||
|   | ||||
| @@ -1,20 +1,5 @@ | ||||
| i2c: | ||||
|   - id: i2c_scd30 | ||||
|     scl: 5 | ||||
|     sda: 4 | ||||
| substitutions: | ||||
|   scl_pin: GPIO5 | ||||
|   sda_pin: GPIO4 | ||||
|  | ||||
| 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 | ||||
| <<: !include common.yaml | ||||
|   | ||||
| @@ -1,20 +1,5 @@ | ||||
| i2c: | ||||
|   - id: i2c_scd30 | ||||
|     scl: 16 | ||||
|     sda: 17 | ||||
| substitutions: | ||||
|   scl_pin: GPIO16 | ||||
|   sda_pin: GPIO17 | ||||
|  | ||||
| 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 | ||||
| <<: !include common.yaml | ||||
|   | ||||
| @@ -1,20 +1,5 @@ | ||||
| i2c: | ||||
|   - id: i2c_scd30 | ||||
|     scl: 5 | ||||
|     sda: 4 | ||||
| substitutions: | ||||
|   scl_pin: GPIO5 | ||||
|   sda_pin: GPIO4 | ||||
|  | ||||
| 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 | ||||
| <<: !include common.yaml | ||||
|   | ||||
| @@ -1,20 +1,5 @@ | ||||
| i2c: | ||||
|   - id: i2c_scd30 | ||||
|     scl: 5 | ||||
|     sda: 4 | ||||
| substitutions: | ||||
|   scl_pin: GPIO5 | ||||
|   sda_pin: GPIO4 | ||||
|  | ||||
| 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 | ||||
| <<: !include common.yaml | ||||
|   | ||||
							
								
								
									
										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: | ||||
|   - id: i2c_scd4x | ||||
|     scl: 16 | ||||
|     sda: 17 | ||||
| substitutions: | ||||
|   scl_pin: GPIO16 | ||||
|   sda_pin: GPIO17 | ||||
|  | ||||
| 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 | ||||
| <<: !include common.yaml | ||||
|   | ||||
| @@ -1,20 +1,5 @@ | ||||
| i2c: | ||||
|   - id: i2c_scd4x | ||||
|     scl: 5 | ||||
|     sda: 4 | ||||
| substitutions: | ||||
|   scl_pin: GPIO5 | ||||
|   sda_pin: GPIO4 | ||||
|  | ||||
| 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 | ||||
| <<: !include common.yaml | ||||
|   | ||||
| @@ -1,20 +1,5 @@ | ||||
| i2c: | ||||
|   - id: i2c_scd4x | ||||
|     scl: 5 | ||||
|     sda: 4 | ||||
| substitutions: | ||||
|   scl_pin: GPIO5 | ||||
|   sda_pin: GPIO4 | ||||
|  | ||||
| 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 | ||||
| <<: !include common.yaml | ||||
|   | ||||
| @@ -1,20 +1,5 @@ | ||||
| i2c: | ||||
|   - id: i2c_scd4x | ||||
|     scl: 16 | ||||
|     sda: 17 | ||||
| substitutions: | ||||
|   scl_pin: GPIO16 | ||||
|   sda_pin: GPIO17 | ||||
|  | ||||
| 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 | ||||
| <<: !include common.yaml | ||||
|   | ||||
| @@ -1,20 +1,5 @@ | ||||
| i2c: | ||||
|   - id: i2c_scd4x | ||||
|     scl: 5 | ||||
|     sda: 4 | ||||
| substitutions: | ||||
|   scl_pin: GPIO5 | ||||
|   sda_pin: GPIO4 | ||||
|  | ||||
| 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 | ||||
| <<: !include common.yaml | ||||
|   | ||||
| @@ -1,20 +1,5 @@ | ||||
| i2c: | ||||
|   - id: i2c_scd4x | ||||
|     scl: 5 | ||||
|     sda: 4 | ||||
| substitutions: | ||||
|   scl_pin: GPIO5 | ||||
|   sda_pin: GPIO4 | ||||
|  | ||||
| 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 | ||||
| <<: !include common.yaml | ||||
|   | ||||
							
								
								
									
										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: | ||||
|   - id: uart_sdm_meter | ||||
|     tx_pin: 17 | ||||
|     rx_pin: 16 | ||||
|     baud_rate: 9600 | ||||
| substitutions: | ||||
|   tx_pin: GPIO17 | ||||
|   rx_pin: GPIO16 | ||||
|  | ||||
| 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 | ||||
| <<: !include common.yaml | ||||
|   | ||||
| @@ -1,23 +1,5 @@ | ||||
| uart: | ||||
|   - id: uart_sdm_meter | ||||
|     tx_pin: 4 | ||||
|     rx_pin: 5 | ||||
|     baud_rate: 9600 | ||||
| substitutions: | ||||
|   tx_pin: GPIO4 | ||||
|   rx_pin: GPIO5 | ||||
|  | ||||
| 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 | ||||
| <<: !include common.yaml | ||||
|   | ||||
| @@ -1,23 +1,5 @@ | ||||
| uart: | ||||
|   - id: uart_sdm_meter | ||||
|     tx_pin: 4 | ||||
|     rx_pin: 5 | ||||
|     baud_rate: 9600 | ||||
| substitutions: | ||||
|   tx_pin: GPIO4 | ||||
|   rx_pin: GPIO5 | ||||
|  | ||||
| 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 | ||||
| <<: !include common.yaml | ||||
|   | ||||
| @@ -1,23 +1,5 @@ | ||||
| uart: | ||||
|   - id: uart_sdm_meter | ||||
|     tx_pin: 17 | ||||
|     rx_pin: 16 | ||||
|     baud_rate: 9600 | ||||
| substitutions: | ||||
|   tx_pin: GPIO17 | ||||
|   rx_pin: GPIO16 | ||||
|  | ||||
| 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 | ||||
| <<: !include common.yaml | ||||
|   | ||||
| @@ -1,23 +1,5 @@ | ||||
| uart: | ||||
|   - id: uart_sdm_meter | ||||
|     tx_pin: 4 | ||||
|     rx_pin: 5 | ||||
|     baud_rate: 9600 | ||||
| substitutions: | ||||
|   tx_pin: GPIO4 | ||||
|   rx_pin: GPIO5 | ||||
|  | ||||
| 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 | ||||
| <<: !include common.yaml | ||||
|   | ||||
| @@ -1,23 +1,5 @@ | ||||
| uart: | ||||
|   - id: uart_sdm_meter | ||||
|     tx_pin: 4 | ||||
|     rx_pin: 5 | ||||
|     baud_rate: 9600 | ||||
| substitutions: | ||||
|   tx_pin: GPIO4 | ||||
|   rx_pin: GPIO5 | ||||
|  | ||||
| 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 | ||||
| <<: !include common.yaml | ||||
|   | ||||
							
								
								
									
										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: | ||||
|   - id: i2c_sdp3x | ||||
|     scl: 16 | ||||
|     sda: 17 | ||||
| substitutions: | ||||
|   scl_pin: GPIO16 | ||||
|   sda_pin: GPIO17 | ||||
|  | ||||
| sensor: | ||||
|   - platform: sdp3x | ||||
|     id: filter_pressure | ||||
|     name: HVAC Filter Pressure drop | ||||
|     accuracy_decimals: 3 | ||||
|     update_interval: 5s | ||||
| <<: !include common.yaml | ||||
|   | ||||
| @@ -1,11 +1,5 @@ | ||||
| i2c: | ||||
|   - id: i2c_sdp3x | ||||
|     scl: 5 | ||||
|     sda: 4 | ||||
| substitutions: | ||||
|   scl_pin: GPIO5 | ||||
|   sda_pin: GPIO4 | ||||
|  | ||||
| sensor: | ||||
|   - platform: sdp3x | ||||
|     id: filter_pressure | ||||
|     name: HVAC Filter Pressure drop | ||||
|     accuracy_decimals: 3 | ||||
|     update_interval: 5s | ||||
| <<: !include common.yaml | ||||
|   | ||||
| @@ -1,11 +1,5 @@ | ||||
| i2c: | ||||
|   - id: i2c_sdp3x | ||||
|     scl: 5 | ||||
|     sda: 4 | ||||
| substitutions: | ||||
|   scl_pin: GPIO5 | ||||
|   sda_pin: GPIO4 | ||||
|  | ||||
| sensor: | ||||
|   - platform: sdp3x | ||||
|     id: filter_pressure | ||||
|     name: HVAC Filter Pressure drop | ||||
|     accuracy_decimals: 3 | ||||
|     update_interval: 5s | ||||
| <<: !include common.yaml | ||||
|   | ||||
| @@ -1,11 +1,5 @@ | ||||
| i2c: | ||||
|   - id: i2c_sdp3x | ||||
|     scl: 16 | ||||
|     sda: 17 | ||||
| substitutions: | ||||
|   scl_pin: GPIO16 | ||||
|   sda_pin: GPIO17 | ||||
|  | ||||
| sensor: | ||||
|   - platform: sdp3x | ||||
|     id: filter_pressure | ||||
|     name: HVAC Filter Pressure drop | ||||
|     accuracy_decimals: 3 | ||||
|     update_interval: 5s | ||||
| <<: !include common.yaml | ||||
|   | ||||
| @@ -1,11 +1,5 @@ | ||||
| i2c: | ||||
|   - id: i2c_sdp3x | ||||
|     scl: 5 | ||||
|     sda: 4 | ||||
| substitutions: | ||||
|   scl_pin: GPIO5 | ||||
|   sda_pin: GPIO4 | ||||
|  | ||||
| sensor: | ||||
|   - platform: sdp3x | ||||
|     id: filter_pressure | ||||
|     name: HVAC Filter Pressure drop | ||||
|     accuracy_decimals: 3 | ||||
|     update_interval: 5s | ||||
| <<: !include common.yaml | ||||
|   | ||||
| @@ -1,11 +1,5 @@ | ||||
| i2c: | ||||
|   - id: i2c_sdp3x | ||||
|     scl: 5 | ||||
|     sda: 4 | ||||
| substitutions: | ||||
|   scl_pin: GPIO5 | ||||
|   sda_pin: GPIO4 | ||||
|  | ||||
| sensor: | ||||
|   - platform: sdp3x | ||||
|     id: filter_pressure | ||||
|     name: HVAC Filter Pressure drop | ||||
|     accuracy_decimals: 3 | ||||
|     update_interval: 5s | ||||
| <<: !include common.yaml | ||||
|   | ||||
							
								
								
									
										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: | ||||
|   - id: uart_sdm_sds011 | ||||
|     tx_pin: 17 | ||||
|     rx_pin: 16 | ||||
|     baud_rate: 115200 | ||||
| substitutions: | ||||
|   tx_pin: GPIO17 | ||||
|   rx_pin: GPIO16 | ||||
|  | ||||
| sensor: | ||||
|   - platform: sds011 | ||||
|     pm_2_5: | ||||
|       name: SDS011 PM2.5 | ||||
|     pm_10_0: | ||||
|       name: SDS011 PM10.0 | ||||
|     rx_only: false | ||||
|     update_interval: 5min | ||||
| <<: !include common.yaml | ||||
|   | ||||
| @@ -1,14 +1,5 @@ | ||||
| uart: | ||||
|   - id: uart_sdm_sds011 | ||||
|     tx_pin: 4 | ||||
|     rx_pin: 5 | ||||
|     baud_rate: 115200 | ||||
| substitutions: | ||||
|   tx_pin: GPIO4 | ||||
|   rx_pin: GPIO5 | ||||
|  | ||||
| sensor: | ||||
|   - platform: sds011 | ||||
|     pm_2_5: | ||||
|       name: SDS011 PM2.5 | ||||
|     pm_10_0: | ||||
|       name: SDS011 PM10.0 | ||||
|     rx_only: false | ||||
|     update_interval: 5min | ||||
| <<: !include common.yaml | ||||
|   | ||||
| @@ -1,14 +1,5 @@ | ||||
| uart: | ||||
|   - id: uart_sdm_sds011 | ||||
|     tx_pin: 4 | ||||
|     rx_pin: 5 | ||||
|     baud_rate: 115200 | ||||
| substitutions: | ||||
|   tx_pin: GPIO4 | ||||
|   rx_pin: GPIO5 | ||||
|  | ||||
| sensor: | ||||
|   - platform: sds011 | ||||
|     pm_2_5: | ||||
|       name: SDS011 PM2.5 | ||||
|     pm_10_0: | ||||
|       name: SDS011 PM10.0 | ||||
|     rx_only: false | ||||
|     update_interval: 5min | ||||
| <<: !include common.yaml | ||||
|   | ||||
| @@ -1,14 +1,5 @@ | ||||
| uart: | ||||
|   - id: uart_sdm_sds011 | ||||
|     tx_pin: 17 | ||||
|     rx_pin: 16 | ||||
|     baud_rate: 115200 | ||||
| substitutions: | ||||
|   tx_pin: GPIO17 | ||||
|   rx_pin: GPIO16 | ||||
|  | ||||
| sensor: | ||||
|   - platform: sds011 | ||||
|     pm_2_5: | ||||
|       name: SDS011 PM2.5 | ||||
|     pm_10_0: | ||||
|       name: SDS011 PM10.0 | ||||
|     rx_only: false | ||||
|     update_interval: 5min | ||||
| <<: !include common.yaml | ||||
|   | ||||
| @@ -1,14 +1,5 @@ | ||||
| uart: | ||||
|   - id: uart_sdm_sds011 | ||||
|     tx_pin: 4 | ||||
|     rx_pin: 5 | ||||
|     baud_rate: 115200 | ||||
| substitutions: | ||||
|   tx_pin: GPIO4 | ||||
|   rx_pin: GPIO5 | ||||
|  | ||||
| sensor: | ||||
|   - platform: sds011 | ||||
|     pm_2_5: | ||||
|       name: SDS011 PM2.5 | ||||
|     pm_10_0: | ||||
|       name: SDS011 PM10.0 | ||||
|     rx_only: false | ||||
|     update_interval: 5min | ||||
| <<: !include common.yaml | ||||
|   | ||||
| @@ -1,14 +1,5 @@ | ||||
| uart: | ||||
|   - id: uart_sdm_sds011 | ||||
|     tx_pin: 4 | ||||
|     rx_pin: 5 | ||||
|     baud_rate: 115200 | ||||
| substitutions: | ||||
|   tx_pin: GPIO4 | ||||
|   rx_pin: GPIO5 | ||||
|  | ||||
| sensor: | ||||
|   - platform: sds011 | ||||
|     pm_2_5: | ||||
|       name: SDS011 PM2.5 | ||||
|     pm_10_0: | ||||
|       name: SDS011 PM10.0 | ||||
|     rx_only: false | ||||
|     update_interval: 5min | ||||
| <<: !include common.yaml | ||||
|   | ||||
							
								
								
									
										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: | ||||
|   - id: uart_selec_meter | ||||
|     tx_pin: 17 | ||||
|     rx_pin: 16 | ||||
|     baud_rate: 9600 | ||||
| substitutions: | ||||
|   tx_pin: GPIO17 | ||||
|   rx_pin: GPIO16 | ||||
|  | ||||
| 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 | ||||
| <<: !include common.yaml | ||||
|   | ||||
| @@ -1,45 +1,5 @@ | ||||
| uart: | ||||
|   - id: uart_selec_meter | ||||
|     tx_pin: 4 | ||||
|     rx_pin: 5 | ||||
|     baud_rate: 9600 | ||||
| substitutions: | ||||
|   tx_pin: GPIO4 | ||||
|   rx_pin: GPIO5 | ||||
|  | ||||
| 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 | ||||
| <<: !include common.yaml | ||||
|   | ||||
| @@ -1,45 +1,5 @@ | ||||
| uart: | ||||
|   - id: uart_selec_meter | ||||
|     tx_pin: 4 | ||||
|     rx_pin: 5 | ||||
|     baud_rate: 9600 | ||||
| substitutions: | ||||
|   tx_pin: GPIO4 | ||||
|   rx_pin: GPIO5 | ||||
|  | ||||
| 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 | ||||
| <<: !include common.yaml | ||||
|   | ||||
| @@ -1,45 +1,5 @@ | ||||
| uart: | ||||
|   - id: uart_selec_meter | ||||
|     tx_pin: 17 | ||||
|     rx_pin: 16 | ||||
|     baud_rate: 9600 | ||||
| substitutions: | ||||
|   tx_pin: GPIO17 | ||||
|   rx_pin: GPIO16 | ||||
|  | ||||
| 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 | ||||
| <<: !include common.yaml | ||||
|   | ||||
| @@ -1,45 +1,5 @@ | ||||
| uart: | ||||
|   - id: uart_selec_meter | ||||
|     tx_pin: 4 | ||||
|     rx_pin: 5 | ||||
|     baud_rate: 9600 | ||||
| substitutions: | ||||
|   tx_pin: GPIO4 | ||||
|   rx_pin: GPIO5 | ||||
|  | ||||
| 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 | ||||
| <<: !include common.yaml | ||||
|   | ||||
| @@ -1,45 +1,5 @@ | ||||
| uart: | ||||
|   - id: uart_selec_meter | ||||
|     tx_pin: 4 | ||||
|     rx_pin: 5 | ||||
|     baud_rate: 9600 | ||||
| substitutions: | ||||
|   tx_pin: GPIO4 | ||||
|   rx_pin: GPIO5 | ||||
|  | ||||
| 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 | ||||
| <<: !include common.yaml | ||||
|   | ||||
							
								
								
									
										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: | ||||
|   - id: i2c_sen0321 | ||||
|     scl: 16 | ||||
|     sda: 17 | ||||
| substitutions: | ||||
|   scl_pin: GPIO16 | ||||
|   sda_pin: GPIO17 | ||||
|  | ||||
| sensor: | ||||
|   - platform: sen0321 | ||||
|     name: Workshop Ozone Sensor | ||||
|     id: sen0321_ozone | ||||
|     update_interval: 10s | ||||
| <<: !include common.yaml | ||||
|   | ||||
| @@ -1,10 +1,5 @@ | ||||
| i2c: | ||||
|   - id: i2c_sen0321 | ||||
|     scl: 5 | ||||
|     sda: 4 | ||||
| substitutions: | ||||
|   scl_pin: GPIO5 | ||||
|   sda_pin: GPIO4 | ||||
|  | ||||
| sensor: | ||||
|   - platform: sen0321 | ||||
|     name: Workshop Ozone Sensor | ||||
|     id: sen0321_ozone | ||||
|     update_interval: 10s | ||||
| <<: !include common.yaml | ||||
|   | ||||
| @@ -1,10 +1,5 @@ | ||||
| i2c: | ||||
|   - id: i2c_sen0321 | ||||
|     scl: 5 | ||||
|     sda: 4 | ||||
| substitutions: | ||||
|   scl_pin: GPIO5 | ||||
|   sda_pin: GPIO4 | ||||
|  | ||||
| sensor: | ||||
|   - platform: sen0321 | ||||
|     name: Workshop Ozone Sensor | ||||
|     id: sen0321_ozone | ||||
|     update_interval: 10s | ||||
| <<: !include common.yaml | ||||
|   | ||||
| @@ -1,10 +1,5 @@ | ||||
| i2c: | ||||
|   - id: i2c_sen0321 | ||||
|     scl: 16 | ||||
|     sda: 17 | ||||
| substitutions: | ||||
|   scl_pin: GPIO16 | ||||
|   sda_pin: GPIO17 | ||||
|  | ||||
| sensor: | ||||
|   - platform: sen0321 | ||||
|     name: Workshop Ozone Sensor | ||||
|     id: sen0321_ozone | ||||
|     update_interval: 10s | ||||
| <<: !include common.yaml | ||||
|   | ||||
| @@ -1,10 +1,5 @@ | ||||
| i2c: | ||||
|   - id: i2c_sen0321 | ||||
|     scl: 5 | ||||
|     sda: 4 | ||||
| substitutions: | ||||
|   scl_pin: GPIO5 | ||||
|   sda_pin: GPIO4 | ||||
|  | ||||
| sensor: | ||||
|   - platform: sen0321 | ||||
|     name: Workshop Ozone Sensor | ||||
|     id: sen0321_ozone | ||||
|     update_interval: 10s | ||||
| <<: !include common.yaml | ||||
|   | ||||
| @@ -1,10 +1,5 @@ | ||||
| i2c: | ||||
|   - id: i2c_sen0321 | ||||
|     scl: 5 | ||||
|     sda: 4 | ||||
| substitutions: | ||||
|   scl_pin: GPIO5 | ||||
|   sda_pin: GPIO4 | ||||
|  | ||||
| sensor: | ||||
|   - platform: sen0321 | ||||
|     name: Workshop Ozone Sensor | ||||
|     id: sen0321_ozone | ||||
|     update_interval: 10s | ||||
| <<: !include common.yaml | ||||
|   | ||||
							
								
								
									
										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: | ||||
|   - id: i2c_sen21231 | ||||
|     scl: 16 | ||||
|     sda: 17 | ||||
| substitutions: | ||||
|   scl_pin: GPIO16 | ||||
|   sda_pin: GPIO17 | ||||
|  | ||||
| sensor: | ||||
|   - platform: sen21231 | ||||
|     id: sen21231_sensor1 | ||||
|     name: Person Sensor | ||||
| <<: !include common.yaml | ||||
|   | ||||
| @@ -1,9 +1,5 @@ | ||||
| i2c: | ||||
|   - id: i2c_sen21231 | ||||
|     scl: 5 | ||||
|     sda: 4 | ||||
| substitutions: | ||||
|   scl_pin: GPIO5 | ||||
|   sda_pin: GPIO4 | ||||
|  | ||||
| sensor: | ||||
|   - platform: sen21231 | ||||
|     id: sen21231_sensor1 | ||||
|     name: Person Sensor | ||||
| <<: !include common.yaml | ||||
|   | ||||
| @@ -1,9 +1,5 @@ | ||||
| i2c: | ||||
|   - id: i2c_sen21231 | ||||
|     scl: 5 | ||||
|     sda: 4 | ||||
| substitutions: | ||||
|   scl_pin: GPIO5 | ||||
|   sda_pin: GPIO4 | ||||
|  | ||||
| sensor: | ||||
|   - platform: sen21231 | ||||
|     id: sen21231_sensor1 | ||||
|     name: Person Sensor | ||||
| <<: !include common.yaml | ||||
|   | ||||
| @@ -1,9 +1,5 @@ | ||||
| i2c: | ||||
|   - id: i2c_sen21231 | ||||
|     scl: 16 | ||||
|     sda: 17 | ||||
| substitutions: | ||||
|   scl_pin: GPIO16 | ||||
|   sda_pin: GPIO17 | ||||
|  | ||||
| sensor: | ||||
|   - platform: sen21231 | ||||
|     id: sen21231_sensor1 | ||||
|     name: Person Sensor | ||||
| <<: !include common.yaml | ||||
|   | ||||
| @@ -1,9 +1,5 @@ | ||||
| i2c: | ||||
|   - id: i2c_sen21231 | ||||
|     scl: 5 | ||||
|     sda: 4 | ||||
| substitutions: | ||||
|   scl_pin: GPIO5 | ||||
|   sda_pin: GPIO4 | ||||
|  | ||||
| sensor: | ||||
|   - platform: sen21231 | ||||
|     id: sen21231_sensor1 | ||||
|     name: Person Sensor | ||||
| <<: !include common.yaml | ||||
|   | ||||
| @@ -1,9 +1,5 @@ | ||||
| i2c: | ||||
|   - id: i2c_sen21231 | ||||
|     scl: 5 | ||||
|     sda: 4 | ||||
| substitutions: | ||||
|   scl_pin: GPIO5 | ||||
|   sda_pin: GPIO4 | ||||
|  | ||||
| sensor: | ||||
|   - platform: sen21231 | ||||
|     id: sen21231_sensor1 | ||||
|     name: Person Sensor | ||||
| <<: !include common.yaml | ||||
|   | ||||
							
								
								
									
										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 | ||||
Some files were not shown because too many files have changed in this diff Show More
		Reference in New Issue
	
	Block a user