mirror of
				https://github.com/esphome/esphome.git
				synced 2025-10-31 07:03:55 +00:00 
			
		
		
		
	Merge branch 'dev' into separate-ota-backend
This commit is contained in:
		| @@ -1 +1,108 @@ | ||||
| import esphome.codegen as cg | ||||
| import esphome.config_validation as cv | ||||
| from esphome.components import sensor | ||||
| from esphome.const import ( | ||||
|     CONF_HUMIDITY, | ||||
|     CONF_ID, | ||||
|     CONF_IIR_FILTER, | ||||
|     CONF_OVERSAMPLING, | ||||
|     CONF_PRESSURE, | ||||
|     CONF_TEMPERATURE, | ||||
|     DEVICE_CLASS_HUMIDITY, | ||||
|     DEVICE_CLASS_PRESSURE, | ||||
|     DEVICE_CLASS_TEMPERATURE, | ||||
|     STATE_CLASS_MEASUREMENT, | ||||
|     UNIT_CELSIUS, | ||||
|     UNIT_HECTOPASCAL, | ||||
|     UNIT_PERCENT, | ||||
| ) | ||||
|  | ||||
| CODEOWNERS = ["@esphome/core"] | ||||
|  | ||||
| bme280_ns = cg.esphome_ns.namespace("bme280_base") | ||||
| BME280Oversampling = bme280_ns.enum("BME280Oversampling") | ||||
| OVERSAMPLING_OPTIONS = { | ||||
|     "NONE": BME280Oversampling.BME280_OVERSAMPLING_NONE, | ||||
|     "1X": BME280Oversampling.BME280_OVERSAMPLING_1X, | ||||
|     "2X": BME280Oversampling.BME280_OVERSAMPLING_2X, | ||||
|     "4X": BME280Oversampling.BME280_OVERSAMPLING_4X, | ||||
|     "8X": BME280Oversampling.BME280_OVERSAMPLING_8X, | ||||
|     "16X": BME280Oversampling.BME280_OVERSAMPLING_16X, | ||||
| } | ||||
|  | ||||
| BME280IIRFilter = bme280_ns.enum("BME280IIRFilter") | ||||
| IIR_FILTER_OPTIONS = { | ||||
|     "OFF": BME280IIRFilter.BME280_IIR_FILTER_OFF, | ||||
|     "2X": BME280IIRFilter.BME280_IIR_FILTER_2X, | ||||
|     "4X": BME280IIRFilter.BME280_IIR_FILTER_4X, | ||||
|     "8X": BME280IIRFilter.BME280_IIR_FILTER_8X, | ||||
|     "16X": BME280IIRFilter.BME280_IIR_FILTER_16X, | ||||
| } | ||||
|  | ||||
| CONFIG_SCHEMA_BASE = cv.Schema( | ||||
|     { | ||||
|         cv.Optional(CONF_TEMPERATURE): sensor.sensor_schema( | ||||
|             unit_of_measurement=UNIT_CELSIUS, | ||||
|             accuracy_decimals=1, | ||||
|             device_class=DEVICE_CLASS_TEMPERATURE, | ||||
|             state_class=STATE_CLASS_MEASUREMENT, | ||||
|         ).extend( | ||||
|             { | ||||
|                 cv.Optional(CONF_OVERSAMPLING, default="16X"): cv.enum( | ||||
|                     OVERSAMPLING_OPTIONS, upper=True | ||||
|                 ), | ||||
|             } | ||||
|         ), | ||||
|         cv.Optional(CONF_PRESSURE): sensor.sensor_schema( | ||||
|             unit_of_measurement=UNIT_HECTOPASCAL, | ||||
|             accuracy_decimals=1, | ||||
|             device_class=DEVICE_CLASS_PRESSURE, | ||||
|             state_class=STATE_CLASS_MEASUREMENT, | ||||
|         ).extend( | ||||
|             { | ||||
|                 cv.Optional(CONF_OVERSAMPLING, default="16X"): cv.enum( | ||||
|                     OVERSAMPLING_OPTIONS, upper=True | ||||
|                 ), | ||||
|             } | ||||
|         ), | ||||
|         cv.Optional(CONF_HUMIDITY): sensor.sensor_schema( | ||||
|             unit_of_measurement=UNIT_PERCENT, | ||||
|             accuracy_decimals=1, | ||||
|             device_class=DEVICE_CLASS_HUMIDITY, | ||||
|             state_class=STATE_CLASS_MEASUREMENT, | ||||
|         ).extend( | ||||
|             { | ||||
|                 cv.Optional(CONF_OVERSAMPLING, default="16X"): cv.enum( | ||||
|                     OVERSAMPLING_OPTIONS, upper=True | ||||
|                 ), | ||||
|             } | ||||
|         ), | ||||
|         cv.Optional(CONF_IIR_FILTER, default="OFF"): cv.enum( | ||||
|             IIR_FILTER_OPTIONS, upper=True | ||||
|         ), | ||||
|     } | ||||
| ).extend(cv.polling_component_schema("60s")) | ||||
|  | ||||
|  | ||||
| async def to_code_base(config): | ||||
|     var = cg.new_Pvariable(config[CONF_ID]) | ||||
|     await cg.register_component(var, config) | ||||
|  | ||||
|     if temperature_config := config.get(CONF_TEMPERATURE): | ||||
|         sens = await sensor.new_sensor(temperature_config) | ||||
|         cg.add(var.set_temperature_sensor(sens)) | ||||
|         cg.add(var.set_temperature_oversampling(temperature_config[CONF_OVERSAMPLING])) | ||||
|  | ||||
|     if pressure_config := config.get(CONF_PRESSURE): | ||||
|         sens = await sensor.new_sensor(pressure_config) | ||||
|         cg.add(var.set_pressure_sensor(sens)) | ||||
|         cg.add(var.set_pressure_oversampling(pressure_config[CONF_OVERSAMPLING])) | ||||
|  | ||||
|     if humidity_config := config.get(CONF_HUMIDITY): | ||||
|         sens = await sensor.new_sensor(humidity_config) | ||||
|         cg.add(var.set_humidity_sensor(sens)) | ||||
|         cg.add(var.set_humidity_oversampling(humidity_config[CONF_OVERSAMPLING])) | ||||
|  | ||||
|     cg.add(var.set_iir_filter(config[CONF_IIR_FILTER])) | ||||
|  | ||||
|     return var | ||||
|   | ||||
| @@ -1,106 +0,0 @@ | ||||
| import esphome.codegen as cg | ||||
| import esphome.config_validation as cv | ||||
| from esphome.components import sensor | ||||
| from esphome.const import ( | ||||
|     CONF_HUMIDITY, | ||||
|     CONF_ID, | ||||
|     CONF_IIR_FILTER, | ||||
|     CONF_OVERSAMPLING, | ||||
|     CONF_PRESSURE, | ||||
|     CONF_TEMPERATURE, | ||||
|     DEVICE_CLASS_HUMIDITY, | ||||
|     DEVICE_CLASS_PRESSURE, | ||||
|     DEVICE_CLASS_TEMPERATURE, | ||||
|     STATE_CLASS_MEASUREMENT, | ||||
|     UNIT_CELSIUS, | ||||
|     UNIT_HECTOPASCAL, | ||||
|     UNIT_PERCENT, | ||||
| ) | ||||
|  | ||||
| bme280_ns = cg.esphome_ns.namespace("bme280_base") | ||||
| BME280Oversampling = bme280_ns.enum("BME280Oversampling") | ||||
| OVERSAMPLING_OPTIONS = { | ||||
|     "NONE": BME280Oversampling.BME280_OVERSAMPLING_NONE, | ||||
|     "1X": BME280Oversampling.BME280_OVERSAMPLING_1X, | ||||
|     "2X": BME280Oversampling.BME280_OVERSAMPLING_2X, | ||||
|     "4X": BME280Oversampling.BME280_OVERSAMPLING_4X, | ||||
|     "8X": BME280Oversampling.BME280_OVERSAMPLING_8X, | ||||
|     "16X": BME280Oversampling.BME280_OVERSAMPLING_16X, | ||||
| } | ||||
|  | ||||
| BME280IIRFilter = bme280_ns.enum("BME280IIRFilter") | ||||
| IIR_FILTER_OPTIONS = { | ||||
|     "OFF": BME280IIRFilter.BME280_IIR_FILTER_OFF, | ||||
|     "2X": BME280IIRFilter.BME280_IIR_FILTER_2X, | ||||
|     "4X": BME280IIRFilter.BME280_IIR_FILTER_4X, | ||||
|     "8X": BME280IIRFilter.BME280_IIR_FILTER_8X, | ||||
|     "16X": BME280IIRFilter.BME280_IIR_FILTER_16X, | ||||
| } | ||||
|  | ||||
| CONFIG_SCHEMA_BASE = cv.Schema( | ||||
|     { | ||||
|         cv.Optional(CONF_TEMPERATURE): sensor.sensor_schema( | ||||
|             unit_of_measurement=UNIT_CELSIUS, | ||||
|             accuracy_decimals=1, | ||||
|             device_class=DEVICE_CLASS_TEMPERATURE, | ||||
|             state_class=STATE_CLASS_MEASUREMENT, | ||||
|         ).extend( | ||||
|             { | ||||
|                 cv.Optional(CONF_OVERSAMPLING, default="16X"): cv.enum( | ||||
|                     OVERSAMPLING_OPTIONS, upper=True | ||||
|                 ), | ||||
|             } | ||||
|         ), | ||||
|         cv.Optional(CONF_PRESSURE): sensor.sensor_schema( | ||||
|             unit_of_measurement=UNIT_HECTOPASCAL, | ||||
|             accuracy_decimals=1, | ||||
|             device_class=DEVICE_CLASS_PRESSURE, | ||||
|             state_class=STATE_CLASS_MEASUREMENT, | ||||
|         ).extend( | ||||
|             { | ||||
|                 cv.Optional(CONF_OVERSAMPLING, default="16X"): cv.enum( | ||||
|                     OVERSAMPLING_OPTIONS, upper=True | ||||
|                 ), | ||||
|             } | ||||
|         ), | ||||
|         cv.Optional(CONF_HUMIDITY): sensor.sensor_schema( | ||||
|             unit_of_measurement=UNIT_PERCENT, | ||||
|             accuracy_decimals=1, | ||||
|             device_class=DEVICE_CLASS_HUMIDITY, | ||||
|             state_class=STATE_CLASS_MEASUREMENT, | ||||
|         ).extend( | ||||
|             { | ||||
|                 cv.Optional(CONF_OVERSAMPLING, default="16X"): cv.enum( | ||||
|                     OVERSAMPLING_OPTIONS, upper=True | ||||
|                 ), | ||||
|             } | ||||
|         ), | ||||
|         cv.Optional(CONF_IIR_FILTER, default="OFF"): cv.enum( | ||||
|             IIR_FILTER_OPTIONS, upper=True | ||||
|         ), | ||||
|     } | ||||
| ).extend(cv.polling_component_schema("60s")) | ||||
|  | ||||
|  | ||||
| async def to_code(config, func=None): | ||||
|     var = cg.new_Pvariable(config[CONF_ID]) | ||||
|     await cg.register_component(var, config) | ||||
|     if func is not None: | ||||
|         await func(var, config) | ||||
|  | ||||
|     if temperature_config := config.get(CONF_TEMPERATURE): | ||||
|         sens = await sensor.new_sensor(temperature_config) | ||||
|         cg.add(var.set_temperature_sensor(sens)) | ||||
|         cg.add(var.set_temperature_oversampling(temperature_config[CONF_OVERSAMPLING])) | ||||
|  | ||||
|     if pressure_config := config.get(CONF_PRESSURE): | ||||
|         sens = await sensor.new_sensor(pressure_config) | ||||
|         cg.add(var.set_pressure_sensor(sens)) | ||||
|         cg.add(var.set_pressure_oversampling(pressure_config[CONF_OVERSAMPLING])) | ||||
|  | ||||
|     if humidity_config := config.get(CONF_HUMIDITY): | ||||
|         sens = await sensor.new_sensor(humidity_config) | ||||
|         cg.add(var.set_humidity_sensor(sens)) | ||||
|         cg.add(var.set_humidity_oversampling(humidity_config[CONF_OVERSAMPLING])) | ||||
|  | ||||
|     cg.add(var.set_iir_filter(config[CONF_IIR_FILTER])) | ||||
| @@ -1,9 +1,10 @@ | ||||
| import esphome.codegen as cg | ||||
| import esphome.config_validation as cv | ||||
| from esphome.components import i2c | ||||
| from ..bme280_base.sensor import to_code as to_code_base, cv, CONFIG_SCHEMA_BASE | ||||
| from ..bme280_base import to_code_base, CONFIG_SCHEMA_BASE | ||||
|  | ||||
| DEPENDENCIES = ["i2c"] | ||||
| AUTO_LOAD = ["bme280_base"] | ||||
| DEPENDENCIES = ["i2c"] | ||||
|  | ||||
| bme280_ns = cg.esphome_ns.namespace("bme280_i2c") | ||||
| BME280I2CComponent = bme280_ns.class_( | ||||
| @@ -16,4 +17,5 @@ CONFIG_SCHEMA = CONFIG_SCHEMA_BASE.extend( | ||||
|  | ||||
|  | ||||
| async def to_code(config): | ||||
|     await to_code_base(config, func=i2c.register_i2c_device) | ||||
|     var = await to_code_base(config) | ||||
|     await i2c.register_i2c_device(var, config) | ||||
|   | ||||
| @@ -1 +0,0 @@ | ||||
| CODEOWNERS = ["@apbodrov"] | ||||
|   | ||||
| @@ -4,19 +4,19 @@ | ||||
| #include "bme280_spi.h" | ||||
| #include <esphome/components/bme280_base/bme280_base.h> | ||||
|  | ||||
| int set_bit(uint8_t num, int position) { | ||||
| namespace esphome { | ||||
| namespace bme280_spi { | ||||
|  | ||||
| uint8_t set_bit(uint8_t num, int position) { | ||||
|   int mask = 1 << position; | ||||
|   return num | mask; | ||||
| } | ||||
|  | ||||
| int clear_bit(uint8_t num, int position) { | ||||
| uint8_t clear_bit(uint8_t num, int position) { | ||||
|   int mask = 1 << position; | ||||
|   return num & ~mask; | ||||
| } | ||||
|  | ||||
| namespace esphome { | ||||
| namespace bme280_spi { | ||||
|  | ||||
| void BME280SPIComponent::setup() { | ||||
|   this->spi_setup(); | ||||
|   BME280Component::setup(); | ||||
| @@ -30,34 +30,33 @@ void BME280SPIComponent::setup() { | ||||
|  | ||||
| bool BME280SPIComponent::read_byte(uint8_t a_register, uint8_t *data) { | ||||
|   this->enable(); | ||||
|   // cause: *data = this->delegate_->transfer(tmp) doesnt work | ||||
|   this->delegate_->transfer(set_bit(a_register, 7)); | ||||
|   *data = this->delegate_->transfer(0); | ||||
|   this->transfer_byte(set_bit(a_register, 7)); | ||||
|   *data = this->transfer_byte(0); | ||||
|   this->disable(); | ||||
|   return true; | ||||
| } | ||||
|  | ||||
| bool BME280SPIComponent::write_byte(uint8_t a_register, uint8_t data) { | ||||
|   this->enable(); | ||||
|   this->delegate_->transfer(clear_bit(a_register, 7)); | ||||
|   this->delegate_->transfer(data); | ||||
|   this->transfer_byte(clear_bit(a_register, 7)); | ||||
|   this->transfer_byte(data); | ||||
|   this->disable(); | ||||
|   return true; | ||||
| } | ||||
|  | ||||
| bool BME280SPIComponent::read_bytes(uint8_t a_register, uint8_t *data, size_t len) { | ||||
|   this->enable(); | ||||
|   this->delegate_->transfer(set_bit(a_register, 7)); | ||||
|   this->delegate_->read_array(data, len); | ||||
|   this->transfer_byte(set_bit(a_register, 7)); | ||||
|   this->read_array(data, len); | ||||
|   this->disable(); | ||||
|   return true; | ||||
| } | ||||
|  | ||||
| bool BME280SPIComponent::read_byte_16(uint8_t a_register, uint16_t *data) { | ||||
|   this->enable(); | ||||
|   this->delegate_->transfer(set_bit(a_register, 7)); | ||||
|   ((uint8_t *) data)[1] = this->delegate_->transfer(0); | ||||
|   ((uint8_t *) data)[0] = this->delegate_->transfer(0); | ||||
|   this->transfer_byte(set_bit(a_register, 7)); | ||||
|   ((uint8_t *) data)[1] = this->transfer_byte(0); | ||||
|   ((uint8_t *) data)[0] = this->transfer_byte(0); | ||||
|   this->disable(); | ||||
|   return true; | ||||
| } | ||||
|   | ||||
| @@ -1,13 +1,11 @@ | ||||
| import esphome.codegen as cg | ||||
| import esphome.config_validation as cv | ||||
| from esphome.components import spi | ||||
| from esphome.components.bme280_base.sensor import ( | ||||
|     to_code as to_code_base, | ||||
|     cv, | ||||
|     CONFIG_SCHEMA_BASE, | ||||
| ) | ||||
| from ..bme280_base import to_code_base, CONFIG_SCHEMA_BASE | ||||
|  | ||||
| DEPENDENCIES = ["spi"] | ||||
| AUTO_LOAD = ["bme280_base"] | ||||
| CODEOWNERS = ["@apbodrov"] | ||||
| DEPENDENCIES = ["spi"] | ||||
|  | ||||
|  | ||||
| bme280_spi_ns = cg.esphome_ns.namespace("bme280_spi") | ||||
| @@ -21,4 +19,5 @@ CONFIG_SCHEMA = CONFIG_SCHEMA_BASE.extend(spi.spi_device_schema()).extend( | ||||
|  | ||||
|  | ||||
| async def to_code(config): | ||||
|     await to_code_base(config, func=spi.register_spi_device) | ||||
|     var = await to_code_base(config) | ||||
|     await spi.register_spi_device(var, config) | ||||
|   | ||||
| @@ -15,11 +15,11 @@ class Rect { | ||||
|   int16_t h;  ///< Height of region | ||||
|  | ||||
|   Rect() : x(VALUE_NO_SET), y(VALUE_NO_SET), w(VALUE_NO_SET), h(VALUE_NO_SET) {}  // NOLINT | ||||
|   inline Rect(int16_t x, int16_t y, int16_t w, int16_t h) ALWAYS_INLINE : x(x), y(y), w(w), h(h) {} | ||||
|   inline Rect(int16_t x, int16_t y, int16_t w, int16_t h) ESPHOME_ALWAYS_INLINE : x(x), y(y), w(w), h(h) {} | ||||
|   inline int16_t x2() const { return this->x + this->w; };  ///< X coordinate of corner | ||||
|   inline int16_t y2() const { return this->y + this->h; };  ///< Y coordinate of corner | ||||
|  | ||||
|   inline bool is_set() const ALWAYS_INLINE { return (this->h != VALUE_NO_SET) && (this->w != VALUE_NO_SET); } | ||||
|   inline bool is_set() const ESPHOME_ALWAYS_INLINE { return (this->h != VALUE_NO_SET) && (this->w != VALUE_NO_SET); } | ||||
|  | ||||
|   void expand(int16_t horizontal, int16_t vertical); | ||||
|  | ||||
|   | ||||
| @@ -49,7 +49,16 @@ def _process_git_config(config: dict, refresh) -> str: | ||||
|         password=config.get(CONF_PASSWORD), | ||||
|     ) | ||||
|  | ||||
|     if (repo_dir / "esphome" / "components").is_dir(): | ||||
|     if path := config.get(CONF_PATH): | ||||
|         if (repo_dir / path).is_dir(): | ||||
|             components_dir = repo_dir / path | ||||
|         else: | ||||
|             raise cv.Invalid( | ||||
|                 "Could not find components folder for source. Please check the source contains a '" | ||||
|                 + path | ||||
|                 + "' folder" | ||||
|             ) | ||||
|     elif (repo_dir / "esphome" / "components").is_dir(): | ||||
|         components_dir = repo_dir / "esphome" / "components" | ||||
|     elif (repo_dir / "components").is_dir(): | ||||
|         components_dir = repo_dir / "components" | ||||
|   | ||||
| @@ -1,5 +1,6 @@ | ||||
| #include "hmc5883l.h" | ||||
| #include "esphome/core/log.h" | ||||
| #include "esphome/core/application.h" | ||||
|  | ||||
| namespace esphome { | ||||
| namespace hmc5883l { | ||||
| @@ -31,6 +32,10 @@ void HMC5883LComponent::setup() { | ||||
|     return; | ||||
|   } | ||||
|  | ||||
|   if (this->get_update_interval() < App.get_loop_interval()) { | ||||
|     high_freq_.start(); | ||||
|   } | ||||
|  | ||||
|   if (id[0] != 0x48 || id[1] != 0x34 || id[2] != 0x33) { | ||||
|     this->error_code_ = ID_REGISTERS; | ||||
|     this->mark_failed(); | ||||
|   | ||||
| @@ -63,6 +63,7 @@ class HMC5883LComponent : public PollingComponent, public i2c::I2CDevice { | ||||
|     COMMUNICATION_FAILED, | ||||
|     ID_REGISTERS, | ||||
|   } error_code_; | ||||
|   HighFrequencyLoopRequester high_freq_; | ||||
| }; | ||||
|  | ||||
| }  // namespace hmc5883l | ||||
|   | ||||
| @@ -11,54 +11,54 @@ class ESPColorCorrection { | ||||
|   void set_max_brightness(const Color &max_brightness) { this->max_brightness_ = max_brightness; } | ||||
|   void set_local_brightness(uint8_t local_brightness) { this->local_brightness_ = local_brightness; } | ||||
|   void calculate_gamma_table(float gamma); | ||||
|   inline Color color_correct(Color color) const ALWAYS_INLINE { | ||||
|   inline Color color_correct(Color color) const ESPHOME_ALWAYS_INLINE { | ||||
|     // corrected = (uncorrected * max_brightness * local_brightness) ^ gamma | ||||
|     return Color(this->color_correct_red(color.red), this->color_correct_green(color.green), | ||||
|                  this->color_correct_blue(color.blue), this->color_correct_white(color.white)); | ||||
|   } | ||||
|   inline uint8_t color_correct_red(uint8_t red) const ALWAYS_INLINE { | ||||
|   inline uint8_t color_correct_red(uint8_t red) const ESPHOME_ALWAYS_INLINE { | ||||
|     uint8_t res = esp_scale8(esp_scale8(red, this->max_brightness_.red), this->local_brightness_); | ||||
|     return this->gamma_table_[res]; | ||||
|   } | ||||
|   inline uint8_t color_correct_green(uint8_t green) const ALWAYS_INLINE { | ||||
|   inline uint8_t color_correct_green(uint8_t green) const ESPHOME_ALWAYS_INLINE { | ||||
|     uint8_t res = esp_scale8(esp_scale8(green, this->max_brightness_.green), this->local_brightness_); | ||||
|     return this->gamma_table_[res]; | ||||
|   } | ||||
|   inline uint8_t color_correct_blue(uint8_t blue) const ALWAYS_INLINE { | ||||
|   inline uint8_t color_correct_blue(uint8_t blue) const ESPHOME_ALWAYS_INLINE { | ||||
|     uint8_t res = esp_scale8(esp_scale8(blue, this->max_brightness_.blue), this->local_brightness_); | ||||
|     return this->gamma_table_[res]; | ||||
|   } | ||||
|   inline uint8_t color_correct_white(uint8_t white) const ALWAYS_INLINE { | ||||
|   inline uint8_t color_correct_white(uint8_t white) const ESPHOME_ALWAYS_INLINE { | ||||
|     uint8_t res = esp_scale8(esp_scale8(white, this->max_brightness_.white), this->local_brightness_); | ||||
|     return this->gamma_table_[res]; | ||||
|   } | ||||
|   inline Color color_uncorrect(Color color) const ALWAYS_INLINE { | ||||
|   inline Color color_uncorrect(Color color) const ESPHOME_ALWAYS_INLINE { | ||||
|     // uncorrected = corrected^(1/gamma) / (max_brightness * local_brightness) | ||||
|     return Color(this->color_uncorrect_red(color.red), this->color_uncorrect_green(color.green), | ||||
|                  this->color_uncorrect_blue(color.blue), this->color_uncorrect_white(color.white)); | ||||
|   } | ||||
|   inline uint8_t color_uncorrect_red(uint8_t red) const ALWAYS_INLINE { | ||||
|   inline uint8_t color_uncorrect_red(uint8_t red) const ESPHOME_ALWAYS_INLINE { | ||||
|     if (this->max_brightness_.red == 0 || this->local_brightness_ == 0) | ||||
|       return 0; | ||||
|     uint16_t uncorrected = this->gamma_reverse_table_[red] * 255UL; | ||||
|     uint8_t res = ((uncorrected / this->max_brightness_.red) * 255UL) / this->local_brightness_; | ||||
|     return res; | ||||
|   } | ||||
|   inline uint8_t color_uncorrect_green(uint8_t green) const ALWAYS_INLINE { | ||||
|   inline uint8_t color_uncorrect_green(uint8_t green) const ESPHOME_ALWAYS_INLINE { | ||||
|     if (this->max_brightness_.green == 0 || this->local_brightness_ == 0) | ||||
|       return 0; | ||||
|     uint16_t uncorrected = this->gamma_reverse_table_[green] * 255UL; | ||||
|     uint8_t res = ((uncorrected / this->max_brightness_.green) * 255UL) / this->local_brightness_; | ||||
|     return res; | ||||
|   } | ||||
|   inline uint8_t color_uncorrect_blue(uint8_t blue) const ALWAYS_INLINE { | ||||
|   inline uint8_t color_uncorrect_blue(uint8_t blue) const ESPHOME_ALWAYS_INLINE { | ||||
|     if (this->max_brightness_.blue == 0 || this->local_brightness_ == 0) | ||||
|       return 0; | ||||
|     uint16_t uncorrected = this->gamma_reverse_table_[blue] * 255UL; | ||||
|     uint8_t res = ((uncorrected / this->max_brightness_.blue) * 255UL) / this->local_brightness_; | ||||
|     return res; | ||||
|   } | ||||
|   inline uint8_t color_uncorrect_white(uint8_t white) const ALWAYS_INLINE { | ||||
|   inline uint8_t color_uncorrect_white(uint8_t white) const ESPHOME_ALWAYS_INLINE { | ||||
|     if (this->max_brightness_.white == 0 || this->local_brightness_ == 0) | ||||
|       return 0; | ||||
|     uint16_t uncorrected = this->gamma_reverse_table_[white] * 255UL; | ||||
|   | ||||
| @@ -24,11 +24,11 @@ struct ESPHSVColor { | ||||
|     }; | ||||
|     uint8_t raw[3]; | ||||
|   }; | ||||
|   inline ESPHSVColor() ALWAYS_INLINE : h(0), s(0), v(0) {  // NOLINT | ||||
|   inline ESPHSVColor() ESPHOME_ALWAYS_INLINE : h(0), s(0), v(0) {  // NOLINT | ||||
|   } | ||||
|   inline ESPHSVColor(uint8_t hue, uint8_t saturation, uint8_t value) ALWAYS_INLINE : hue(hue), | ||||
|                                                                                      saturation(saturation), | ||||
|                                                                                      value(value) {} | ||||
|   inline ESPHSVColor(uint8_t hue, uint8_t saturation, uint8_t value) ESPHOME_ALWAYS_INLINE : hue(hue), | ||||
|                                                                                              saturation(saturation), | ||||
|                                                                                              value(value) {} | ||||
|   Color to_rgb() const; | ||||
| }; | ||||
|  | ||||
|   | ||||
| @@ -39,7 +39,23 @@ void Logger::write_header_(int level, const char *tag, int line) { | ||||
|  | ||||
|   const char *color = LOG_LEVEL_COLORS[level]; | ||||
|   const char *letter = LOG_LEVEL_LETTERS[level]; | ||||
|   this->printf_to_buffer_("%s[%s][%s:%03u]: ", color, letter, tag, line); | ||||
| #if defined(USE_ESP32) || defined(USE_LIBRETINY) | ||||
|   TaskHandle_t current_task = xTaskGetCurrentTaskHandle(); | ||||
| #else | ||||
|   void *current_task = nullptr; | ||||
| #endif | ||||
|   if (current_task == main_task_) { | ||||
|     this->printf_to_buffer_("%s[%s][%s:%03u]: ", color, letter, tag, line); | ||||
|   } else { | ||||
|     const char *thread_name = ""; | ||||
| #if defined(USE_ESP32) | ||||
|     thread_name = pcTaskGetName(current_task); | ||||
| #elif defined(USE_LIBRETINY) | ||||
|     thread_name = pcTaskGetTaskName(current_task); | ||||
| #endif | ||||
|     this->printf_to_buffer_("%s[%s][%s:%03u]%s[%s]%s: ", color, letter, tag, line, | ||||
|                             ESPHOME_LOG_BOLD(ESPHOME_LOG_COLOR_RED), thread_name, color); | ||||
|   } | ||||
| } | ||||
|  | ||||
| void HOT Logger::log_vprintf_(int level, const char *tag, int line, const char *format, va_list args) {  // NOLINT | ||||
| @@ -127,6 +143,9 @@ void HOT Logger::log_message_(int level, const char *tag, int offset) { | ||||
| Logger::Logger(uint32_t baud_rate, size_t tx_buffer_size) : baud_rate_(baud_rate), tx_buffer_size_(tx_buffer_size) { | ||||
|   // add 1 to buffer size for null terminator | ||||
|   this->tx_buffer_ = new char[this->tx_buffer_size_ + 1];  // NOLINT | ||||
| #if defined(USE_ESP32) || defined(USE_LIBRETINY) | ||||
|   this->main_task_ = xTaskGetCurrentTaskHandle(); | ||||
| #endif | ||||
| } | ||||
|  | ||||
| #ifdef USE_LOGGER_USB_CDC | ||||
|   | ||||
| @@ -167,6 +167,7 @@ class Logger : public Component { | ||||
|   CallbackManager<void(int, const char *, const char *)> log_callback_{}; | ||||
|   /// Prevents recursive log calls, if true a log message is already being processed. | ||||
|   bool recursion_guard_ = false; | ||||
|   void *main_task_ = nullptr; | ||||
| }; | ||||
|  | ||||
| extern Logger *global_logger;  // NOLINT(cppcoreguidelines-avoid-non-const-global-variables) | ||||
|   | ||||
| @@ -2124,6 +2124,7 @@ GIT_SCHEMA = Schema( | ||||
|         Optional(CONF_REF): git_ref, | ||||
|         Optional(CONF_USERNAME): string, | ||||
|         Optional(CONF_PASSWORD): string, | ||||
|         Optional(CONF_PATH): string, | ||||
|     } | ||||
| ) | ||||
| LOCAL_SCHEMA = Schema( | ||||
|   | ||||
| @@ -31,19 +31,19 @@ struct Color { | ||||
|     uint32_t raw_32; | ||||
|   }; | ||||
|  | ||||
|   inline Color() ALWAYS_INLINE : r(0), g(0), b(0), w(0) {}  // NOLINT | ||||
|   inline Color(uint8_t red, uint8_t green, uint8_t blue) ALWAYS_INLINE : r(red), g(green), b(blue), w(0) {} | ||||
|   inline Color() ESPHOME_ALWAYS_INLINE : r(0), g(0), b(0), w(0) {}  // NOLINT | ||||
|   inline Color(uint8_t red, uint8_t green, uint8_t blue) ESPHOME_ALWAYS_INLINE : r(red), g(green), b(blue), w(0) {} | ||||
|  | ||||
|   inline Color(uint8_t red, uint8_t green, uint8_t blue, uint8_t white) ALWAYS_INLINE : r(red), | ||||
|                                                                                         g(green), | ||||
|                                                                                         b(blue), | ||||
|                                                                                         w(white) {} | ||||
|   inline explicit Color(uint32_t colorcode) ALWAYS_INLINE : r((colorcode >> 16) & 0xFF), | ||||
|                                                             g((colorcode >> 8) & 0xFF), | ||||
|                                                             b((colorcode >> 0) & 0xFF), | ||||
|                                                             w((colorcode >> 24) & 0xFF) {} | ||||
|   inline Color(uint8_t red, uint8_t green, uint8_t blue, uint8_t white) ESPHOME_ALWAYS_INLINE : r(red), | ||||
|                                                                                                 g(green), | ||||
|                                                                                                 b(blue), | ||||
|                                                                                                 w(white) {} | ||||
|   inline explicit Color(uint32_t colorcode) ESPHOME_ALWAYS_INLINE : r((colorcode >> 16) & 0xFF), | ||||
|                                                                     g((colorcode >> 8) & 0xFF), | ||||
|                                                                     b((colorcode >> 0) & 0xFF), | ||||
|                                                                     w((colorcode >> 24) & 0xFF) {} | ||||
|  | ||||
|   inline bool is_on() ALWAYS_INLINE { return this->raw_32 != 0; } | ||||
|   inline bool is_on() ESPHOME_ALWAYS_INLINE { return this->raw_32 != 0; } | ||||
|  | ||||
|   inline bool operator==(const Color &rhs) {  // NOLINT | ||||
|     return this->raw_32 == rhs.raw_32; | ||||
| @@ -57,31 +57,33 @@ struct Color { | ||||
|   inline bool operator!=(uint32_t colorcode) {  // NOLINT | ||||
|     return this->raw_32 != colorcode; | ||||
|   } | ||||
|   inline uint8_t &operator[](uint8_t x) ALWAYS_INLINE { return this->raw[x]; } | ||||
|   inline Color operator*(uint8_t scale) const ALWAYS_INLINE { | ||||
|   inline uint8_t &operator[](uint8_t x) ESPHOME_ALWAYS_INLINE { return this->raw[x]; } | ||||
|   inline Color operator*(uint8_t scale) const ESPHOME_ALWAYS_INLINE { | ||||
|     return Color(esp_scale8(this->red, scale), esp_scale8(this->green, scale), esp_scale8(this->blue, scale), | ||||
|                  esp_scale8(this->white, scale)); | ||||
|   } | ||||
|   inline Color operator~() const ALWAYS_INLINE { return Color(255 - this->red, 255 - this->green, 255 - this->blue); } | ||||
|   inline Color &operator*=(uint8_t scale) ALWAYS_INLINE { | ||||
|   inline Color operator~() const ESPHOME_ALWAYS_INLINE { | ||||
|     return Color(255 - this->red, 255 - this->green, 255 - this->blue); | ||||
|   } | ||||
|   inline Color &operator*=(uint8_t scale) ESPHOME_ALWAYS_INLINE { | ||||
|     this->red = esp_scale8(this->red, scale); | ||||
|     this->green = esp_scale8(this->green, scale); | ||||
|     this->blue = esp_scale8(this->blue, scale); | ||||
|     this->white = esp_scale8(this->white, scale); | ||||
|     return *this; | ||||
|   } | ||||
|   inline Color operator*(const Color &scale) const ALWAYS_INLINE { | ||||
|   inline Color operator*(const Color &scale) const ESPHOME_ALWAYS_INLINE { | ||||
|     return Color(esp_scale8(this->red, scale.red), esp_scale8(this->green, scale.green), | ||||
|                  esp_scale8(this->blue, scale.blue), esp_scale8(this->white, scale.white)); | ||||
|   } | ||||
|   inline Color &operator*=(const Color &scale) ALWAYS_INLINE { | ||||
|   inline Color &operator*=(const Color &scale) ESPHOME_ALWAYS_INLINE { | ||||
|     this->red = esp_scale8(this->red, scale.red); | ||||
|     this->green = esp_scale8(this->green, scale.green); | ||||
|     this->blue = esp_scale8(this->blue, scale.blue); | ||||
|     this->white = esp_scale8(this->white, scale.white); | ||||
|     return *this; | ||||
|   } | ||||
|   inline Color operator+(const Color &add) const ALWAYS_INLINE { | ||||
|   inline Color operator+(const Color &add) const ESPHOME_ALWAYS_INLINE { | ||||
|     Color ret; | ||||
|     if (uint8_t(add.r + this->r) < this->r) | ||||
|       ret.r = 255; | ||||
| @@ -101,10 +103,10 @@ struct Color { | ||||
|       ret.w = this->w + add.w; | ||||
|     return ret; | ||||
|   } | ||||
|   inline Color &operator+=(const Color &add) ALWAYS_INLINE { return *this = (*this) + add; } | ||||
|   inline Color operator+(uint8_t add) const ALWAYS_INLINE { return (*this) + Color(add, add, add, add); } | ||||
|   inline Color &operator+=(uint8_t add) ALWAYS_INLINE { return *this = (*this) + add; } | ||||
|   inline Color operator-(const Color &subtract) const ALWAYS_INLINE { | ||||
|   inline Color &operator+=(const Color &add) ESPHOME_ALWAYS_INLINE { return *this = (*this) + add; } | ||||
|   inline Color operator+(uint8_t add) const ESPHOME_ALWAYS_INLINE { return (*this) + Color(add, add, add, add); } | ||||
|   inline Color &operator+=(uint8_t add) ESPHOME_ALWAYS_INLINE { return *this = (*this) + add; } | ||||
|   inline Color operator-(const Color &subtract) const ESPHOME_ALWAYS_INLINE { | ||||
|     Color ret; | ||||
|     if (subtract.r > this->r) | ||||
|       ret.r = 0; | ||||
| @@ -124,11 +126,11 @@ struct Color { | ||||
|       ret.w = this->w - subtract.w; | ||||
|     return ret; | ||||
|   } | ||||
|   inline Color &operator-=(const Color &subtract) ALWAYS_INLINE { return *this = (*this) - subtract; } | ||||
|   inline Color operator-(uint8_t subtract) const ALWAYS_INLINE { | ||||
|   inline Color &operator-=(const Color &subtract) ESPHOME_ALWAYS_INLINE { return *this = (*this) - subtract; } | ||||
|   inline Color operator-(uint8_t subtract) const ESPHOME_ALWAYS_INLINE { | ||||
|     return (*this) - Color(subtract, subtract, subtract, subtract); | ||||
|   } | ||||
|   inline Color &operator-=(uint8_t subtract) ALWAYS_INLINE { return *this = (*this) - subtract; } | ||||
|   inline Color &operator-=(uint8_t subtract) ESPHOME_ALWAYS_INLINE { return *this = (*this) - subtract; } | ||||
|   static Color random_color() { | ||||
|     uint32_t rand = random_uint32(); | ||||
|     uint8_t w = rand >> 24; | ||||
|   | ||||
| @@ -15,18 +15,23 @@ | ||||
| #define ESPHOME_VARIANT "ESP32" | ||||
|  | ||||
| // Feature flags | ||||
| #define USE_ALARM_CONTROL_PANEL | ||||
| #define USE_API | ||||
| #define USE_API_NOISE | ||||
| #define USE_API_PLAINTEXT | ||||
| #define USE_ALARM_CONTROL_PANEL | ||||
| #define USE_BINARY_SENSOR | ||||
| #define USE_BUTTON | ||||
| #define USE_CLIMATE | ||||
| #define USE_COVER | ||||
| #define USE_DATETIME | ||||
| #define USE_DATETIME_DATE | ||||
| #define USE_DATETIME_DATETIME | ||||
| #define USE_DATETIME_TIME | ||||
| #define USE_DEEP_SLEEP | ||||
| #define USE_EVENT | ||||
| #define USE_FAN | ||||
| #define USE_GRAPH | ||||
| #define USE_GRAPHICAL_DISPLAY_MENU | ||||
| #define USE_HOMEASSISTANT_TIME | ||||
| #define USE_JSON | ||||
| #define USE_LIGHT | ||||
| @@ -37,10 +42,6 @@ | ||||
| #define USE_MQTT | ||||
| #define USE_NEXTION_TFT_UPLOAD | ||||
| #define USE_NUMBER | ||||
| #define USE_DATETIME | ||||
| #define USE_DATETIME_DATE | ||||
| #define USE_DATETIME_TIME | ||||
| #define USE_DATETIME_DATETIME | ||||
| #define USE_OTA | ||||
| #define USE_OTA_PASSWORD | ||||
| #define USE_OTA_STATE_CALLBACK | ||||
| @@ -60,7 +61,6 @@ | ||||
| #define USE_VALVE | ||||
| #define USE_WIFI | ||||
| #define USE_WIFI_AP | ||||
| #define USE_GRAPHICAL_DISPLAY_MENU | ||||
|  | ||||
| // Arduino-specific feature flags | ||||
| #ifdef USE_ARDUINO | ||||
| @@ -78,17 +78,19 @@ | ||||
|  | ||||
| // ESP32-specific feature flags | ||||
| #ifdef USE_ESP32 | ||||
| #define USE_BLUETOOTH_PROXY | ||||
| #define USE_ESP32_BLE | ||||
| #define USE_ESP32_BLE_CLIENT | ||||
| #define USE_ESP32_BLE_SERVER | ||||
| #define USE_ESP32_CAMERA | ||||
| #define USE_IMPROV | ||||
| #define USE_SOCKET_IMPL_BSD_SOCKETS | ||||
| #define USE_WIFI_11KV_SUPPORT | ||||
| #define USE_BLUETOOTH_PROXY | ||||
| #define USE_VOICE_ASSISTANT | ||||
| #define USE_MICROPHONE | ||||
| #define USE_PSRAM | ||||
| #define USE_SOCKET_IMPL_BSD_SOCKETS | ||||
| #define USE_SPEAKER | ||||
| #define USE_SPI | ||||
| #define USE_VOICE_ASSISTANT | ||||
| #define USE_WIFI_11KV_SUPPORT | ||||
|  | ||||
| #ifdef USE_ARDUINO | ||||
| #define USE_ARDUINO_VERSION_CODE VERSION_CODE(2, 0, 5) | ||||
|   | ||||
| @@ -24,7 +24,7 @@ | ||||
|  | ||||
| #define HOT __attribute__((hot)) | ||||
| #define ESPDEPRECATED(msg, when) __attribute__((deprecated(msg))) | ||||
| #define ALWAYS_INLINE __attribute__((always_inline)) | ||||
| #define ESPHOME_ALWAYS_INLINE __attribute__((always_inline)) | ||||
| #define PACKED __attribute__((packed)) | ||||
|  | ||||
| // Various functions can be constexpr in C++14, but not in C++11 (because their body isn't just a return statement). | ||||
|   | ||||
							
								
								
									
										19
									
								
								tests/components/bme280_i2c/common.yaml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										19
									
								
								tests/components/bme280_i2c/common.yaml
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,19 @@ | ||||
| i2c: | ||||
|   - id: i2c_bme280 | ||||
|     scl: ${scl_pin} | ||||
|     sda: ${sda_pin} | ||||
|  | ||||
| sensor: | ||||
|   - platform: bme280_i2c | ||||
|     i2c_id: i2c_bme280 | ||||
|     address: 0x76 | ||||
|     temperature: | ||||
|       id: bme280_temperature | ||||
|       name: BME280 Temperature | ||||
|     humidity: | ||||
|       id: bme280_humidity | ||||
|       name: BME280 Humidity | ||||
|     pressure: | ||||
|       id: bme280_pressure | ||||
|       name: BME280 Pressure | ||||
|     update_interval: 15s | ||||
| @@ -1,18 +1,5 @@ | ||||
| i2c: | ||||
|   - id: i2c_bme280 | ||||
|     scl: 5 | ||||
|     sda: 4 | ||||
| substitutions: | ||||
|   scl_pin: GPIO5 | ||||
|   sda_pin: GPIO4 | ||||
|  | ||||
| sensor: | ||||
|   - platform: bme280_i2c | ||||
|     address: 0x76 | ||||
|     temperature: | ||||
|       id: bme280_temperature | ||||
|       name: BME280 Temperature | ||||
|     humidity: | ||||
|       id: bme280_humidity | ||||
|       name: BME280 Humidity | ||||
|     pressure: | ||||
|       id: bme280_pressure | ||||
|       name: BME280 Pressure | ||||
|     update_interval: 15s | ||||
| <<: !include common.yaml | ||||
|   | ||||
| @@ -1,18 +1,5 @@ | ||||
| i2c: | ||||
|   - id: i2c_bme280 | ||||
|     scl: 5 | ||||
|     sda: 4 | ||||
| substitutions: | ||||
|   scl_pin: GPIO5 | ||||
|   sda_pin: GPIO4 | ||||
|  | ||||
| sensor: | ||||
|   - platform: bme280_i2c | ||||
|     address: 0x76 | ||||
|     temperature: | ||||
|       id: bme280_temperature | ||||
|       name: BME280 Temperature | ||||
|     humidity: | ||||
|       id: bme280_humidity | ||||
|       name: BME280 Humidity | ||||
|     pressure: | ||||
|       id: bme280_pressure | ||||
|       name: BME280 Pressure | ||||
|     update_interval: 15s | ||||
| <<: !include common.yaml | ||||
|   | ||||
| @@ -1,18 +1,5 @@ | ||||
| i2c: | ||||
|   - id: i2c_bme280 | ||||
|     scl: 16 | ||||
|     sda: 17 | ||||
| substitutions: | ||||
|   scl_pin: GPIO16 | ||||
|   sda_pin: GPIO17 | ||||
|  | ||||
| sensor: | ||||
|   - platform: bme280_i2c | ||||
|     address: 0x76 | ||||
|     temperature: | ||||
|       id: bme280_temperature | ||||
|       name: BME280 Temperature | ||||
|     humidity: | ||||
|       id: bme280_humidity | ||||
|       name: BME280 Humidity | ||||
|     pressure: | ||||
|       id: bme280_pressure | ||||
|       name: BME280 Pressure | ||||
|     update_interval: 15s | ||||
| <<: !include common.yaml | ||||
|   | ||||
| @@ -1,18 +1,5 @@ | ||||
| i2c: | ||||
|   - id: i2c_bme280 | ||||
|     scl: 16 | ||||
|     sda: 17 | ||||
| substitutions: | ||||
|   scl_pin: GPIO16 | ||||
|   sda_pin: GPIO17 | ||||
|  | ||||
| sensor: | ||||
|   - platform: bme280_i2c | ||||
|     address: 0x76 | ||||
|     temperature: | ||||
|       id: bme280_temperature | ||||
|       name: BME280 Temperature | ||||
|     humidity: | ||||
|       id: bme280_humidity | ||||
|       name: BME280 Humidity | ||||
|     pressure: | ||||
|       id: bme280_pressure | ||||
|       name: BME280 Pressure | ||||
|     update_interval: 15s | ||||
| <<: !include common.yaml | ||||
|   | ||||
| @@ -1,18 +1,5 @@ | ||||
| i2c: | ||||
|   - id: i2c_bme280 | ||||
|     scl: 5 | ||||
|     sda: 4 | ||||
| substitutions: | ||||
|   scl_pin: GPIO5 | ||||
|   sda_pin: GPIO4 | ||||
|  | ||||
| sensor: | ||||
|   - platform: bme280_i2c | ||||
|     address: 0x76 | ||||
|     temperature: | ||||
|       id: bme280_temperature | ||||
|       name: BME280 Temperature | ||||
|     humidity: | ||||
|       id: bme280_humidity | ||||
|       name: BME280 Humidity | ||||
|     pressure: | ||||
|       id: bme280_pressure | ||||
|       name: BME280 Pressure | ||||
|     update_interval: 15s | ||||
| <<: !include common.yaml | ||||
|   | ||||
| @@ -1,18 +1,5 @@ | ||||
| i2c: | ||||
|   - id: i2c_bme280 | ||||
|     scl: 5 | ||||
|     sda: 4 | ||||
| substitutions: | ||||
|   scl_pin: GPIO5 | ||||
|   sda_pin: GPIO4 | ||||
|  | ||||
| sensor: | ||||
|   - platform: bme280_i2c | ||||
|     address: 0x76 | ||||
|     temperature: | ||||
|       id: bme280_temperature | ||||
|       name: BME280 Temperature | ||||
|     humidity: | ||||
|       id: bme280_humidity | ||||
|       name: BME280 Humidity | ||||
|     pressure: | ||||
|       id: bme280_pressure | ||||
|       name: BME280 Pressure | ||||
|     update_interval: 15s | ||||
| <<: !include common.yaml | ||||
|   | ||||
							
								
								
									
										20
									
								
								tests/components/bme280_spi/common.yaml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										20
									
								
								tests/components/bme280_spi/common.yaml
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,20 @@ | ||||
| spi: | ||||
|   - id: spi_bme280 | ||||
|     clk_pin: ${clk_pin} | ||||
|     mosi_pin: ${mosi_pin} | ||||
|     miso_pin: ${miso_pin} | ||||
|  | ||||
| sensor: | ||||
|   - platform: bme280_spi | ||||
|     spi_id: spi_bme280 | ||||
|     cs_pin: ${cs_pin} | ||||
|     temperature: | ||||
|       id: bme280_temperature | ||||
|       name: BME280 Temperature | ||||
|     humidity: | ||||
|       id: bme280_humidity | ||||
|       name: BME280 Humidity | ||||
|     pressure: | ||||
|       id: bme280_pressure | ||||
|       name: BME280 Pressure | ||||
|     update_interval: 15s | ||||
| @@ -1,19 +1,7 @@ | ||||
| spi: | ||||
|   - id: spi_bme280 | ||||
|     clk_pin: 6 | ||||
|     mosi_pin: 7 | ||||
|     miso_pin: 5 | ||||
| substitutions: | ||||
|   clk_pin: GPIO6 | ||||
|   mosi_pin: GPIO7 | ||||
|   miso_pin: GPIO5 | ||||
|   cs_pin: GPIO8 | ||||
|  | ||||
| sensor: | ||||
|   - platform: bme280_spi | ||||
|     cs_pin: 8 | ||||
|     temperature: | ||||
|       id: bme280_temperature | ||||
|       name: BME280 Temperature | ||||
|     humidity: | ||||
|       id: bme280_humidity | ||||
|       name: BME280 Humidity | ||||
|     pressure: | ||||
|       id: bme280_pressure | ||||
|       name: BME280 Pressure | ||||
|     update_interval: 15s | ||||
| <<: !include common.yaml | ||||
|   | ||||
| @@ -1,19 +1,7 @@ | ||||
| spi: | ||||
|   - id: spi_bme280 | ||||
|     clk_pin: 6 | ||||
|     mosi_pin: 7 | ||||
|     miso_pin: 5 | ||||
| substitutions: | ||||
|   clk_pin: GPIO6 | ||||
|   mosi_pin: GPIO7 | ||||
|   miso_pin: GPIO5 | ||||
|   cs_pin: GPIO8 | ||||
|  | ||||
| sensor: | ||||
|   - platform: bme280_spi | ||||
|     cs_pin: 8 | ||||
|     temperature: | ||||
|       id: bme280_temperature | ||||
|       name: BME280 Temperature | ||||
|     humidity: | ||||
|       id: bme280_humidity | ||||
|       name: BME280 Humidity | ||||
|     pressure: | ||||
|       id: bme280_pressure | ||||
|       name: BME280 Pressure | ||||
|     update_interval: 15s | ||||
| <<: !include common.yaml | ||||
|   | ||||
| @@ -1,19 +1,7 @@ | ||||
| spi: | ||||
|   - id: spi_bme280 | ||||
|     clk_pin: 16 | ||||
|     mosi_pin: 17 | ||||
|     miso_pin: 15 | ||||
| substitutions: | ||||
|   clk_pin: GPIO16 | ||||
|   mosi_pin: GPIO17 | ||||
|   miso_pin: GPIO15 | ||||
|   cs_pin: GPIO5 | ||||
|  | ||||
| sensor: | ||||
|   - platform: bme280_spi | ||||
|     cs_pin: 12 | ||||
|     temperature: | ||||
|       id: bme280_temperature | ||||
|       name: BME280 Temperature | ||||
|     humidity: | ||||
|       id: bme280_humidity | ||||
|       name: BME280 Humidity | ||||
|     pressure: | ||||
|       id: bme280_pressure | ||||
|       name: BME280 Pressure | ||||
|     update_interval: 15s | ||||
| <<: !include common.yaml | ||||
|   | ||||
| @@ -1,19 +1,7 @@ | ||||
| spi: | ||||
|   - id: spi_bme280 | ||||
|     clk_pin: 16 | ||||
|     mosi_pin: 17 | ||||
|     miso_pin: 15 | ||||
| substitutions: | ||||
|   clk_pin: GPIO16 | ||||
|   mosi_pin: GPIO17 | ||||
|   miso_pin: GPIO15 | ||||
|   cs_pin: GPIO5 | ||||
|  | ||||
| sensor: | ||||
|   - platform: bme280_spi | ||||
|     cs_pin: 12 | ||||
|     temperature: | ||||
|       id: bme280_temperature | ||||
|       name: BME280 Temperature | ||||
|     humidity: | ||||
|       id: bme280_humidity | ||||
|       name: BME280 Humidity | ||||
|     pressure: | ||||
|       id: bme280_pressure | ||||
|       name: BME280 Pressure | ||||
|     update_interval: 15s | ||||
| <<: !include common.yaml | ||||
|   | ||||
| @@ -1,19 +1,7 @@ | ||||
| spi: | ||||
|   - id: spi_bme280 | ||||
|     clk_pin: 14 | ||||
|     mosi_pin: 13 | ||||
|     miso_pin: 12 | ||||
| substitutions: | ||||
|   clk_pin: GPIO14 | ||||
|   mosi_pin: GPIO13 | ||||
|   miso_pin: GPIO12 | ||||
|   cs_pin: GPIO15 | ||||
|  | ||||
| sensor: | ||||
|   - platform: bme280_spi | ||||
|     cs_pin: 15 | ||||
|     temperature: | ||||
|       id: bme280_temperature | ||||
|       name: BME280 Temperature | ||||
|     humidity: | ||||
|       id: bme280_humidity | ||||
|       name: BME280 Humidity | ||||
|     pressure: | ||||
|       id: bme280_pressure | ||||
|       name: BME280 Pressure | ||||
|     update_interval: 15s | ||||
| <<: !include common.yaml | ||||
|   | ||||
| @@ -1,19 +1,7 @@ | ||||
| spi: | ||||
|   - id: spi_bme280 | ||||
|     clk_pin: 2 | ||||
|     mosi_pin: 3 | ||||
|     miso_pin: 4 | ||||
| substitutions: | ||||
|   clk_pin: GPIO2 | ||||
|   mosi_pin: GPIO3 | ||||
|   miso_pin: GPIO4 | ||||
|   cs_pin: GPIO5 | ||||
|  | ||||
| sensor: | ||||
|   - platform: bme280_spi | ||||
|     cs_pin: 6 | ||||
|     temperature: | ||||
|       id: bme280_temperature | ||||
|       name: BME280 Temperature | ||||
|     humidity: | ||||
|       id: bme280_humidity | ||||
|       name: BME280 Humidity | ||||
|     pressure: | ||||
|       id: bme280_pressure | ||||
|       name: BME280 Pressure | ||||
|     update_interval: 15s | ||||
| <<: !include common.yaml | ||||
|   | ||||
| @@ -706,35 +706,6 @@ sensor: | ||||
|     update_interval: 30s | ||||
|     mode: low_power | ||||
|     i2c_id: i2c_bus | ||||
|   - platform: bme280_i2c | ||||
|     temperature: | ||||
|       name: Outside Temperature | ||||
|       oversampling: 16x | ||||
|     pressure: | ||||
|       name: Outside Pressure | ||||
|       oversampling: none | ||||
|     humidity: | ||||
|       name: Outside Humidity | ||||
|       oversampling: 8x | ||||
|     address: 0x77 | ||||
|     iir_filter: 16x | ||||
|     update_interval: 15s | ||||
|     i2c_id: i2c_bus | ||||
|   - platform: bme280_spi | ||||
|     temperature: | ||||
|       name: Outside Temperature | ||||
|       oversampling: 16x | ||||
|     pressure: | ||||
|       name: Outside Pressure | ||||
|       oversampling: none | ||||
|     humidity: | ||||
|       name: Outside Humidity | ||||
|       oversampling: 8x | ||||
|     cs_pin: | ||||
|       allow_other_uses: true | ||||
|       number: GPIO23 | ||||
|     iir_filter: 16x | ||||
|     update_interval: 15s | ||||
|   - platform: bme680 | ||||
|     temperature: | ||||
|       name: Outside Temperature | ||||
|   | ||||
		Reference in New Issue
	
	Block a user