mirror of
https://github.com/esphome/esphome.git
synced 2024-11-24 16:08:10 +01:00
Merge remote-tracking branch 'upstream/dev' into dev
This commit is contained in:
commit
70cfc70c06
103 changed files with 509 additions and 588 deletions
2
.github/workflows/ci-api-proto.yml
vendored
2
.github/workflows/ci-api-proto.yml
vendored
|
@ -21,7 +21,7 @@ jobs:
|
|||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4.1.1
|
||||
uses: actions/checkout@v4.1.5
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v5.1.0
|
||||
with:
|
||||
|
|
2
.github/workflows/ci-docker.yml
vendored
2
.github/workflows/ci-docker.yml
vendored
|
@ -40,7 +40,7 @@ jobs:
|
|||
arch: [amd64, armv7, aarch64]
|
||||
build_type: ["ha-addon", "docker", "lint"]
|
||||
steps:
|
||||
- uses: actions/checkout@v4.1.1
|
||||
- uses: actions/checkout@v4.1.5
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v5.1.0
|
||||
with:
|
||||
|
|
32
.github/workflows/ci.yml
vendored
32
.github/workflows/ci.yml
vendored
|
@ -34,7 +34,7 @@ jobs:
|
|||
cache-key: ${{ steps.cache-key.outputs.key }}
|
||||
steps:
|
||||
- name: Check out code from GitHub
|
||||
uses: actions/checkout@v4.1.1
|
||||
uses: actions/checkout@v4.1.5
|
||||
- name: Generate cache-key
|
||||
id: cache-key
|
||||
run: echo key="${{ hashFiles('requirements.txt', 'requirements_optional.txt', 'requirements_test.txt') }}" >> $GITHUB_OUTPUT
|
||||
|
@ -66,7 +66,7 @@ jobs:
|
|||
- common
|
||||
steps:
|
||||
- name: Check out code from GitHub
|
||||
uses: actions/checkout@v4.1.1
|
||||
uses: actions/checkout@v4.1.5
|
||||
- name: Restore Python
|
||||
uses: ./.github/actions/restore-python
|
||||
with:
|
||||
|
@ -87,7 +87,7 @@ jobs:
|
|||
- common
|
||||
steps:
|
||||
- name: Check out code from GitHub
|
||||
uses: actions/checkout@v4.1.1
|
||||
uses: actions/checkout@v4.1.5
|
||||
- name: Restore Python
|
||||
uses: ./.github/actions/restore-python
|
||||
with:
|
||||
|
@ -108,7 +108,7 @@ jobs:
|
|||
- common
|
||||
steps:
|
||||
- name: Check out code from GitHub
|
||||
uses: actions/checkout@v4.1.1
|
||||
uses: actions/checkout@v4.1.5
|
||||
- name: Restore Python
|
||||
uses: ./.github/actions/restore-python
|
||||
with:
|
||||
|
@ -129,7 +129,7 @@ jobs:
|
|||
- common
|
||||
steps:
|
||||
- name: Check out code from GitHub
|
||||
uses: actions/checkout@v4.1.1
|
||||
uses: actions/checkout@v4.1.5
|
||||
- name: Restore Python
|
||||
uses: ./.github/actions/restore-python
|
||||
with:
|
||||
|
@ -150,7 +150,7 @@ jobs:
|
|||
- common
|
||||
steps:
|
||||
- name: Check out code from GitHub
|
||||
uses: actions/checkout@v4.1.1
|
||||
uses: actions/checkout@v4.1.5
|
||||
- name: Restore Python
|
||||
uses: ./.github/actions/restore-python
|
||||
with:
|
||||
|
@ -199,7 +199,7 @@ jobs:
|
|||
- common
|
||||
steps:
|
||||
- name: Check out code from GitHub
|
||||
uses: actions/checkout@v4.1.1
|
||||
uses: actions/checkout@v4.1.5
|
||||
- name: Restore Python
|
||||
uses: ./.github/actions/restore-python
|
||||
with:
|
||||
|
@ -229,7 +229,7 @@ jobs:
|
|||
- common
|
||||
steps:
|
||||
- name: Check out code from GitHub
|
||||
uses: actions/checkout@v4.1.1
|
||||
uses: actions/checkout@v4.1.5
|
||||
- name: Restore Python
|
||||
uses: ./.github/actions/restore-python
|
||||
with:
|
||||
|
@ -254,7 +254,7 @@ jobs:
|
|||
matrix: ${{ steps.set-matrix.outputs.matrix }}
|
||||
steps:
|
||||
- name: Check out code from GitHub
|
||||
uses: actions/checkout@v4.1.1
|
||||
uses: actions/checkout@v4.1.5
|
||||
- name: Find all YAML test files
|
||||
id: set-matrix
|
||||
run: echo "matrix=$(ls tests/test*.yaml | jq -R -s -c 'split("\n")[:-1]')" >> $GITHUB_OUTPUT
|
||||
|
@ -271,7 +271,7 @@ jobs:
|
|||
file: ${{ fromJson(needs.compile-tests-list.outputs.matrix) }}
|
||||
steps:
|
||||
- name: Check out code from GitHub
|
||||
uses: actions/checkout@v4.1.1
|
||||
uses: actions/checkout@v4.1.5
|
||||
- name: Restore Python
|
||||
uses: ./.github/actions/restore-python
|
||||
with:
|
||||
|
@ -303,7 +303,7 @@ jobs:
|
|||
file: ${{ fromJson(needs.compile-tests-list.outputs.matrix) }}
|
||||
steps:
|
||||
- name: Check out code from GitHub
|
||||
uses: actions/checkout@v4.1.1
|
||||
uses: actions/checkout@v4.1.5
|
||||
- name: Restore Python
|
||||
uses: ./.github/actions/restore-python
|
||||
with:
|
||||
|
@ -358,7 +358,7 @@ jobs:
|
|||
|
||||
steps:
|
||||
- name: Check out code from GitHub
|
||||
uses: actions/checkout@v4.1.1
|
||||
uses: actions/checkout@v4.1.5
|
||||
- name: Restore Python
|
||||
uses: ./.github/actions/restore-python
|
||||
with:
|
||||
|
@ -402,7 +402,7 @@ jobs:
|
|||
count: ${{ steps.list-components.outputs.count }}
|
||||
steps:
|
||||
- name: Check out code from GitHub
|
||||
uses: actions/checkout@v4.1.1
|
||||
uses: actions/checkout@v4.1.5
|
||||
with:
|
||||
# Fetch enough history so `git merge-base refs/remotes/origin/dev HEAD` works.
|
||||
fetch-depth: 500
|
||||
|
@ -450,7 +450,7 @@ jobs:
|
|||
run: sudo apt-get install libsodium-dev
|
||||
|
||||
- name: Check out code from GitHub
|
||||
uses: actions/checkout@v4.1.1
|
||||
uses: actions/checkout@v4.1.5
|
||||
- name: Restore Python
|
||||
uses: ./.github/actions/restore-python
|
||||
with:
|
||||
|
@ -476,7 +476,7 @@ jobs:
|
|||
matrix: ${{ steps.split.outputs.components }}
|
||||
steps:
|
||||
- name: Check out code from GitHub
|
||||
uses: actions/checkout@v4.1.1
|
||||
uses: actions/checkout@v4.1.5
|
||||
- name: Split components into 20 groups
|
||||
id: split
|
||||
run: |
|
||||
|
@ -504,7 +504,7 @@ jobs:
|
|||
run: sudo apt-get install libsodium-dev
|
||||
|
||||
- name: Check out code from GitHub
|
||||
uses: actions/checkout@v4.1.1
|
||||
uses: actions/checkout@v4.1.5
|
||||
- name: Restore Python
|
||||
uses: ./.github/actions/restore-python
|
||||
with:
|
||||
|
|
8
.github/workflows/release.yml
vendored
8
.github/workflows/release.yml
vendored
|
@ -19,7 +19,7 @@ jobs:
|
|||
tag: ${{ steps.tag.outputs.tag }}
|
||||
branch_build: ${{ steps.tag.outputs.branch_build }}
|
||||
steps:
|
||||
- uses: actions/checkout@v4.1.1
|
||||
- uses: actions/checkout@v4.1.5
|
||||
- name: Get tag
|
||||
id: tag
|
||||
# yamllint disable rule:line-length
|
||||
|
@ -51,7 +51,7 @@ jobs:
|
|||
contents: read
|
||||
id-token: write
|
||||
steps:
|
||||
- uses: actions/checkout@v4.1.1
|
||||
- uses: actions/checkout@v4.1.5
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v5.1.0
|
||||
with:
|
||||
|
@ -81,7 +81,7 @@ jobs:
|
|||
- linux/arm/v7
|
||||
- linux/arm64
|
||||
steps:
|
||||
- uses: actions/checkout@v4.1.1
|
||||
- uses: actions/checkout@v4.1.5
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v5.1.0
|
||||
with:
|
||||
|
@ -159,7 +159,7 @@ jobs:
|
|||
- ghcr
|
||||
- dockerhub
|
||||
steps:
|
||||
- uses: actions/checkout@v4.1.1
|
||||
- uses: actions/checkout@v4.1.5
|
||||
- name: Download digests
|
||||
uses: actions/download-artifact@v3.0.2
|
||||
with:
|
||||
|
|
4
.github/workflows/sync-device-classes.yml
vendored
4
.github/workflows/sync-device-classes.yml
vendored
|
@ -13,10 +13,10 @@ jobs:
|
|||
if: github.repository == 'esphome/esphome'
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4.1.1
|
||||
uses: actions/checkout@v4.1.5
|
||||
|
||||
- name: Checkout Home Assistant
|
||||
uses: actions/checkout@v4.1.1
|
||||
uses: actions/checkout@v4.1.5
|
||||
with:
|
||||
repository: home-assistant/core
|
||||
path: lib/home-assistant
|
||||
|
|
2
.github/workflows/yaml-lint.yml
vendored
2
.github/workflows/yaml-lint.yml
vendored
|
@ -18,7 +18,7 @@ jobs:
|
|||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Check out code from GitHub
|
||||
uses: actions/checkout@v4.1.1
|
||||
uses: actions/checkout@v4.1.5
|
||||
- name: Run yamllint
|
||||
uses: frenck/action-yamllint@v1.5.0
|
||||
with:
|
||||
|
|
|
@ -19,6 +19,7 @@ from esphome.const import (
|
|||
CONF_RESET_PIN,
|
||||
CONF_REVERSE_ACTIVE_ENERGY,
|
||||
CONF_VOLTAGE,
|
||||
CONF_VOLTAGE_GAIN,
|
||||
DEVICE_CLASS_APPARENT_POWER,
|
||||
DEVICE_CLASS_CURRENT,
|
||||
DEVICE_CLASS_ENERGY,
|
||||
|
@ -47,7 +48,6 @@ CONF_CURRENT_GAIN = "current_gain"
|
|||
CONF_IRQ0_PIN = "irq0_pin"
|
||||
CONF_IRQ1_PIN = "irq1_pin"
|
||||
CONF_POWER_GAIN = "power_gain"
|
||||
CONF_VOLTAGE_GAIN = "voltage_gain"
|
||||
|
||||
CONF_NEUTRAL = "neutral"
|
||||
|
||||
|
|
|
@ -6,6 +6,7 @@ from esphome.const import (
|
|||
CONF_IRQ_PIN,
|
||||
CONF_VOLTAGE,
|
||||
CONF_FREQUENCY,
|
||||
CONF_VOLTAGE_GAIN,
|
||||
DEVICE_CLASS_CURRENT,
|
||||
DEVICE_CLASS_APPARENT_POWER,
|
||||
DEVICE_CLASS_POWER,
|
||||
|
@ -36,7 +37,6 @@ CONF_POWER_FACTOR_B = "power_factor_b"
|
|||
CONF_VOLTAGE_PGA_GAIN = "voltage_pga_gain"
|
||||
CONF_CURRENT_PGA_GAIN_A = "current_pga_gain_a"
|
||||
CONF_CURRENT_PGA_GAIN_B = "current_pga_gain_b"
|
||||
CONF_VOLTAGE_GAIN = "voltage_gain"
|
||||
CONF_CURRENT_GAIN_A = "current_gain_a"
|
||||
CONF_CURRENT_GAIN_B = "current_gain_b"
|
||||
CONF_ACTIVE_POWER_GAIN_A = "active_power_gain_a"
|
||||
|
|
|
@ -22,7 +22,6 @@ CONF_AT581X_ID = "at581x_id"
|
|||
|
||||
|
||||
CONF_SENSING_DISTANCE = "sensing_distance"
|
||||
CONF_SENSITIVITY = "sensitivity"
|
||||
CONF_POWERON_SELFCHECK_TIME = "poweron_selfcheck_time"
|
||||
CONF_PROTECT_TIME = "protect_time"
|
||||
CONF_TRIGGER_BASE = "trigger_base"
|
||||
|
|
|
@ -6,6 +6,7 @@ from esphome.const import (
|
|||
CONF_ENERGY,
|
||||
CONF_EXTERNAL_TEMPERATURE,
|
||||
CONF_ID,
|
||||
CONF_INTERNAL_TEMPERATURE,
|
||||
CONF_POWER,
|
||||
CONF_VOLTAGE,
|
||||
DEVICE_CLASS_CURRENT,
|
||||
|
@ -24,7 +25,6 @@ from esphome.const import (
|
|||
|
||||
DEPENDENCIES = ["uart"]
|
||||
|
||||
CONF_INTERNAL_TEMPERATURE = "internal_temperature"
|
||||
|
||||
bl0940_ns = cg.esphome_ns.namespace("bl0940")
|
||||
BL0940 = bl0940_ns.class_("BL0940", cg.PollingComponent, uart.UARTDevice)
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import esphome.codegen as cg
|
||||
import esphome.config_validation as cv
|
||||
from esphome.components import i2c, esp32
|
||||
from esphome.const import CONF_ID
|
||||
from esphome.const import CONF_ID, CONF_TEMPERATURE_OFFSET
|
||||
|
||||
CODEOWNERS = ["@trvrnrth"]
|
||||
DEPENDENCIES = ["i2c"]
|
||||
|
@ -9,7 +9,6 @@ AUTO_LOAD = ["sensor", "text_sensor"]
|
|||
MULTI_CONF = True
|
||||
|
||||
CONF_BME680_BSEC_ID = "bme680_bsec_id"
|
||||
CONF_TEMPERATURE_OFFSET = "temperature_offset"
|
||||
CONF_IAQ_MODE = "iaq_mode"
|
||||
CONF_SUPPLY_VOLTAGE = "supply_voltage"
|
||||
CONF_SAMPLE_RATE = "sample_rate"
|
||||
|
|
|
@ -6,6 +6,7 @@ from esphome.const import (
|
|||
CONF_ID,
|
||||
CONF_POWER,
|
||||
CONF_VOLTAGE,
|
||||
CONF_VOLTAGE_GAIN,
|
||||
UNIT_VOLT,
|
||||
UNIT_AMPERE,
|
||||
UNIT_WATT,
|
||||
|
@ -33,7 +34,6 @@ CONF_SAMPLES = "samples"
|
|||
CONF_PHASE_OFFSET = "phase_offset"
|
||||
CONF_PGA_GAIN = "pga_gain"
|
||||
CONF_CURRENT_GAIN = "current_gain"
|
||||
CONF_VOLTAGE_GAIN = "voltage_gain"
|
||||
CONF_CURRENT_HPF = "current_hpf"
|
||||
CONF_VOLTAGE_HPF = "voltage_hpf"
|
||||
CONF_PULSE_ENERGY = "pulse_energy"
|
||||
|
|
|
@ -1,14 +1,13 @@
|
|||
import esphome.codegen as cg
|
||||
import esphome.config_validation as cv
|
||||
from esphome.components import climate_ir
|
||||
from esphome.const import CONF_ID
|
||||
from esphome.const import CONF_ID, CONF_USE_FAHRENHEIT
|
||||
|
||||
AUTO_LOAD = ["climate_ir"]
|
||||
|
||||
daikin_brc_ns = cg.esphome_ns.namespace("daikin_brc")
|
||||
DaikinBrcClimate = daikin_brc_ns.class_("DaikinBrcClimate", climate_ir.ClimateIR)
|
||||
|
||||
CONF_USE_FAHRENHEIT = "use_fahrenheit"
|
||||
|
||||
CONFIG_SCHEMA = climate_ir.CLIMATE_IR_WITH_RECEIVER_SCHEMA.extend(
|
||||
{
|
||||
|
|
|
@ -169,7 +169,7 @@ async def to_code(config):
|
|||
{
|
||||
cv.Required(CONF_ID): cv.use_id(DateEntity),
|
||||
cv.Required(CONF_DATE): cv.Any(
|
||||
cv.returning_lambda, cv.date_time(allowed_time=False)
|
||||
cv.returning_lambda, cv.date_time(date=True, time=False)
|
||||
),
|
||||
}
|
||||
),
|
||||
|
@ -200,7 +200,7 @@ async def datetime_date_set_to_code(config, action_id, template_arg, args):
|
|||
{
|
||||
cv.Required(CONF_ID): cv.use_id(TimeEntity),
|
||||
cv.Required(CONF_TIME): cv.Any(
|
||||
cv.returning_lambda, cv.date_time(allowed_date=False)
|
||||
cv.returning_lambda, cv.date_time(date=False, time=True)
|
||||
),
|
||||
}
|
||||
),
|
||||
|
@ -230,7 +230,9 @@ async def datetime_time_set_to_code(config, action_id, template_arg, args):
|
|||
cv.Schema(
|
||||
{
|
||||
cv.Required(CONF_ID): cv.use_id(DateTimeEntity),
|
||||
cv.Required(CONF_DATETIME): cv.Any(cv.returning_lambda, cv.date_time()),
|
||||
cv.Required(CONF_DATETIME): cv.Any(
|
||||
cv.returning_lambda, cv.date_time(date=True, time=True)
|
||||
),
|
||||
},
|
||||
),
|
||||
)
|
||||
|
|
|
@ -2,7 +2,7 @@ import esphome.codegen as cg
|
|||
import esphome.config_validation as cv
|
||||
from esphome import automation
|
||||
from esphome.automation import maybe_simple_id
|
||||
from esphome.const import CONF_ID
|
||||
from esphome.const import CONF_FACTORY_RESET, CONF_ID, CONF_SENSITIVITY
|
||||
from esphome.components import uart
|
||||
|
||||
CODEOWNERS = ["@niklasweber"]
|
||||
|
@ -28,8 +28,6 @@ CONF_DELAY_AFTER_DETECT = "delay_after_detect"
|
|||
CONF_DELAY_AFTER_DISAPPEAR = "delay_after_disappear"
|
||||
CONF_DETECTION_SEGMENTS = "detection_segments"
|
||||
CONF_OUTPUT_LATENCY = "output_latency"
|
||||
CONF_FACTORY_RESET = "factory_reset"
|
||||
CONF_SENSITIVITY = "sensitivity"
|
||||
|
||||
CONFIG_SCHEMA = cv.All(
|
||||
cv.Schema(
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -4,6 +4,7 @@ from esphome.components import sensor
|
|||
from esphome.const import (
|
||||
CONF_EXTERNAL_TEMPERATURE,
|
||||
CONF_ID,
|
||||
CONF_INTERNAL_TEMPERATURE,
|
||||
CONF_SPEED,
|
||||
DEVICE_CLASS_TEMPERATURE,
|
||||
STATE_CLASS_MEASUREMENT,
|
||||
|
@ -16,7 +17,6 @@ from .. import EMC2101_COMPONENT_SCHEMA, CONF_EMC2101_ID, emc2101_ns
|
|||
|
||||
DEPENDENCIES = ["emc2101"]
|
||||
|
||||
CONF_INTERNAL_TEMPERATURE = "internal_temperature"
|
||||
CONF_DUTY_CYCLE = "duty_cycle"
|
||||
|
||||
EMC2101Sensor = emc2101_ns.class_("EMC2101Sensor", cg.PollingComponent)
|
||||
|
|
|
@ -2,6 +2,7 @@ import esphome.codegen as cg
|
|||
import esphome.config_validation as cv
|
||||
from esphome.components import i2c, sensor
|
||||
from esphome.const import (
|
||||
CONF_COMPENSATION,
|
||||
CONF_ECO2,
|
||||
CONF_HUMIDITY,
|
||||
CONF_ID,
|
||||
|
@ -27,7 +28,6 @@ ENS160Component = ens160_ns.class_(
|
|||
)
|
||||
|
||||
CONF_AQI = "aqi"
|
||||
CONF_COMPENSATION = "compensation"
|
||||
UNIT_INDEX = "index"
|
||||
|
||||
CONFIG_SCHEMA = (
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import esphome.codegen as cg
|
||||
import esphome.config_validation as cv
|
||||
from esphome import automation
|
||||
from esphome.const import CONF_ID
|
||||
from esphome.const import CONF_ENABLE_ON_BOOT, CONF_ID
|
||||
from esphome.core import CORE
|
||||
from esphome.components.esp32 import add_idf_sdkconfig_option, get_esp32_variant, const
|
||||
|
||||
|
@ -11,7 +11,6 @@ CONFLICTS_WITH = ["esp32_ble_beacon"]
|
|||
|
||||
CONF_BLE_ID = "ble_id"
|
||||
CONF_IO_CAPABILITY = "io_capability"
|
||||
CONF_ENABLE_ON_BOOT = "enable_on_boot"
|
||||
|
||||
NO_BLUETOOTH_VARIANTS = [const.VARIANT_ESP32S2]
|
||||
|
||||
|
|
|
@ -14,6 +14,7 @@ from esphome.const import (
|
|||
CONF_BRIGHTNESS,
|
||||
CONF_CONTRAST,
|
||||
CONF_TRIGGER_ID,
|
||||
CONF_VSYNC_PIN,
|
||||
)
|
||||
from esphome.core import CORE
|
||||
from esphome.components.esp32 import add_idf_sdkconfig_option
|
||||
|
@ -112,7 +113,6 @@ ENUM_SPECIAL_EFFECT = {
|
|||
}
|
||||
|
||||
# pin assignment
|
||||
CONF_VSYNC_PIN = "vsync_pin"
|
||||
CONF_HREF_PIN = "href_pin"
|
||||
CONF_PIXEL_CLOCK_PIN = "pixel_clock_pin"
|
||||
CONF_EXTERNAL_CLOCK = "external_clock"
|
||||
|
|
|
@ -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,7 +1,7 @@
|
|||
import esphome.codegen as cg
|
||||
import esphome.config_validation as cv
|
||||
from esphome.components import display, font, color
|
||||
from esphome.const import CONF_ID, CONF_TRIGGER_ID
|
||||
from esphome.const import CONF_DISPLAY, CONF_ID, CONF_TRIGGER_ID
|
||||
from esphome import automation, core
|
||||
|
||||
from esphome.components.display_menu_base import (
|
||||
|
@ -10,7 +10,6 @@ from esphome.components.display_menu_base import (
|
|||
display_menu_to_code,
|
||||
)
|
||||
|
||||
CONF_DISPLAY = "display"
|
||||
CONF_FONT = "font"
|
||||
CONF_MENU_ITEM_VALUE = "menu_item_value"
|
||||
CONF_FOREGROUND_COLOR = "foreground_color"
|
||||
|
|
|
@ -6,12 +6,14 @@ from esphome.components import uart, climate, logger
|
|||
from esphome import automation
|
||||
from esphome.const import (
|
||||
CONF_BEEPER,
|
||||
CONF_DISPLAY,
|
||||
CONF_ID,
|
||||
CONF_LEVEL,
|
||||
CONF_LOGGER,
|
||||
CONF_LOGS,
|
||||
CONF_MAX_TEMPERATURE,
|
||||
CONF_MIN_TEMPERATURE,
|
||||
CONF_OUTDOOR_TEMPERATURE,
|
||||
CONF_PROTOCOL,
|
||||
CONF_SUPPORTED_MODES,
|
||||
CONF_SUPPORTED_PRESETS,
|
||||
|
@ -43,11 +45,9 @@ CONF_ALTERNATIVE_SWING_CONTROL = "alternative_swing_control"
|
|||
CONF_ANSWER_TIMEOUT = "answer_timeout"
|
||||
CONF_CONTROL_METHOD = "control_method"
|
||||
CONF_CONTROL_PACKET_SIZE = "control_packet_size"
|
||||
CONF_DISPLAY = "display"
|
||||
CONF_HORIZONTAL_AIRFLOW = "horizontal_airflow"
|
||||
CONF_ON_ALARM_START = "on_alarm_start"
|
||||
CONF_ON_ALARM_END = "on_alarm_end"
|
||||
CONF_OUTDOOR_TEMPERATURE = "outdoor_temperature"
|
||||
CONF_VERTICAL_AIRFLOW = "vertical_airflow"
|
||||
CONF_WIFI_SIGNAL = "wifi_signal"
|
||||
|
||||
|
|
|
@ -2,6 +2,7 @@ import esphome.codegen as cg
|
|||
import esphome.config_validation as cv
|
||||
from esphome.components import sensor
|
||||
from esphome.const import (
|
||||
CONF_OUTDOOR_TEMPERATURE,
|
||||
CONF_POWER,
|
||||
CONF_HUMIDITY,
|
||||
DEVICE_CLASS_CURRENT,
|
||||
|
@ -41,7 +42,6 @@ CONF_OUTDOOR_COIL_TEMPERATURE = "outdoor_coil_temperature"
|
|||
CONF_OUTDOOR_DEFROST_TEMPERATURE = "outdoor_defrost_temperature"
|
||||
CONF_OUTDOOR_IN_AIR_TEMPERATURE = "outdoor_in_air_temperature"
|
||||
CONF_OUTDOOR_OUT_AIR_TEMPERATURE = "outdoor_out_air_temperature"
|
||||
CONF_OUTDOOR_TEMPERATURE = "outdoor_temperature"
|
||||
|
||||
# Additional icons
|
||||
ICON_SNOWFLAKE_THERMOMETER = "mdi:snowflake-thermometer"
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -6,6 +6,7 @@ from esphome.const import (
|
|||
CONF_FIELD_STRENGTH_X,
|
||||
CONF_FIELD_STRENGTH_Y,
|
||||
CONF_FIELD_STRENGTH_Z,
|
||||
CONF_HEADING,
|
||||
CONF_ID,
|
||||
CONF_OVERSAMPLING,
|
||||
CONF_RANGE,
|
||||
|
@ -21,7 +22,6 @@ DEPENDENCIES = ["i2c"]
|
|||
|
||||
hmc5883l_ns = cg.esphome_ns.namespace("hmc5883l")
|
||||
|
||||
CONF_HEADING = "heading"
|
||||
|
||||
HMC5883LComponent = hmc5883l_ns.class_(
|
||||
"HMC5883LComponent", cg.PollingComponent, i2c.I2CDevice
|
||||
|
|
|
@ -7,6 +7,7 @@ from esphome.const import (
|
|||
CONF_ID,
|
||||
CONF_LAMBDA,
|
||||
CONF_MODEL,
|
||||
CONF_OE_PIN,
|
||||
CONF_PAGES,
|
||||
CONF_WAKEUP_PIN,
|
||||
)
|
||||
|
@ -29,7 +30,6 @@ CONF_GREYSCALE = "greyscale"
|
|||
CONF_GMOD_PIN = "gmod_pin"
|
||||
CONF_GPIO0_ENABLE_PIN = "gpio0_enable_pin"
|
||||
CONF_LE_PIN = "le_pin"
|
||||
CONF_OE_PIN = "oe_pin"
|
||||
CONF_PARTIAL_UPDATING = "partial_updating"
|
||||
CONF_POWERUP_PIN = "powerup_pin"
|
||||
CONF_SPH_PIN = "sph_pin"
|
||||
|
|
|
@ -3,6 +3,7 @@ import esphome.config_validation as cv
|
|||
from esphome.components import i2c, sensor
|
||||
from esphome.const import (
|
||||
CONF_ID,
|
||||
CONF_INTERNAL_TEMPERATURE,
|
||||
CONF_TEMPERATURE,
|
||||
DEVICE_CLASS_TEMPERATURE,
|
||||
STATE_CLASS_MEASUREMENT,
|
||||
|
@ -10,7 +11,6 @@ from esphome.const import (
|
|||
ENTITY_CATEGORY_DIAGNOSTIC,
|
||||
)
|
||||
|
||||
CONF_INTERNAL_TEMPERATURE = "internal_temperature"
|
||||
DEPENDENCIES = ["i2c"]
|
||||
|
||||
kmeteriso_ns = cg.esphome_ns.namespace("kmeteriso")
|
||||
|
|
|
@ -8,13 +8,13 @@ from esphome.const import (
|
|||
ENTITY_CATEGORY_DIAGNOSTIC,
|
||||
ICON_MOTION_SENSOR,
|
||||
ICON_ACCOUNT,
|
||||
CONF_HAS_TARGET,
|
||||
CONF_HAS_MOVING_TARGET,
|
||||
CONF_HAS_STILL_TARGET,
|
||||
)
|
||||
from . import CONF_LD2410_ID, LD2410Component
|
||||
|
||||
DEPENDENCIES = ["ld2410"]
|
||||
CONF_HAS_TARGET = "has_target"
|
||||
CONF_HAS_MOVING_TARGET = "has_moving_target"
|
||||
CONF_HAS_STILL_TARGET = "has_still_target"
|
||||
CONF_OUT_PIN_PRESENCE_STATUS = "out_pin_presence_status"
|
||||
|
||||
CONFIG_SCHEMA = {
|
||||
|
|
|
@ -2,6 +2,8 @@ import esphome.codegen as cg
|
|||
from esphome.components import button
|
||||
import esphome.config_validation as cv
|
||||
from esphome.const import (
|
||||
CONF_FACTORY_RESET,
|
||||
CONF_RESTART,
|
||||
DEVICE_CLASS_RESTART,
|
||||
ENTITY_CATEGORY_DIAGNOSTIC,
|
||||
ENTITY_CATEGORY_CONFIG,
|
||||
|
@ -15,8 +17,6 @@ QueryButton = ld2410_ns.class_("QueryButton", button.Button)
|
|||
ResetButton = ld2410_ns.class_("ResetButton", button.Button)
|
||||
RestartButton = ld2410_ns.class_("RestartButton", button.Button)
|
||||
|
||||
CONF_FACTORY_RESET = "factory_reset"
|
||||
CONF_RESTART = "restart"
|
||||
CONF_QUERY_PARAMS = "query_params"
|
||||
|
||||
CONFIG_SCHEMA = {
|
||||
|
|
|
@ -1,14 +1,13 @@
|
|||
import esphome.codegen as cg
|
||||
import esphome.config_validation as cv
|
||||
from esphome.components import binary_sensor
|
||||
from esphome.const import CONF_ID, DEVICE_CLASS_OCCUPANCY
|
||||
from esphome.const import CONF_ID, DEVICE_CLASS_OCCUPANCY, CONF_HAS_TARGET
|
||||
from .. import ld2420_ns, LD2420Component, CONF_LD2420_ID
|
||||
|
||||
LD2420BinarySensor = ld2420_ns.class_(
|
||||
"LD2420BinarySensor", binary_sensor.BinarySensor, cg.Component
|
||||
)
|
||||
|
||||
CONF_HAS_TARGET = "has_target"
|
||||
|
||||
CONFIG_SCHEMA = cv.All(
|
||||
cv.COMPONENT_SCHEMA.extend(
|
||||
|
|
|
@ -2,6 +2,7 @@ import esphome.codegen as cg
|
|||
from esphome.components import button
|
||||
import esphome.config_validation as cv
|
||||
from esphome.const import (
|
||||
CONF_FACTORY_RESET,
|
||||
DEVICE_CLASS_RESTART,
|
||||
ENTITY_CATEGORY_DIAGNOSTIC,
|
||||
ENTITY_CATEGORY_CONFIG,
|
||||
|
@ -19,7 +20,6 @@ LD2420FactoryResetButton = ld2420_ns.class_("LD2420FactoryResetButton", button.B
|
|||
CONF_APPLY_CONFIG = "apply_config"
|
||||
CONF_REVERT_CONFIG = "revert_config"
|
||||
CONF_RESTART_MODULE = "restart_module"
|
||||
CONF_FACTORY_RESET = "factory_reset"
|
||||
|
||||
|
||||
CONFIG_SCHEMA = {
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -4,6 +4,7 @@ from esphome.components import sensor, voltage_sampler
|
|||
from esphome.const import (
|
||||
CONF_ID,
|
||||
CONF_NUMBER,
|
||||
CONF_REFERENCE_VOLTAGE,
|
||||
UNIT_VOLT,
|
||||
STATE_CLASS_MEASUREMENT,
|
||||
DEVICE_CLASS_VOLTAGE,
|
||||
|
@ -22,7 +23,6 @@ MCP3008Sensor = mcp3008_ns.class_(
|
|||
voltage_sampler.VoltageSampler,
|
||||
cg.Parented.template(MCP3008),
|
||||
)
|
||||
CONF_REFERENCE_VOLTAGE = "reference_voltage"
|
||||
CONF_MCP3008_ID = "mcp3008_id"
|
||||
|
||||
CONFIG_SCHEMA = (
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import esphome.codegen as cg
|
||||
import esphome.config_validation as cv
|
||||
from esphome.components import spi
|
||||
from esphome.const import CONF_ID
|
||||
from esphome.const import CONF_ID, CONF_REFERENCE_VOLTAGE
|
||||
|
||||
DEPENDENCIES = ["spi"]
|
||||
MULTI_CONF = True
|
||||
|
@ -10,7 +10,6 @@ CODEOWNERS = ["@rsumner"]
|
|||
mcp3204_ns = cg.esphome_ns.namespace("mcp3204")
|
||||
MCP3204 = mcp3204_ns.class_("MCP3204", cg.Component, spi.SPIDevice)
|
||||
|
||||
CONF_REFERENCE_VOLTAGE = "reference_voltage"
|
||||
|
||||
CONFIG_SCHEMA = cv.Schema(
|
||||
{
|
||||
|
|
|
@ -11,6 +11,7 @@ from esphome.const import (
|
|||
CONF_CUSTOM_PRESETS,
|
||||
CONF_ID,
|
||||
CONF_NUM_ATTEMPTS,
|
||||
CONF_OUTDOOR_TEMPERATURE,
|
||||
CONF_PERIOD,
|
||||
CONF_SUPPORTED_MODES,
|
||||
CONF_SUPPORTED_PRESETS,
|
||||
|
@ -37,7 +38,6 @@ from esphome.components.climate import (
|
|||
CODEOWNERS = ["@dudanov"]
|
||||
DEPENDENCIES = ["climate", "uart"]
|
||||
AUTO_LOAD = ["sensor"]
|
||||
CONF_OUTDOOR_TEMPERATURE = "outdoor_temperature"
|
||||
CONF_POWER_USAGE = "power_usage"
|
||||
CONF_HUMIDITY_SETPOINT = "humidity_setpoint"
|
||||
midea_ac_ns = cg.esphome_ns.namespace("midea").namespace("ac")
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import esphome.codegen as cg
|
||||
import esphome.config_validation as cv
|
||||
from esphome.components import climate_ir
|
||||
from esphome.const import CONF_ID
|
||||
from esphome.const import CONF_ID, CONF_USE_FAHRENHEIT
|
||||
|
||||
AUTO_LOAD = ["climate_ir", "coolix"]
|
||||
CODEOWNERS = ["@dudanov"]
|
||||
|
@ -9,7 +9,6 @@ CODEOWNERS = ["@dudanov"]
|
|||
midea_ir_ns = cg.esphome_ns.namespace("midea_ir")
|
||||
MideaIR = midea_ir_ns.class_("MideaIR", climate_ir.ClimateIR)
|
||||
|
||||
CONF_USE_FAHRENHEIT = "use_fahrenheit"
|
||||
|
||||
CONFIG_SCHEMA = climate_ir.CLIMATE_IR_WITH_RECEIVER_SCHEMA.extend(
|
||||
{
|
||||
|
|
|
@ -6,6 +6,7 @@ from esphome.const import (
|
|||
CONF_FIELD_STRENGTH_X,
|
||||
CONF_FIELD_STRENGTH_Y,
|
||||
CONF_FIELD_STRENGTH_Z,
|
||||
CONF_HEADING,
|
||||
CONF_ID,
|
||||
ICON_MAGNET,
|
||||
STATE_CLASS_MEASUREMENT,
|
||||
|
@ -19,8 +20,6 @@ DEPENDENCIES = ["i2c"]
|
|||
|
||||
mmc5603_ns = cg.esphome_ns.namespace("mmc5603")
|
||||
|
||||
CONF_HEADING = "heading"
|
||||
|
||||
MMC5603Component = mmc5603_ns.class_(
|
||||
"MMC5603Component", cg.PollingComponent, i2c.I2CDevice
|
||||
)
|
||||
|
|
|
@ -2,14 +2,19 @@ import esphome.codegen as cg
|
|||
import esphome.config_validation as cv
|
||||
from esphome import automation
|
||||
from esphome.components import nfc
|
||||
from esphome.const import CONF_ID, CONF_ON_TAG_REMOVED, CONF_ON_TAG, CONF_TRIGGER_ID
|
||||
from esphome.const import (
|
||||
CONF_ID,
|
||||
CONF_ON_FINISHED_WRITE,
|
||||
CONF_ON_TAG_REMOVED,
|
||||
CONF_ON_TAG,
|
||||
CONF_TRIGGER_ID,
|
||||
)
|
||||
|
||||
CODEOWNERS = ["@OttoWinter", "@jesserockz"]
|
||||
AUTO_LOAD = ["binary_sensor", "nfc"]
|
||||
MULTI_CONF = True
|
||||
|
||||
CONF_PN532_ID = "pn532_id"
|
||||
CONF_ON_FINISHED_WRITE = "on_finished_write"
|
||||
|
||||
pn532_ns = cg.esphome_ns.namespace("pn532")
|
||||
PN532 = pn532_ns.class_("PN532", cg.PollingComponent)
|
||||
|
|
|
@ -6,6 +6,8 @@ from esphome.components import nfc
|
|||
from esphome.const import (
|
||||
CONF_ID,
|
||||
CONF_IRQ_PIN,
|
||||
CONF_MESSAGE,
|
||||
CONF_ON_FINISHED_WRITE,
|
||||
CONF_ON_TAG_REMOVED,
|
||||
CONF_ON_TAG,
|
||||
CONF_TRIGGER_ID,
|
||||
|
@ -18,8 +20,6 @@ CONF_EMULATION_MESSAGE = "emulation_message"
|
|||
CONF_EMULATION_OFF = "emulation_off"
|
||||
CONF_EMULATION_ON = "emulation_on"
|
||||
CONF_INCLUDE_ANDROID_APP_RECORD = "include_android_app_record"
|
||||
CONF_MESSAGE = "message"
|
||||
CONF_ON_FINISHED_WRITE = "on_finished_write"
|
||||
CONF_ON_EMULATED_TAG_SCAN = "on_emulated_tag_scan"
|
||||
CONF_PN7150_ID = "pn7150_id"
|
||||
CONF_POLLING_OFF = "polling_off"
|
||||
|
|
|
@ -6,6 +6,8 @@ from esphome.components import nfc
|
|||
from esphome.const import (
|
||||
CONF_ID,
|
||||
CONF_IRQ_PIN,
|
||||
CONF_MESSAGE,
|
||||
CONF_ON_FINISHED_WRITE,
|
||||
CONF_ON_TAG_REMOVED,
|
||||
CONF_ON_TAG,
|
||||
CONF_TRIGGER_ID,
|
||||
|
@ -19,8 +21,6 @@ CONF_EMULATION_MESSAGE = "emulation_message"
|
|||
CONF_EMULATION_OFF = "emulation_off"
|
||||
CONF_EMULATION_ON = "emulation_on"
|
||||
CONF_INCLUDE_ANDROID_APP_RECORD = "include_android_app_record"
|
||||
CONF_MESSAGE = "message"
|
||||
CONF_ON_FINISHED_WRITE = "on_finished_write"
|
||||
CONF_ON_EMULATED_TAG_SCAN = "on_emulated_tag_scan"
|
||||
CONF_PN7160_ID = "pn7160_id"
|
||||
CONF_POLLING_OFF = "polling_off"
|
||||
|
|
|
@ -1,15 +1,19 @@
|
|||
import esphome.codegen as cg
|
||||
import esphome.config_validation as cv
|
||||
from esphome import pins
|
||||
from esphome.const import CONF_ENABLE_TIME, CONF_ID, CONF_KEEP_ON_TIME, CONF_PIN
|
||||
from esphome.const import (
|
||||
CONF_ENABLE_ON_BOOT,
|
||||
CONF_ENABLE_TIME,
|
||||
CONF_ID,
|
||||
CONF_KEEP_ON_TIME,
|
||||
CONF_PIN,
|
||||
)
|
||||
|
||||
CODEOWNERS = ["@esphome/core"]
|
||||
power_supply_ns = cg.esphome_ns.namespace("power_supply")
|
||||
PowerSupply = power_supply_ns.class_("PowerSupply", cg.Component)
|
||||
MULTI_CONF = True
|
||||
|
||||
CONF_ENABLE_ON_BOOT = "enable_on_boot"
|
||||
|
||||
CONFIG_SCHEMA = cv.Schema(
|
||||
{
|
||||
cv.Required(CONF_ID): cv.declare_id(PowerSupply),
|
||||
|
|
|
@ -6,6 +6,7 @@ from esphome.const import (
|
|||
CONF_FIELD_STRENGTH_X,
|
||||
CONF_FIELD_STRENGTH_Y,
|
||||
CONF_FIELD_STRENGTH_Z,
|
||||
CONF_HEADING,
|
||||
CONF_TEMPERATURE,
|
||||
CONF_ID,
|
||||
CONF_OVERSAMPLING,
|
||||
|
@ -24,8 +25,6 @@ DEPENDENCIES = ["i2c"]
|
|||
|
||||
qmc5883l_ns = cg.esphome_ns.namespace("qmc5883l")
|
||||
|
||||
CONF_HEADING = "heading"
|
||||
|
||||
QMC5883LComponent = qmc5883l_ns.class_(
|
||||
"QMC5883LComponent", cg.PollingComponent, i2c.I2CDevice
|
||||
)
|
||||
|
|
|
@ -2,6 +2,7 @@ import esphome.codegen as cg
|
|||
import esphome.config_validation as cv
|
||||
from esphome.components import sensor, resistance_sampler
|
||||
from esphome.const import (
|
||||
CONF_REFERENCE_VOLTAGE,
|
||||
CONF_SENSOR,
|
||||
STATE_CLASS_MEASUREMENT,
|
||||
UNIT_OHM,
|
||||
|
@ -18,7 +19,6 @@ ResistanceSensor = resistance_ns.class_(
|
|||
resistance_sampler.ResistanceSampler,
|
||||
)
|
||||
|
||||
CONF_REFERENCE_VOLTAGE = "reference_voltage"
|
||||
CONF_CONFIGURATION = "configuration"
|
||||
CONF_RESISTOR = "resistor"
|
||||
|
||||
|
|
|
@ -3,11 +3,13 @@ import esphome.config_validation as cv
|
|||
from esphome import pins
|
||||
from esphome.components import display
|
||||
from esphome.const import (
|
||||
CONF_HSYNC_PIN,
|
||||
CONF_RESET_PIN,
|
||||
CONF_DATA_PINS,
|
||||
CONF_ID,
|
||||
CONF_IGNORE_STRAPPING_WARNING,
|
||||
CONF_DIMENSIONS,
|
||||
CONF_VSYNC_PIN,
|
||||
CONF_WIDTH,
|
||||
CONF_HEIGHT,
|
||||
CONF_LAMBDA,
|
||||
|
@ -29,8 +31,6 @@ DEPENDENCIES = ["esp32"]
|
|||
|
||||
CONF_DE_PIN = "de_pin"
|
||||
CONF_PCLK_PIN = "pclk_pin"
|
||||
CONF_HSYNC_PIN = "hsync_pin"
|
||||
CONF_VSYNC_PIN = "vsync_pin"
|
||||
|
||||
CONF_HSYNC_FRONT_PORCH = "hsync_front_porch"
|
||||
CONF_HSYNC_PULSE_WIDTH = "hsync_pulse_width"
|
||||
|
|
|
@ -8,6 +8,7 @@ from esphome.const import (
|
|||
CONF_HUMIDITY,
|
||||
CONF_TEMPERATURE,
|
||||
CONF_CO2,
|
||||
CONF_TEMPERATURE_OFFSET,
|
||||
CONF_UPDATE_INTERVAL,
|
||||
CONF_VALUE,
|
||||
DEVICE_CLASS_CARBON_DIOXIDE,
|
||||
|
@ -36,7 +37,6 @@ ForceRecalibrationWithReference = scd30_ns.class_(
|
|||
CONF_AUTOMATIC_SELF_CALIBRATION = "automatic_self_calibration"
|
||||
CONF_ALTITUDE_COMPENSATION = "altitude_compensation"
|
||||
CONF_AMBIENT_PRESSURE_COMPENSATION = "ambient_pressure_compensation"
|
||||
CONF_TEMPERATURE_OFFSET = "temperature_offset"
|
||||
|
||||
|
||||
CONFIG_SCHEMA = (
|
||||
|
|
|
@ -10,6 +10,7 @@ from esphome.const import (
|
|||
CONF_CO2,
|
||||
CONF_HUMIDITY,
|
||||
CONF_TEMPERATURE,
|
||||
CONF_TEMPERATURE_OFFSET,
|
||||
CONF_VALUE,
|
||||
DEVICE_CLASS_CARBON_DIOXIDE,
|
||||
DEVICE_CLASS_HUMIDITY,
|
||||
|
@ -52,7 +53,6 @@ CONF_AMBIENT_PRESSURE_COMPENSATION = "ambient_pressure_compensation"
|
|||
CONF_AMBIENT_PRESSURE_COMPENSATION_SOURCE = "ambient_pressure_compensation_source"
|
||||
CONF_AUTOMATIC_SELF_CALIBRATION = "automatic_self_calibration"
|
||||
CONF_MEASUREMENT_MODE = "measurement_mode"
|
||||
CONF_TEMPERATURE_OFFSET = "temperature_offset"
|
||||
|
||||
|
||||
CONFIG_SCHEMA = (
|
||||
|
|
|
@ -2,7 +2,7 @@ import esphome.codegen as cg
|
|||
import esphome.config_validation as cv
|
||||
from esphome import automation
|
||||
from esphome.automation import maybe_simple_id
|
||||
from esphome.const import CONF_ID, CONF_MODE, CONF_PARAMETERS
|
||||
from esphome.const import CONF_ID, CONF_MODE, CONF_PARAMETERS, CONF_RESTART
|
||||
from esphome.core import CORE, EsphomeError
|
||||
|
||||
CODEOWNERS = ["@esphome/core"]
|
||||
|
@ -19,7 +19,6 @@ ParallelScript = script_ns.class_("ParallelScript", Script)
|
|||
|
||||
CONF_SCRIPT = "script"
|
||||
CONF_SINGLE = "single"
|
||||
CONF_RESTART = "restart"
|
||||
CONF_QUEUED = "queued"
|
||||
CONF_PARALLEL = "parallel"
|
||||
CONF_MAX_RUNS = "max_runs"
|
||||
|
|
|
@ -3,10 +3,10 @@ from esphome.components import binary_sensor
|
|||
import esphome.config_validation as cv
|
||||
from esphome.const import (
|
||||
DEVICE_CLASS_OCCUPANCY,
|
||||
CONF_HAS_TARGET,
|
||||
)
|
||||
from . import CONF_MR24HPC1_ID, MR24HPC1Component
|
||||
|
||||
CONF_HAS_TARGET = "has_target"
|
||||
|
||||
CONFIG_SCHEMA = {
|
||||
cv.GenerateID(CONF_MR24HPC1_ID): cv.use_id(MR24HPC1Component),
|
||||
|
|
|
@ -2,6 +2,7 @@ import esphome.codegen as cg
|
|||
from esphome.components import button
|
||||
import esphome.config_validation as cv
|
||||
from esphome.const import (
|
||||
CONF_RESTART,
|
||||
DEVICE_CLASS_RESTART,
|
||||
ENTITY_CATEGORY_CONFIG,
|
||||
ICON_RESTART_ALERT,
|
||||
|
@ -11,7 +12,6 @@ from .. import CONF_MR24HPC1_ID, MR24HPC1Component, mr24hpc1_ns
|
|||
RestartButton = mr24hpc1_ns.class_("RestartButton", button.Button)
|
||||
CustomSetEndButton = mr24hpc1_ns.class_("CustomSetEndButton", button.Button)
|
||||
|
||||
CONF_RESTART = "restart"
|
||||
CONF_CUSTOM_SET_END = "custom_set_end"
|
||||
|
||||
CONFIG_SCHEMA = {
|
||||
|
|
|
@ -2,6 +2,7 @@ import esphome.codegen as cg
|
|||
from esphome.components import number
|
||||
import esphome.config_validation as cv
|
||||
from esphome.const import (
|
||||
CONF_SENSITIVITY,
|
||||
ENTITY_CATEGORY_CONFIG,
|
||||
)
|
||||
from .. import CONF_MR24HPC1_ID, MR24HPC1Component, mr24hpc1_ns
|
||||
|
@ -14,7 +15,6 @@ MotionTriggerTimeNumber = mr24hpc1_ns.class_("MotionTriggerTimeNumber", number.N
|
|||
MotionToRestTimeNumber = mr24hpc1_ns.class_("MotionToRestTimeNumber", number.Number)
|
||||
CustomUnmanTimeNumber = mr24hpc1_ns.class_("CustomUnmanTimeNumber", number.Number)
|
||||
|
||||
CONF_SENSITIVITY = "sensitivity"
|
||||
CONF_CUSTOM_MODE = "custom_mode"
|
||||
CONF_EXISTENCE_THRESHOLD = "existence_threshold"
|
||||
CONF_MOTION_THRESHOLD = "motion_threshold"
|
||||
|
|
|
@ -3,6 +3,7 @@ import esphome.config_validation as cv
|
|||
from esphome.components import i2c, sensor, sensirion_common
|
||||
|
||||
from esphome.const import (
|
||||
CONF_COMPENSATION,
|
||||
CONF_ID,
|
||||
CONF_BASELINE,
|
||||
CONF_ECO2,
|
||||
|
@ -30,7 +31,6 @@ SGP30Component = sgp30_ns.class_(
|
|||
CONF_ECO2_BASELINE = "eco2_baseline"
|
||||
CONF_TVOC_BASELINE = "tvoc_baseline"
|
||||
CONF_UPTIME = "uptime"
|
||||
CONF_COMPENSATION = "compensation"
|
||||
CONF_HUMIDITY_SOURCE = "humidity_source"
|
||||
|
||||
|
||||
|
|
|
@ -2,6 +2,7 @@ import esphome.codegen as cg
|
|||
import esphome.config_validation as cv
|
||||
from esphome.components import i2c, sensor, sensirion_common
|
||||
from esphome.const import (
|
||||
CONF_COMPENSATION,
|
||||
CONF_ID,
|
||||
CONF_STORE_BASELINE,
|
||||
CONF_TEMPERATURE_SOURCE,
|
||||
|
@ -23,7 +24,6 @@ SGP4xComponent = sgp4x_ns.class_(
|
|||
)
|
||||
|
||||
CONF_ALGORITHM_TUNING = "algorithm_tuning"
|
||||
CONF_COMPENSATION = "compensation"
|
||||
CONF_GAIN_FACTOR = "gain_factor"
|
||||
CONF_GATING_MAX_DURATION_MINUTES = "gating_max_duration_minutes"
|
||||
CONF_HUMIDITY_SOURCE = "humidity_source"
|
||||
|
|
|
@ -3,6 +3,7 @@ import esphome.config_validation as cv
|
|||
from esphome import automation
|
||||
from esphome.const import (
|
||||
CONF_ID,
|
||||
CONF_MESSAGE,
|
||||
CONF_TRIGGER_ID,
|
||||
)
|
||||
from esphome.components import uart
|
||||
|
@ -52,7 +53,6 @@ CONF_ON_INCOMING_CALL = "on_incoming_call"
|
|||
CONF_ON_CALL_CONNECTED = "on_call_connected"
|
||||
CONF_ON_CALL_DISCONNECTED = "on_call_disconnected"
|
||||
CONF_RECIPIENT = "recipient"
|
||||
CONF_MESSAGE = "message"
|
||||
CONF_USSD = "ussd"
|
||||
|
||||
CONFIG_SCHEMA = cv.All(
|
||||
|
|
|
@ -8,6 +8,7 @@ from esphome.const import (
|
|||
CONF_INVERTED,
|
||||
CONF_DATA_PIN,
|
||||
CONF_CLOCK_PIN,
|
||||
CONF_OE_PIN,
|
||||
CONF_OUTPUT,
|
||||
CONF_TYPE,
|
||||
)
|
||||
|
@ -30,7 +31,6 @@ SN74HC595GPIOPin = sn74hc595_ns.class_(
|
|||
|
||||
CONF_SN74HC595 = "sn74hc595"
|
||||
CONF_LATCH_PIN = "latch_pin"
|
||||
CONF_OE_PIN = "oe_pin"
|
||||
CONF_SR_COUNT = "sr_count"
|
||||
|
||||
TYPE_GPIO = "gpio"
|
||||
|
|
|
@ -7,10 +7,12 @@ from esphome.components import (
|
|||
)
|
||||
from esphome.const import (
|
||||
CONF_DC_PIN,
|
||||
CONF_HSYNC_PIN,
|
||||
CONF_RESET_PIN,
|
||||
CONF_DATA_PINS,
|
||||
CONF_ID,
|
||||
CONF_DIMENSIONS,
|
||||
CONF_VSYNC_PIN,
|
||||
CONF_WIDTH,
|
||||
CONF_HEIGHT,
|
||||
CONF_LAMBDA,
|
||||
|
@ -44,8 +46,6 @@ from .init_sequences import (
|
|||
CONF_INIT_SEQUENCE = "init_sequence"
|
||||
CONF_DE_PIN = "de_pin"
|
||||
CONF_PCLK_PIN = "pclk_pin"
|
||||
CONF_HSYNC_PIN = "hsync_pin"
|
||||
CONF_VSYNC_PIN = "vsync_pin"
|
||||
|
||||
CONF_HSYNC_PULSE_WIDTH = "hsync_pulse_width"
|
||||
CONF_HSYNC_BACK_PORCH = "hsync_back_porch"
|
||||
|
|
|
@ -72,21 +72,25 @@ CONFIG_SCHEMA = cv.All(
|
|||
.extend(_BASE_SCHEMA)
|
||||
.extend(
|
||||
{
|
||||
cv.Optional(CONF_INITIAL_VALUE): cv.date_time(allowed_time=False),
|
||||
cv.Optional(CONF_INITIAL_VALUE): cv.date_time(
|
||||
date=True, time=False
|
||||
),
|
||||
}
|
||||
),
|
||||
"TIME": datetime.time_schema(TemplateTime)
|
||||
.extend(_BASE_SCHEMA)
|
||||
.extend(
|
||||
{
|
||||
cv.Optional(CONF_INITIAL_VALUE): cv.date_time(allowed_date=False),
|
||||
cv.Optional(CONF_INITIAL_VALUE): cv.date_time(
|
||||
date=False, time=True
|
||||
),
|
||||
}
|
||||
),
|
||||
"DATETIME": datetime.datetime_schema(TemplateDateTime)
|
||||
.extend(_BASE_SCHEMA)
|
||||
.extend(
|
||||
{
|
||||
cv.Optional(CONF_INITIAL_VALUE): cv.date_time(),
|
||||
cv.Optional(CONF_INITIAL_VALUE): cv.date_time(date=True, time=True),
|
||||
}
|
||||
),
|
||||
},
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
#include "esphome/core/defines.h"
|
||||
|
||||
#ifdef USE_DATETIME_TIME
|
||||
#ifdef USE_DATETIME_DATETIME
|
||||
|
||||
#include "esphome/components/datetime/datetime_entity.h"
|
||||
#include "esphome/core/automation.h"
|
||||
|
@ -43,4 +43,4 @@ class TemplateDateTime : public datetime::DateTimeEntity, public PollingComponen
|
|||
} // namespace template_
|
||||
} // namespace esphome
|
||||
|
||||
#endif // USE_DATETIME_TIME
|
||||
#endif // USE_DATETIME_DATETIME
|
||||
|
|
|
@ -9,10 +9,10 @@ from esphome.const import (
|
|||
CONF_DATA_PIN,
|
||||
CONF_ID,
|
||||
CONF_NUM_CHIPS,
|
||||
CONF_OE_PIN,
|
||||
)
|
||||
|
||||
CONF_LAT_PIN = "lat_pin"
|
||||
CONF_OE_PIN = "oe_pin"
|
||||
|
||||
CODEOWNERS = ["@rnauber"]
|
||||
|
||||
|
|
|
@ -5,6 +5,7 @@ from esphome.components import display
|
|||
from esphome import automation
|
||||
|
||||
from esphome.const import (
|
||||
CONF_DISPLAY,
|
||||
CONF_ON_TOUCH,
|
||||
CONF_ON_RELEASE,
|
||||
CONF_ON_UPDATE,
|
||||
|
@ -31,7 +32,6 @@ TouchPoints_t = cg.std_vector.template(TouchPoint)
|
|||
TouchPoints_t_const_ref = TouchPoints_t.operator("ref").operator("const")
|
||||
TouchListener = touchscreen_ns.class_("TouchListener")
|
||||
|
||||
CONF_DISPLAY = "display"
|
||||
CONF_TOUCHSCREEN_ID = "touchscreen_id"
|
||||
CONF_REPORT_INTERVAL = "report_interval" # not used yet:
|
||||
CONF_TOUCH_TIMEOUT = "touch_timeout"
|
||||
|
|
|
@ -37,4 +37,4 @@ async def to_code(config):
|
|||
cg.add_library("FS", None)
|
||||
cg.add_library("Update", None)
|
||||
# https://github.com/esphome/ESPAsyncWebServer/blob/master/library.json
|
||||
cg.add_library("esphome/ESPAsyncWebServer-esphome", "3.1.0")
|
||||
cg.add_library("esphome/ESPAsyncWebServer-esphome", "3.2.0")
|
||||
|
|
|
@ -1,14 +1,13 @@
|
|||
import esphome.codegen as cg
|
||||
import esphome.config_validation as cv
|
||||
from esphome.components import climate_ir
|
||||
from esphome.const import CONF_ID
|
||||
from esphome.const import CONF_ID, CONF_USE_FAHRENHEIT
|
||||
|
||||
AUTO_LOAD = ["climate_ir"]
|
||||
|
||||
whynter_ns = cg.esphome_ns.namespace("whynter")
|
||||
Whynter = whynter_ns.class_("Whynter", climate_ir.ClimateIR)
|
||||
|
||||
CONF_USE_FAHRENHEIT = "use_fahrenheit"
|
||||
|
||||
CONFIG_SCHEMA = climate_ir.CLIMATE_IR_WITH_RECEIVER_SCHEMA.extend(
|
||||
{
|
||||
|
|
|
@ -11,6 +11,7 @@ from esphome.const import (
|
|||
CONF_DNS2,
|
||||
CONF_DOMAIN,
|
||||
CONF_ENABLE_BTM,
|
||||
CONF_ENABLE_ON_BOOT,
|
||||
CONF_ENABLE_RRM,
|
||||
CONF_FAST_CONNECT,
|
||||
CONF_GATEWAY,
|
||||
|
@ -268,7 +269,6 @@ def _validate(config):
|
|||
|
||||
CONF_OUTPUT_POWER = "output_power"
|
||||
CONF_PASSIVE_SCAN = "passive_scan"
|
||||
CONF_ENABLE_ON_BOOT = "enable_on_boot"
|
||||
CONFIG_SCHEMA = cv.All(
|
||||
cv.Schema(
|
||||
{
|
||||
|
|
|
@ -694,7 +694,7 @@ void WiFiComponent::retry_connect() {
|
|||
}
|
||||
|
||||
bool WiFiComponent::can_proceed() {
|
||||
if (!this->has_sta() || this->state_ == WIFI_COMPONENT_STATE_DISABLED) {
|
||||
if (!this->has_sta() || this->state_ == WIFI_COMPONENT_STATE_DISABLED || this->ap_setup_) {
|
||||
return true;
|
||||
}
|
||||
return this->is_connected();
|
||||
|
|
|
@ -22,6 +22,8 @@ CONF_PEER_ALLOWED_IPS = "peer_allowed_ips"
|
|||
CONF_PEER_PERSISTENT_KEEPALIVE = "peer_persistent_keepalive"
|
||||
CONF_REQUIRE_CONNECTION_TO_PROCEED = "require_connection_to_proceed"
|
||||
|
||||
CONF_WIREGUARD_ID = "wireguard_id"
|
||||
|
||||
DEPENDENCIES = ["time"]
|
||||
CODEOWNERS = ["@lhoracek", "@droscy", "@thomas0bernard"]
|
||||
|
||||
|
|
|
@ -7,9 +7,8 @@ from esphome.const import (
|
|||
ENTITY_CATEGORY_DIAGNOSTIC,
|
||||
)
|
||||
|
||||
from . import Wireguard
|
||||
from . import CONF_WIREGUARD_ID, Wireguard
|
||||
|
||||
CONF_WIREGUARD_ID = "wireguard_id"
|
||||
CONF_ENABLED = "enabled"
|
||||
|
||||
DEPENDENCIES = ["wireguard"]
|
||||
|
|
|
@ -6,9 +6,8 @@ from esphome.const import (
|
|||
ENTITY_CATEGORY_DIAGNOSTIC,
|
||||
)
|
||||
|
||||
from . import Wireguard
|
||||
from . import CONF_WIREGUARD_ID, Wireguard
|
||||
|
||||
CONF_WIREGUARD_ID = "wireguard_id"
|
||||
CONF_LATEST_HANDSHAKE = "latest_handshake"
|
||||
|
||||
DEPENDENCIES = ["wireguard"]
|
||||
|
|
|
@ -6,9 +6,7 @@ from esphome.const import (
|
|||
ENTITY_CATEGORY_DIAGNOSTIC,
|
||||
)
|
||||
|
||||
from . import Wireguard
|
||||
|
||||
CONF_WIREGUARD_ID = "wireguard_id"
|
||||
from . import CONF_WIREGUARD_ID, Wireguard
|
||||
|
||||
DEPENDENCIES = ["wireguard"]
|
||||
|
||||
|
|
|
@ -821,57 +821,50 @@ positive_not_null_time_period = All(
|
|||
|
||||
|
||||
def time_of_day(value):
|
||||
return date_time(allowed_date=False, allowed_time=True)(value)
|
||||
return date_time(date=False, time=True)(value)
|
||||
|
||||
|
||||
def date_time(allowed_date: bool = True, allowed_time: bool = True):
|
||||
def date_time(date: bool, time: bool):
|
||||
|
||||
pattern_str = r"^" # Start of string
|
||||
if allowed_date:
|
||||
if date:
|
||||
pattern_str += r"\d{4}-\d{1,2}-\d{1,2}"
|
||||
if time:
|
||||
pattern_str += r" "
|
||||
if time:
|
||||
pattern_str += (
|
||||
r"(" # 1. Optional Date group
|
||||
r"\d{4}-\d{1,2}-\d{1,2}" # Date
|
||||
r"(?:\s(?=.+))?" # Space after date only if time is following
|
||||
r")?" # End optional Date group
|
||||
)
|
||||
if allowed_time:
|
||||
pattern_str += (
|
||||
r"(" # 2. Optional Time group
|
||||
r"(\d{1,2}:\d{2})" # 3. Hour/Minute
|
||||
r"(:\d{2})?" # 4. Seconds
|
||||
r"(" # 5. Optional AM/PM group
|
||||
r"(\s)?" # 6. Optional Space
|
||||
r"\d{1,2}:\d{2}" # Hour/Minute
|
||||
r"(:\d{2})?" # 1. Seconds
|
||||
r"(" # 2. Optional AM/PM group
|
||||
r"(\s)?" # 3. Optional Space
|
||||
r"(?:AM|PM|am|pm)" # AM/PM string matching
|
||||
r")?" # End optional AM/PM group
|
||||
r")?" # End optional Time group
|
||||
)
|
||||
pattern_str += r"$" # End of string
|
||||
|
||||
pattern = re.compile(pattern_str)
|
||||
|
||||
exc_message = ""
|
||||
if allowed_date:
|
||||
if date:
|
||||
exc_message += "date"
|
||||
if allowed_time:
|
||||
exc_message += "/"
|
||||
if allowed_time:
|
||||
if time:
|
||||
exc_message += "time"
|
||||
|
||||
schema = Schema({})
|
||||
if allowed_date:
|
||||
if date:
|
||||
schema = schema.extend(
|
||||
{
|
||||
Optional(CONF_YEAR): int_range(min=1970, max=3000),
|
||||
Optional(CONF_MONTH): int_range(min=1, max=12),
|
||||
Optional(CONF_DAY): int_range(min=1, max=31),
|
||||
Required(CONF_YEAR): int_range(min=1970, max=3000),
|
||||
Required(CONF_MONTH): int_range(min=1, max=12),
|
||||
Required(CONF_DAY): int_range(min=1, max=31),
|
||||
}
|
||||
)
|
||||
if allowed_time:
|
||||
if time:
|
||||
schema = schema.extend(
|
||||
{
|
||||
Optional(CONF_HOUR): int_range(min=0, max=23),
|
||||
Optional(CONF_MINUTE): int_range(min=0, max=59),
|
||||
Optional(CONF_SECOND): int_range(min=0, max=59),
|
||||
Required(CONF_HOUR): int_range(min=0, max=23),
|
||||
Required(CONF_MINUTE): int_range(min=0, max=59),
|
||||
Required(CONF_SECOND): int_range(min=0, max=59),
|
||||
}
|
||||
)
|
||||
|
||||
|
@ -885,21 +878,21 @@ def date_time(allowed_date: bool = True, allowed_time: bool = True):
|
|||
# pylint: disable=raise-missing-from
|
||||
raise Invalid(f"Invalid {exc_message}: {value}")
|
||||
|
||||
if allowed_date:
|
||||
has_date = match[1] is not None
|
||||
if allowed_time:
|
||||
has_time = match[2] is not None
|
||||
has_seconds = match[3] is not None
|
||||
has_ampm = match[4] is not None
|
||||
has_ampm_space = match[5] is not None
|
||||
if time:
|
||||
has_seconds = match[1] is not None
|
||||
has_ampm = match[2] is not None
|
||||
has_ampm_space = match[3] is not None
|
||||
|
||||
format = ""
|
||||
if allowed_date and has_date:
|
||||
if date:
|
||||
format += "%Y-%m-%d"
|
||||
if allowed_time and has_time:
|
||||
if time:
|
||||
format += " "
|
||||
if allowed_time and has_time:
|
||||
format += "%H:%M"
|
||||
if time:
|
||||
if has_ampm:
|
||||
format += "%I:%M"
|
||||
else:
|
||||
format += "%H:%M"
|
||||
if has_seconds:
|
||||
format += ":%S"
|
||||
if has_ampm_space:
|
||||
|
@ -914,12 +907,12 @@ def date_time(allowed_date: bool = True, allowed_time: bool = True):
|
|||
raise Invalid(f"Invalid {exc_message}: {err}")
|
||||
|
||||
return_value = {}
|
||||
if allowed_date and has_date:
|
||||
if date:
|
||||
return_value[CONF_YEAR] = date_obj.year
|
||||
return_value[CONF_MONTH] = date_obj.month
|
||||
return_value[CONF_DAY] = date_obj.day
|
||||
|
||||
if allowed_time and has_time:
|
||||
if time:
|
||||
return_value[CONF_HOUR] = date_obj.hour
|
||||
return_value[CONF_MINUTE] = date_obj.minute
|
||||
return_value[CONF_SECOND] = date_obj.second if has_seconds else 0
|
||||
|
@ -2124,6 +2117,7 @@ GIT_SCHEMA = Schema(
|
|||
Optional(CONF_REF): git_ref,
|
||||
Optional(CONF_USERNAME): string,
|
||||
Optional(CONF_PASSWORD): string,
|
||||
Optional(CONF_PATH): string,
|
||||
}
|
||||
)
|
||||
LOCAL_SCHEMA = Schema(
|
||||
|
|
|
@ -141,6 +141,7 @@ CONF_COMMAND_RETAIN = "command_retain"
|
|||
CONF_COMMAND_TOPIC = "command_topic"
|
||||
CONF_COMMENT = "comment"
|
||||
CONF_COMMIT = "commit"
|
||||
CONF_COMPENSATION = "compensation"
|
||||
CONF_COMPILE_PROCESS_LIMIT = "compile_process_limit"
|
||||
CONF_COMPONENT_ID = "component_id"
|
||||
CONF_COMPONENTS = "components"
|
||||
|
@ -216,6 +217,7 @@ CONF_DISCOVERY_OBJECT_ID_GENERATOR = "discovery_object_id_generator"
|
|||
CONF_DISCOVERY_PREFIX = "discovery_prefix"
|
||||
CONF_DISCOVERY_RETAIN = "discovery_retain"
|
||||
CONF_DISCOVERY_UNIQUE_ID_GENERATOR = "discovery_unique_id_generator"
|
||||
CONF_DISPLAY = "display"
|
||||
CONF_DISTANCE = "distance"
|
||||
CONF_DITHER = "dither"
|
||||
CONF_DIV_RATIO = "div_ratio"
|
||||
|
@ -239,6 +241,7 @@ CONF_EFFECTS = "effects"
|
|||
CONF_ELSE = "else"
|
||||
CONF_ENABLE_BTM = "enable_btm"
|
||||
CONF_ENABLE_IPV6 = "enable_ipv6"
|
||||
CONF_ENABLE_ON_BOOT = "enable_on_boot"
|
||||
CONF_ENABLE_PIN = "enable_pin"
|
||||
CONF_ENABLE_PRIVATE_NETWORK_ACCESS = "enable_private_network_access"
|
||||
CONF_ENABLE_RRM = "enable_rrm"
|
||||
|
@ -261,6 +264,7 @@ CONF_EXTERNAL_CLOCK_INPUT = "external_clock_input"
|
|||
CONF_EXTERNAL_COMPONENTS = "external_components"
|
||||
CONF_EXTERNAL_TEMPERATURE = "external_temperature"
|
||||
CONF_EXTERNAL_VCC = "external_vcc"
|
||||
CONF_FACTORY_RESET = "factory_reset"
|
||||
CONF_FALLING_EDGE = "falling_edge"
|
||||
CONF_FAMILY = "family"
|
||||
CONF_FAN_MODE = "fan_mode"
|
||||
|
@ -323,7 +327,11 @@ CONF_GYROSCOPE_X = "gyroscope_x"
|
|||
CONF_GYROSCOPE_Y = "gyroscope_y"
|
||||
CONF_GYROSCOPE_Z = "gyroscope_z"
|
||||
CONF_HARDWARE_UART = "hardware_uart"
|
||||
CONF_HAS_MOVING_TARGET = "has_moving_target"
|
||||
CONF_HAS_STILL_TARGET = "has_still_target"
|
||||
CONF_HAS_TARGET = "has_target"
|
||||
CONF_HEAD = "head"
|
||||
CONF_HEADING = "heading"
|
||||
CONF_HEARTBEAT = "heartbeat"
|
||||
CONF_HEAT_ACTION = "heat_action"
|
||||
CONF_HEAT_DEADBAND = "heat_deadband"
|
||||
|
@ -337,6 +345,7 @@ CONF_HIGH = "high"
|
|||
CONF_HIGH_VOLTAGE_REFERENCE = "high_voltage_reference"
|
||||
CONF_HOUR = "hour"
|
||||
CONF_HOURS = "hours"
|
||||
CONF_HSYNC_PIN = "hsync_pin"
|
||||
CONF_HUMIDITY = "humidity"
|
||||
CONF_HUMIDITY_SENSOR = "humidity_sensor"
|
||||
CONF_HYSTERESIS = "hysteresis"
|
||||
|
@ -377,6 +386,7 @@ CONF_INTERLOCK = "interlock"
|
|||
CONF_INTERNAL = "internal"
|
||||
CONF_INTERNAL_FILTER = "internal_filter"
|
||||
CONF_INTERNAL_FILTER_MODE = "internal_filter_mode"
|
||||
CONF_INTERNAL_TEMPERATURE = "internal_temperature"
|
||||
CONF_INTERRUPT = "interrupt"
|
||||
CONF_INTERRUPT_PIN = "interrupt_pin"
|
||||
CONF_INTERVAL = "interval"
|
||||
|
@ -446,6 +456,7 @@ CONF_MEASUREMENT_SEQUENCE_NUMBER = "measurement_sequence_number"
|
|||
CONF_MEDIA_PLAYER = "media_player"
|
||||
CONF_MEDIUM = "medium"
|
||||
CONF_MEMORY_BLOCKS = "memory_blocks"
|
||||
CONF_MESSAGE = "message"
|
||||
CONF_METHOD = "method"
|
||||
CONF_MICROPHONE = "microphone"
|
||||
CONF_MIN_BRIGHTNESS = "min_brightness"
|
||||
|
@ -499,6 +510,7 @@ CONF_NUM_LEDS = "num_leds"
|
|||
CONF_NUM_SCANS = "num_scans"
|
||||
CONF_NUMBER = "number"
|
||||
CONF_NUMBER_DATAPOINT = "number_datapoint"
|
||||
CONF_OE_PIN = "oe_pin"
|
||||
CONF_OFF_MODE = "off_mode"
|
||||
CONF_OFF_SPEED_CYCLE = "off_speed_cycle"
|
||||
CONF_OFFSET = "offset"
|
||||
|
@ -526,6 +538,7 @@ CONF_ON_FINGER_SCAN_MATCHED = "on_finger_scan_matched"
|
|||
CONF_ON_FINGER_SCAN_MISPLACED = "on_finger_scan_misplaced"
|
||||
CONF_ON_FINGER_SCAN_START = "on_finger_scan_start"
|
||||
CONF_ON_FINGER_SCAN_UNMATCHED = "on_finger_scan_unmatched"
|
||||
CONF_ON_FINISHED_WRITE = "on_finished_write"
|
||||
CONF_ON_JSON_MESSAGE = "on_json_message"
|
||||
CONF_ON_LOCK = "on_lock"
|
||||
CONF_ON_LOOP = "on_loop"
|
||||
|
@ -568,6 +581,7 @@ CONF_OSCILLATION_COMMAND_TOPIC = "oscillation_command_topic"
|
|||
CONF_OSCILLATION_OUTPUT = "oscillation_output"
|
||||
CONF_OSCILLATION_STATE_TOPIC = "oscillation_state_topic"
|
||||
CONF_OTA = "ota"
|
||||
CONF_OUTDOOR_TEMPERATURE = "outdoor_temperature"
|
||||
CONF_OUTPUT = "output"
|
||||
CONF_OUTPUT_ID = "output_id"
|
||||
CONF_OUTPUTS = "outputs"
|
||||
|
@ -666,6 +680,7 @@ CONF_RED = "red"
|
|||
CONF_REF = "ref"
|
||||
CONF_REFERENCE_RESISTANCE = "reference_resistance"
|
||||
CONF_REFERENCE_TEMPERATURE = "reference_temperature"
|
||||
CONF_REFERENCE_VOLTAGE = "reference_voltage"
|
||||
CONF_REFRESH = "refresh"
|
||||
CONF_RELABEL = "relabel"
|
||||
CONF_REPEAT = "repeat"
|
||||
|
@ -674,6 +689,7 @@ CONF_RESET_DURATION = "reset_duration"
|
|||
CONF_RESET_PIN = "reset_pin"
|
||||
CONF_RESIZE = "resize"
|
||||
CONF_RESOLUTION = "resolution"
|
||||
CONF_RESTART = "restart"
|
||||
CONF_RESTORE = "restore"
|
||||
CONF_RESTORE_MODE = "restore_mode"
|
||||
CONF_RESTORE_STATE = "restore_state"
|
||||
|
@ -711,6 +727,7 @@ CONF_SEL_PIN = "sel_pin"
|
|||
CONF_SEND_EVERY = "send_every"
|
||||
CONF_SEND_FIRST_AT = "send_first_at"
|
||||
CONF_SENSING_PIN = "sensing_pin"
|
||||
CONF_SENSITIVITY = "sensitivity"
|
||||
CONF_SENSOR = "sensor"
|
||||
CONF_SENSOR_DATAPOINT = "sensor_datapoint"
|
||||
CONF_SENSOR_ID = "sensor_id"
|
||||
|
@ -804,6 +821,7 @@ CONF_TARGET_TEMPERATURE_LOW_COMMAND_TOPIC = "target_temperature_low_command_topi
|
|||
CONF_TARGET_TEMPERATURE_LOW_STATE_TOPIC = "target_temperature_low_state_topic"
|
||||
CONF_TARGET_TEMPERATURE_STATE_TOPIC = "target_temperature_state_topic"
|
||||
CONF_TEMPERATURE = "temperature"
|
||||
CONF_TEMPERATURE_OFFSET = "temperature_offset"
|
||||
CONF_TEMPERATURE_SOURCE = "temperature_source"
|
||||
CONF_TEMPERATURE_STEP = "temperature_step"
|
||||
CONF_TEXT_SENSORS = "text_sensors"
|
||||
|
@ -852,6 +870,7 @@ CONF_UPDATE_ON_BOOT = "update_on_boot"
|
|||
CONF_URL = "url"
|
||||
CONF_USE_ABBREVIATIONS = "use_abbreviations"
|
||||
CONF_USE_ADDRESS = "use_address"
|
||||
CONF_USE_FAHRENHEIT = "use_fahrenheit"
|
||||
CONF_USERNAME = "username"
|
||||
CONF_UUID = "uuid"
|
||||
CONF_VALIDITY_PERIOD = "validity_period"
|
||||
|
@ -865,7 +884,9 @@ CONF_VISUAL = "visual"
|
|||
CONF_VOLTAGE = "voltage"
|
||||
CONF_VOLTAGE_ATTENUATION = "voltage_attenuation"
|
||||
CONF_VOLTAGE_DIVIDER = "voltage_divider"
|
||||
CONF_VOLTAGE_GAIN = "voltage_gain"
|
||||
CONF_VOLUME = "volume"
|
||||
CONF_VSYNC_PIN = "vsync_pin"
|
||||
CONF_WAIT_TIME = "wait_time"
|
||||
CONF_WAIT_UNTIL = "wait_until"
|
||||
CONF_WAKEUP_PIN = "wakeup_pin"
|
||||
|
|
|
@ -24,7 +24,7 @@ template<int... S> struct gens<0, S...> { using type = seq<S...>; }; // NOLINT
|
|||
|
||||
template<typename T, typename... X> class TemplatableValue {
|
||||
public:
|
||||
TemplatableValue() : type_(EMPTY) {}
|
||||
TemplatableValue() : type_(NONE) {}
|
||||
|
||||
template<typename F, enable_if_t<!is_invocable<F, X...>::value, int> = 0>
|
||||
TemplatableValue(F value) : type_(VALUE), value_(value) {}
|
||||
|
@ -32,13 +32,13 @@ template<typename T, typename... X> class TemplatableValue {
|
|||
template<typename F, enable_if_t<is_invocable<F, X...>::value, int> = 0>
|
||||
TemplatableValue(F f) : type_(LAMBDA), f_(f) {}
|
||||
|
||||
bool has_value() { return this->type_ != EMPTY; }
|
||||
bool has_value() { return this->type_ != NONE; }
|
||||
|
||||
T value(X... x) {
|
||||
if (this->type_ == LAMBDA) {
|
||||
return this->f_(x...);
|
||||
}
|
||||
// return value also when empty
|
||||
// return value also when none
|
||||
return this->value_;
|
||||
}
|
||||
|
||||
|
@ -58,7 +58,7 @@ template<typename T, typename... X> class TemplatableValue {
|
|||
|
||||
protected:
|
||||
enum {
|
||||
EMPTY,
|
||||
NONE,
|
||||
VALUE,
|
||||
LAMBDA,
|
||||
} type_;
|
||||
|
|
|
@ -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).
|
||||
|
|
|
@ -58,7 +58,7 @@ lib_deps =
|
|||
SPI ; spi (Arduino built-in)
|
||||
Wire ; i2c (Arduino built-int)
|
||||
heman/AsyncMqttClient-esphome@1.0.0 ; mqtt
|
||||
esphome/ESPAsyncWebServer-esphome@2.1.0 ; web_server_base
|
||||
esphome/ESPAsyncWebServer-esphome@3.2.0 ; web_server_base
|
||||
fastled/FastLED@3.3.2 ; fastled_base
|
||||
mikalhart/TinyGPSPlus@1.0.2 ; gps
|
||||
freekode/TM1651@1.0.1 ; tm1651
|
||||
|
|
|
@ -476,7 +476,7 @@ def lint_no_byte_datatype(fname, match):
|
|||
def lint_constants_usage():
|
||||
errs = []
|
||||
for constant, uses in CONSTANTS_USES.items():
|
||||
if len(uses) < 4:
|
||||
if len(uses) < 3:
|
||||
continue
|
||||
errs.append(
|
||||
f"Constant {highlight(constant)} is defined in {len(uses)} files. Please move all definitions of the "
|
||||
|
|
|
@ -266,7 +266,12 @@ def main():
|
|||
if args.fix and failed_files:
|
||||
print("Applying fixes ...")
|
||||
try:
|
||||
subprocess.call(["clang-apply-replacements-14", tmpdir])
|
||||
try:
|
||||
subprocess.call(["clang-apply-replacements-14", tmpdir])
|
||||
except FileNotFoundError:
|
||||
subprocess.call(["clang-apply-replacements", tmpdir])
|
||||
except FileNotFoundError:
|
||||
print("Error please install clang-apply-replacements-14 or clang-apply-replacements.\n", file=sys.stderr)
|
||||
except:
|
||||
print("Error applying fixes.\n", file=sys.stderr)
|
||||
raise
|
||||
|
|
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
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue