mirror of
https://github.com/esphome/esphome.git
synced 2024-12-18 03:24:54 +01:00
commit
f7fbc2d44f
57 changed files with 1795 additions and 639 deletions
|
@ -37,6 +37,7 @@
|
|||
"!secret scalar",
|
||||
"!lambda scalar",
|
||||
"!extend scalar",
|
||||
"!remove scalar",
|
||||
"!include_dir_named scalar",
|
||||
"!include_dir_list scalar",
|
||||
"!include_dir_merge_list scalar",
|
||||
|
|
2
.github/actions/restore-python/action.yml
vendored
2
.github/actions/restore-python/action.yml
vendored
|
@ -17,7 +17,7 @@ runs:
|
|||
steps:
|
||||
- name: Set up Python ${{ inputs.python-version }}
|
||||
id: python
|
||||
uses: actions/setup-python@v4.7.0
|
||||
uses: actions/setup-python@v5.0.0
|
||||
with:
|
||||
python-version: ${{ inputs.python-version }}
|
||||
- name: Restore Python virtual environment
|
||||
|
|
2
.github/workflows/ci-docker.yml
vendored
2
.github/workflows/ci-docker.yml
vendored
|
@ -42,7 +42,7 @@ jobs:
|
|||
steps:
|
||||
- uses: actions/checkout@v4.1.1
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v4.7.1
|
||||
uses: actions/setup-python@v5.0.0
|
||||
with:
|
||||
python-version: "3.9"
|
||||
- name: Set up Docker Buildx
|
||||
|
|
2
.github/workflows/ci.yml
vendored
2
.github/workflows/ci.yml
vendored
|
@ -40,7 +40,7 @@ jobs:
|
|||
run: echo key="${{ hashFiles('requirements.txt', 'requirements_optional.txt', 'requirements_test.txt') }}" >> $GITHUB_OUTPUT
|
||||
- name: Set up Python ${{ env.DEFAULT_PYTHON }}
|
||||
id: python
|
||||
uses: actions/setup-python@v4.7.1
|
||||
uses: actions/setup-python@v5.0.0
|
||||
with:
|
||||
python-version: ${{ env.DEFAULT_PYTHON }}
|
||||
- name: Restore Python virtual environment
|
||||
|
|
4
.github/workflows/release.yml
vendored
4
.github/workflows/release.yml
vendored
|
@ -45,7 +45,7 @@ jobs:
|
|||
steps:
|
||||
- uses: actions/checkout@v4.1.1
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v4.7.1
|
||||
uses: actions/setup-python@v5.0.0
|
||||
with:
|
||||
python-version: "3.x"
|
||||
- name: Set up python environment
|
||||
|
@ -80,7 +80,7 @@ jobs:
|
|||
steps:
|
||||
- uses: actions/checkout@v4.1.1
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v4.7.1
|
||||
uses: actions/setup-python@v5.0.0
|
||||
with:
|
||||
python-version: "3.9"
|
||||
|
||||
|
|
2
.github/workflows/sync-device-classes.yml
vendored
2
.github/workflows/sync-device-classes.yml
vendored
|
@ -22,7 +22,7 @@ jobs:
|
|||
path: lib/home-assistant
|
||||
|
||||
- name: Setup Python
|
||||
uses: actions/setup-python@v4.7.1
|
||||
uses: actions/setup-python@v5.0.0
|
||||
with:
|
||||
python-version: 3.11
|
||||
|
||||
|
|
|
@ -389,7 +389,8 @@ def command_config(args, config):
|
|||
output = re.sub(
|
||||
r"(password|key|psk|ssid)\: (.+)", r"\1: \\033[5m\2\\033[6m", output
|
||||
)
|
||||
safe_print(output)
|
||||
if not CORE.quiet:
|
||||
safe_print(output)
|
||||
_LOGGER.info("Configuration is valid!")
|
||||
return 0
|
||||
|
||||
|
|
|
@ -8,50 +8,37 @@ namespace esphome {
|
|||
namespace a01nyub {
|
||||
|
||||
static const char *const TAG = "a01nyub.sensor";
|
||||
static const uint8_t MAX_DATA_LENGTH_BYTES = 4;
|
||||
|
||||
void A01nyubComponent::loop() {
|
||||
uint8_t data;
|
||||
while (this->available() > 0) {
|
||||
if (this->read_byte(&data)) {
|
||||
buffer_.push_back(data);
|
||||
this->read_byte(&data);
|
||||
if (this->buffer_.empty() && (data != 0xff))
|
||||
continue;
|
||||
buffer_.push_back(data);
|
||||
if (this->buffer_.size() == 4)
|
||||
this->check_buffer_();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void A01nyubComponent::check_buffer_() {
|
||||
if (this->buffer_.size() >= MAX_DATA_LENGTH_BYTES) {
|
||||
size_t i;
|
||||
for (i = 0; i < this->buffer_.size(); i++) {
|
||||
// Look for the first packet
|
||||
if (this->buffer_[i] == 0xFF) {
|
||||
if (i + 1 + 3 < this->buffer_.size()) { // Packet is not complete
|
||||
return; // Wait for completion
|
||||
}
|
||||
|
||||
uint8_t checksum = (this->buffer_[i] + this->buffer_[i + 1] + this->buffer_[i + 2]) & 0xFF;
|
||||
if (this->buffer_[i + 3] == checksum) {
|
||||
float distance = (this->buffer_[i + 1] << 8) + this->buffer_[i + 2];
|
||||
if (distance > 280) {
|
||||
float meters = distance / 1000.0;
|
||||
ESP_LOGV(TAG, "Distance from sensor: %f mm, %f m", distance, meters);
|
||||
this->publish_state(meters);
|
||||
} else {
|
||||
ESP_LOGW(TAG, "Invalid data read from sensor: %s", format_hex_pretty(this->buffer_).c_str());
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
uint8_t checksum = this->buffer_[0] + this->buffer_[1] + this->buffer_[2];
|
||||
if (this->buffer_[3] == checksum) {
|
||||
float distance = (this->buffer_[1] << 8) + this->buffer_[2];
|
||||
if (distance > 280) {
|
||||
float meters = distance / 1000.0;
|
||||
ESP_LOGV(TAG, "Distance from sensor: %f mm, %f m", distance, meters);
|
||||
this->publish_state(meters);
|
||||
} else {
|
||||
ESP_LOGW(TAG, "Invalid data read from sensor: %s", format_hex_pretty(this->buffer_).c_str());
|
||||
}
|
||||
this->buffer_.clear();
|
||||
} else {
|
||||
ESP_LOGW(TAG, "checksum failed: %02x != %02x", checksum, this->buffer_[3]);
|
||||
}
|
||||
this->buffer_.clear();
|
||||
}
|
||||
|
||||
void A01nyubComponent::dump_config() {
|
||||
ESP_LOGCONFIG(TAG, "A01nyub Sensor:");
|
||||
LOG_SENSOR(" ", "Distance", this);
|
||||
}
|
||||
void A01nyubComponent::dump_config() { LOG_SENSOR("", "A01nyub Sensor", this); }
|
||||
|
||||
} // namespace a01nyub
|
||||
} // namespace esphome
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import esphome.codegen as cg
|
||||
import esphome.config_validation as cv
|
||||
from esphome import pins
|
||||
from esphome.const import CONF_ANALOG, CONF_INPUT
|
||||
from esphome.const import CONF_ANALOG, CONF_INPUT, CONF_NUMBER
|
||||
|
||||
from esphome.core import CORE
|
||||
from esphome.components.esp32 import get_esp32_variant
|
||||
|
@ -152,7 +152,8 @@ def validate_adc_pin(value):
|
|||
return cv.only_on_rp2040("TEMPERATURE")
|
||||
|
||||
if CORE.is_esp32:
|
||||
value = pins.internal_gpio_input_pin_number(value)
|
||||
conf = pins.internal_gpio_input_pin_schema(value)
|
||||
value = conf[CONF_NUMBER]
|
||||
variant = get_esp32_variant()
|
||||
if (
|
||||
variant not in ESP32_VARIANT_ADC1_PIN_TO_CHANNEL
|
||||
|
@ -166,24 +167,23 @@ def validate_adc_pin(value):
|
|||
):
|
||||
raise cv.Invalid(f"{variant} doesn't support ADC on this pin")
|
||||
|
||||
return pins.internal_gpio_input_pin_schema(value)
|
||||
return conf
|
||||
|
||||
if CORE.is_esp8266:
|
||||
value = pins.internal_gpio_pin_number({CONF_ANALOG: True, CONF_INPUT: True})(
|
||||
value
|
||||
)
|
||||
|
||||
if value != 17: # A0
|
||||
raise cv.Invalid("ESP8266: Only pin A0 (GPIO17) supports ADC")
|
||||
return pins.gpio_pin_schema(
|
||||
conf = pins.gpio_pin_schema(
|
||||
{CONF_ANALOG: True, CONF_INPUT: True}, internal=True
|
||||
)(value)
|
||||
|
||||
if conf[CONF_NUMBER] != 17: # A0
|
||||
raise cv.Invalid("ESP8266: Only pin A0 (GPIO17) supports ADC")
|
||||
return conf
|
||||
|
||||
if CORE.is_rp2040:
|
||||
value = pins.internal_gpio_input_pin_number(value)
|
||||
if value not in (26, 27, 28, 29):
|
||||
conf = pins.internal_gpio_input_pin_schema(value)
|
||||
number = conf[CONF_NUMBER]
|
||||
if number not in (26, 27, 28, 29):
|
||||
raise cv.Invalid("RP2040: Only pins 26, 27, 28 and 29 support ADC")
|
||||
return pins.internal_gpio_input_pin_schema(value)
|
||||
return conf
|
||||
|
||||
if CORE.is_libretiny:
|
||||
return pins.gpio_pin_schema(
|
||||
|
|
|
@ -3,15 +3,13 @@ from typing import Any
|
|||
|
||||
from esphome.const import (
|
||||
CONF_ID,
|
||||
CONF_INPUT,
|
||||
CONF_INVERTED,
|
||||
CONF_MODE,
|
||||
CONF_NUMBER,
|
||||
CONF_OPEN_DRAIN,
|
||||
CONF_OUTPUT,
|
||||
CONF_PULLDOWN,
|
||||
CONF_PULLUP,
|
||||
CONF_IGNORE_STRAPPING_WARNING,
|
||||
PLATFORM_ESP32,
|
||||
)
|
||||
from esphome import pins
|
||||
from esphome.core import CORE
|
||||
|
@ -33,7 +31,6 @@ from .const import (
|
|||
esp32_ns,
|
||||
)
|
||||
|
||||
|
||||
from .gpio_esp32 import esp32_validate_gpio_pin, esp32_validate_supports
|
||||
from .gpio_esp32_s2 import esp32_s2_validate_gpio_pin, esp32_s2_validate_supports
|
||||
from .gpio_esp32_c3 import esp32_c3_validate_gpio_pin, esp32_c3_validate_supports
|
||||
|
@ -42,7 +39,6 @@ from .gpio_esp32_c2 import esp32_c2_validate_gpio_pin, esp32_c2_validate_support
|
|||
from .gpio_esp32_c6 import esp32_c6_validate_gpio_pin, esp32_c6_validate_supports
|
||||
from .gpio_esp32_h2 import esp32_h2_validate_gpio_pin, esp32_h2_validate_supports
|
||||
|
||||
|
||||
ESP32InternalGPIOPin = esp32_ns.class_("ESP32InternalGPIOPin", cg.InternalGPIOPin)
|
||||
|
||||
|
||||
|
@ -161,33 +157,22 @@ DRIVE_STRENGTHS = {
|
|||
}
|
||||
gpio_num_t = cg.global_ns.enum("gpio_num_t")
|
||||
|
||||
|
||||
CONF_DRIVE_STRENGTH = "drive_strength"
|
||||
ESP32_PIN_SCHEMA = cv.All(
|
||||
{
|
||||
cv.GenerateID(): cv.declare_id(ESP32InternalGPIOPin),
|
||||
cv.Required(CONF_NUMBER): validate_gpio_pin,
|
||||
cv.Optional(CONF_MODE, default={}): cv.Schema(
|
||||
{
|
||||
cv.Optional(CONF_INPUT, default=False): cv.boolean,
|
||||
cv.Optional(CONF_OUTPUT, default=False): cv.boolean,
|
||||
cv.Optional(CONF_OPEN_DRAIN, default=False): cv.boolean,
|
||||
cv.Optional(CONF_PULLUP, default=False): cv.boolean,
|
||||
cv.Optional(CONF_PULLDOWN, default=False): cv.boolean,
|
||||
}
|
||||
),
|
||||
cv.Optional(CONF_INVERTED, default=False): cv.boolean,
|
||||
cv.Optional(CONF_IGNORE_STRAPPING_WARNING, default=False): cv.boolean,
|
||||
cv.Optional(CONF_DRIVE_STRENGTH, default="20mA"): cv.All(
|
||||
cv.float_with_unit("current", "mA", optional_unit=True),
|
||||
cv.enum(DRIVE_STRENGTHS),
|
||||
),
|
||||
},
|
||||
pins.gpio_base_schema(ESP32InternalGPIOPin, validate_gpio_pin).extend(
|
||||
{
|
||||
cv.Optional(CONF_IGNORE_STRAPPING_WARNING, default=False): cv.boolean,
|
||||
cv.Optional(CONF_DRIVE_STRENGTH, default="20mA"): cv.All(
|
||||
cv.float_with_unit("current", "mA", optional_unit=True),
|
||||
cv.enum(DRIVE_STRENGTHS),
|
||||
),
|
||||
}
|
||||
),
|
||||
validate_supports,
|
||||
)
|
||||
|
||||
|
||||
@pins.PIN_SCHEMA_REGISTRY.register("esp32", ESP32_PIN_SCHEMA)
|
||||
@pins.PIN_SCHEMA_REGISTRY.register(PLATFORM_ESP32, ESP32_PIN_SCHEMA)
|
||||
async def esp32_pin_to_code(config):
|
||||
var = cg.new_Pvariable(config[CONF_ID])
|
||||
num = config[CONF_NUMBER]
|
||||
|
|
|
@ -12,6 +12,7 @@ from esphome.const import (
|
|||
CONF_OUTPUT,
|
||||
CONF_PULLDOWN,
|
||||
CONF_PULLUP,
|
||||
PLATFORM_ESP8266,
|
||||
)
|
||||
from esphome import pins
|
||||
from esphome.core import CORE, coroutine_with_priority
|
||||
|
@ -21,10 +22,8 @@ import esphome.codegen as cg
|
|||
from . import boards
|
||||
from .const import KEY_BOARD, KEY_ESP8266, KEY_PIN_INITIAL_STATES, esp8266_ns
|
||||
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
|
||||
ESP8266GPIOPin = esp8266_ns.class_("ESP8266GPIOPin", cg.InternalGPIOPin)
|
||||
|
||||
|
||||
|
@ -124,6 +123,8 @@ def validate_supports(value):
|
|||
(True, False, False, False, False),
|
||||
# OUTPUT
|
||||
(False, True, False, False, False),
|
||||
# INPUT and OUTPUT, e.g. for i2c
|
||||
(True, True, False, False, False),
|
||||
# INPUT_PULLUP
|
||||
(True, False, False, True, False),
|
||||
# INPUT_PULLDOWN_16
|
||||
|
@ -142,21 +143,11 @@ def validate_supports(value):
|
|||
|
||||
|
||||
ESP8266_PIN_SCHEMA = cv.All(
|
||||
{
|
||||
cv.GenerateID(): cv.declare_id(ESP8266GPIOPin),
|
||||
cv.Required(CONF_NUMBER): validate_gpio_pin,
|
||||
cv.Optional(CONF_MODE, default={}): cv.Schema(
|
||||
{
|
||||
cv.Optional(CONF_ANALOG, default=False): cv.boolean,
|
||||
cv.Optional(CONF_INPUT, default=False): cv.boolean,
|
||||
cv.Optional(CONF_OUTPUT, default=False): cv.boolean,
|
||||
cv.Optional(CONF_OPEN_DRAIN, default=False): cv.boolean,
|
||||
cv.Optional(CONF_PULLUP, default=False): cv.boolean,
|
||||
cv.Optional(CONF_PULLDOWN, default=False): cv.boolean,
|
||||
}
|
||||
),
|
||||
cv.Optional(CONF_INVERTED, default=False): cv.boolean,
|
||||
},
|
||||
pins.gpio_base_schema(
|
||||
ESP8266GPIOPin,
|
||||
validate_gpio_pin,
|
||||
modes=pins.GPIO_STANDARD_MODES + (CONF_ANALOG,),
|
||||
),
|
||||
validate_supports,
|
||||
)
|
||||
|
||||
|
@ -167,7 +158,7 @@ class PinInitialState:
|
|||
level: int = 255
|
||||
|
||||
|
||||
@pins.PIN_SCHEMA_REGISTRY.register("esp8266", ESP8266_PIN_SCHEMA)
|
||||
@pins.PIN_SCHEMA_REGISTRY.register(PLATFORM_ESP8266, ESP8266_PIN_SCHEMA)
|
||||
async def esp8266_pin_to_code(config):
|
||||
var = cg.new_Pvariable(config[CONF_ID])
|
||||
num = config[CONF_NUMBER]
|
||||
|
|
|
@ -17,10 +17,8 @@ import esphome.codegen as cg
|
|||
|
||||
from .const import host_ns
|
||||
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
|
||||
HostGPIOPin = host_ns.class_("HostGPIOPin", cg.InternalGPIOPin)
|
||||
|
||||
|
||||
|
@ -45,21 +43,10 @@ def validate_gpio_pin(value):
|
|||
return _translate_pin(value)
|
||||
|
||||
|
||||
HOST_PIN_SCHEMA = cv.All(
|
||||
{
|
||||
cv.GenerateID(): cv.declare_id(HostGPIOPin),
|
||||
cv.Required(CONF_NUMBER): validate_gpio_pin,
|
||||
cv.Optional(CONF_MODE, default={}): cv.Schema(
|
||||
{
|
||||
cv.Optional(CONF_INPUT, default=False): cv.boolean,
|
||||
cv.Optional(CONF_OUTPUT, default=False): cv.boolean,
|
||||
cv.Optional(CONF_OPEN_DRAIN, default=False): cv.boolean,
|
||||
cv.Optional(CONF_PULLUP, default=False): cv.boolean,
|
||||
cv.Optional(CONF_PULLDOWN, default=False): cv.boolean,
|
||||
}
|
||||
),
|
||||
cv.Optional(CONF_INVERTED, default=False): cv.boolean,
|
||||
},
|
||||
HOST_PIN_SCHEMA = pins.gpio_base_schema(
|
||||
HostGPIOPin,
|
||||
validate_gpio_pin,
|
||||
modes=[CONF_INPUT, CONF_OUTPUT, CONF_OPEN_DRAIN, CONF_PULLUP, CONF_PULLDOWN],
|
||||
)
|
||||
|
||||
|
||||
|
|
|
@ -39,9 +39,8 @@ def _bus_declare_type(value):
|
|||
raise NotImplementedError
|
||||
|
||||
|
||||
pin_with_input_and_output_support = cv.All(
|
||||
pins.internal_gpio_pin_number({CONF_INPUT: True}),
|
||||
pins.internal_gpio_pin_number({CONF_OUTPUT: True}),
|
||||
pin_with_input_and_output_support = pins.internal_gpio_pin_number(
|
||||
{CONF_OUTPUT: True, CONF_INPUT: True}
|
||||
)
|
||||
|
||||
|
||||
|
|
|
@ -255,12 +255,11 @@ class LD2420Component : public Component, public uart::UARTDevice {
|
|||
|
||||
uint16_t gate_energy_[LD2420_TOTAL_GATES];
|
||||
CmdReplyT cmd_reply_;
|
||||
uint32_t timeout_;
|
||||
uint32_t max_distance_gate_;
|
||||
uint32_t min_distance_gate_;
|
||||
uint16_t system_mode_{CMD_SYSTEM_MODE_ENERGY};
|
||||
bool cmd_active_{false};
|
||||
char ld2420_firmware_ver_[8];
|
||||
char ld2420_firmware_ver_[8]{"v0.0.0"};
|
||||
bool presence_{false};
|
||||
bool calibration_{false};
|
||||
uint16_t distance_{0};
|
||||
|
|
|
@ -186,25 +186,11 @@ def validate_gpio_usage(value):
|
|||
return value
|
||||
|
||||
|
||||
BASE_PIN_SCHEMA = cv.Schema(
|
||||
{
|
||||
cv.GenerateID(): cv.declare_id(ArduinoInternalGPIOPin),
|
||||
cv.Required(CONF_NUMBER): validate_gpio_pin,
|
||||
cv.Optional(CONF_MODE, default={}): cv.Schema(
|
||||
{
|
||||
cv.Optional(CONF_ANALOG, default=False): cv.boolean,
|
||||
cv.Optional(CONF_INPUT, default=False): cv.boolean,
|
||||
cv.Optional(CONF_OUTPUT, default=False): cv.boolean,
|
||||
cv.Optional(CONF_OPEN_DRAIN, default=False): cv.boolean,
|
||||
cv.Optional(CONF_PULLUP, default=False): cv.boolean,
|
||||
cv.Optional(CONF_PULLDOWN, default=False): cv.boolean,
|
||||
}
|
||||
),
|
||||
cv.Optional(CONF_INVERTED, default=False): cv.boolean,
|
||||
},
|
||||
)
|
||||
|
||||
BASE_PIN_SCHEMA.add_extra(validate_gpio_usage)
|
||||
BASE_PIN_SCHEMA = pins.gpio_base_schema(
|
||||
ArduinoInternalGPIOPin,
|
||||
validate_gpio_pin,
|
||||
modes=pins.GPIO_STANDARD_MODES + (CONF_ANALOG,),
|
||||
).add_extra(validate_gpio_usage)
|
||||
|
||||
|
||||
async def component_pin_to_code(config):
|
||||
|
|
|
@ -74,20 +74,14 @@ def validate_mode(value):
|
|||
|
||||
CONF_MAX6956 = "max6956"
|
||||
|
||||
MAX6956_PIN_SCHEMA = cv.All(
|
||||
MAX6956_PIN_SCHEMA = pins.gpio_base_schema(
|
||||
MAX6956GPIOPin,
|
||||
cv.int_range(min=4, max=31),
|
||||
modes=[CONF_INPUT, CONF_PULLUP, CONF_OUTPUT],
|
||||
mode_validator=validate_mode,
|
||||
).extend(
|
||||
{
|
||||
cv.GenerateID(): cv.declare_id(MAX6956GPIOPin),
|
||||
cv.Required(CONF_MAX6956): cv.use_id(MAX6956),
|
||||
cv.Required(CONF_NUMBER): cv.int_range(min=4, max=31),
|
||||
cv.Optional(CONF_MODE, default={}): cv.All(
|
||||
{
|
||||
cv.Optional(CONF_INPUT, default=False): cv.boolean,
|
||||
cv.Optional(CONF_PULLUP, default=False): cv.boolean,
|
||||
cv.Optional(CONF_OUTPUT, default=False): cv.boolean,
|
||||
},
|
||||
validate_mode,
|
||||
),
|
||||
cv.Optional(CONF_INVERTED, default=False): cv.boolean,
|
||||
}
|
||||
)
|
||||
|
||||
|
|
|
@ -45,19 +45,15 @@ def validate_mode(value):
|
|||
|
||||
|
||||
CONF_MCP23016 = "mcp23016"
|
||||
MCP23016_PIN_SCHEMA = cv.All(
|
||||
MCP23016_PIN_SCHEMA = pins.gpio_base_schema(
|
||||
MCP23016GPIOPin,
|
||||
cv.int_range(min=0, max=15),
|
||||
modes=[CONF_INPUT, CONF_OUTPUT],
|
||||
mode_validator=validate_mode,
|
||||
invertable=True,
|
||||
).extend(
|
||||
{
|
||||
cv.GenerateID(): cv.declare_id(MCP23016GPIOPin),
|
||||
cv.Required(CONF_MCP23016): cv.use_id(MCP23016),
|
||||
cv.Required(CONF_NUMBER): cv.int_range(min=0, max=15),
|
||||
cv.Optional(CONF_MODE, default={}): cv.All(
|
||||
{
|
||||
cv.Optional(CONF_INPUT, default=False): cv.boolean,
|
||||
cv.Optional(CONF_OUTPUT, default=False): cv.boolean,
|
||||
},
|
||||
validate_mode,
|
||||
),
|
||||
cv.Optional(CONF_INVERTED, default=False): cv.boolean,
|
||||
}
|
||||
)
|
||||
|
||||
|
|
|
@ -54,20 +54,16 @@ def validate_mode(value):
|
|||
|
||||
|
||||
CONF_MCP23XXX = "mcp23xxx"
|
||||
MCP23XXX_PIN_SCHEMA = cv.All(
|
||||
|
||||
MCP23XXX_PIN_SCHEMA = pins.gpio_base_schema(
|
||||
MCP23XXXGPIOPin,
|
||||
cv.int_range(min=0, max=15),
|
||||
modes=[CONF_INPUT, CONF_OUTPUT, CONF_PULLUP],
|
||||
mode_validator=validate_mode,
|
||||
invertable=True,
|
||||
).extend(
|
||||
{
|
||||
cv.GenerateID(): cv.declare_id(MCP23XXXGPIOPin),
|
||||
cv.Required(CONF_MCP23XXX): cv.use_id(MCP23XXXBase),
|
||||
cv.Required(CONF_NUMBER): cv.int_range(min=0, max=15),
|
||||
cv.Optional(CONF_MODE, default={}): cv.All(
|
||||
{
|
||||
cv.Optional(CONF_INPUT, default=False): cv.boolean,
|
||||
cv.Optional(CONF_PULLUP, default=False): cv.boolean,
|
||||
cv.Optional(CONF_OUTPUT, default=False): cv.boolean,
|
||||
},
|
||||
validate_mode,
|
||||
),
|
||||
cv.Optional(CONF_INVERTED, default=False): cv.boolean,
|
||||
cv.Optional(CONF_INTERRUPT, default="NO_INTERRUPT"): cv.enum(
|
||||
MCP23XXX_INTERRUPT_MODES, upper=True
|
||||
),
|
||||
|
|
|
@ -76,7 +76,11 @@ bool MQTTComponent::send_discovery_() {
|
|||
this->send_discovery(root, config);
|
||||
|
||||
// Fields from EntityBase
|
||||
root[MQTT_NAME] = this->friendly_name();
|
||||
if (this->get_entity()->has_own_name()) {
|
||||
root[MQTT_NAME] = this->friendly_name();
|
||||
} else {
|
||||
root[MQTT_NAME] = "";
|
||||
}
|
||||
if (this->is_disabled_by_default())
|
||||
root[MQTT_ENABLED_BY_DEFAULT] = false;
|
||||
if (!this->get_icon().empty())
|
||||
|
|
|
@ -29,6 +29,7 @@ CONF_BACKGROUND_PRESSED_COLOR = "background_pressed_color"
|
|||
CONF_FOREGROUND_COLOR = "foreground_color"
|
||||
CONF_FOREGROUND_PRESSED_COLOR = "foreground_pressed_color"
|
||||
CONF_FONT_ID = "font_id"
|
||||
CONF_EXIT_REPARSE_ON_START = "exit_reparse_on_start"
|
||||
|
||||
|
||||
def NextionName(value):
|
||||
|
|
|
@ -21,6 +21,7 @@ from .base_component import (
|
|||
CONF_WAKE_UP_PAGE,
|
||||
CONF_START_UP_PAGE,
|
||||
CONF_AUTO_WAKE_ON_TOUCH,
|
||||
CONF_EXIT_REPARSE_ON_START,
|
||||
)
|
||||
|
||||
CODEOWNERS = ["@senexcrenshaw"]
|
||||
|
@ -69,6 +70,7 @@ CONFIG_SCHEMA = (
|
|||
cv.Optional(CONF_WAKE_UP_PAGE): cv.positive_int,
|
||||
cv.Optional(CONF_START_UP_PAGE): cv.positive_int,
|
||||
cv.Optional(CONF_AUTO_WAKE_ON_TOUCH, default=True): cv.boolean,
|
||||
cv.Optional(CONF_EXIT_REPARSE_ON_START, default=False): cv.boolean,
|
||||
}
|
||||
)
|
||||
.extend(cv.polling_component_schema("5s"))
|
||||
|
@ -106,8 +108,9 @@ async def to_code(config):
|
|||
if CONF_START_UP_PAGE in config:
|
||||
cg.add(var.set_start_up_page_internal(config[CONF_START_UP_PAGE]))
|
||||
|
||||
if CONF_AUTO_WAKE_ON_TOUCH in config:
|
||||
cg.add(var.set_auto_wake_on_touch_internal(config[CONF_AUTO_WAKE_ON_TOUCH]))
|
||||
cg.add(var.set_auto_wake_on_touch_internal(config[CONF_AUTO_WAKE_ON_TOUCH]))
|
||||
|
||||
cg.add(var.set_exit_reparse_on_start_internal(config[CONF_EXIT_REPARSE_ON_START]))
|
||||
|
||||
await display.register_display(var, config)
|
||||
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
#include "esphome/core/util.h"
|
||||
#include "esphome/core/log.h"
|
||||
#include "esphome/core/application.h"
|
||||
#include <cinttypes>
|
||||
|
||||
namespace esphome {
|
||||
namespace nextion {
|
||||
|
@ -47,6 +48,9 @@ bool Nextion::check_connect_() {
|
|||
|
||||
this->ignore_is_setup_ = true;
|
||||
this->send_command_("boguscommand=0"); // bogus command. needed sometimes after updating
|
||||
if (this->exit_reparse_on_start_) {
|
||||
this->send_command_("DRAKJHSUYDGBNCJHGJKSHBDN");
|
||||
}
|
||||
this->send_command_("connect");
|
||||
|
||||
this->comok_sent_ = millis();
|
||||
|
@ -126,7 +130,8 @@ void Nextion::dump_config() {
|
|||
ESP_LOGCONFIG(TAG, " Firmware Version: %s", this->firmware_version_.c_str());
|
||||
ESP_LOGCONFIG(TAG, " Serial Number: %s", this->serial_number_.c_str());
|
||||
ESP_LOGCONFIG(TAG, " Flash Size: %s", this->flash_size_.c_str());
|
||||
ESP_LOGCONFIG(TAG, " Wake On Touch: %s", this->auto_wake_on_touch_ ? "True" : "False");
|
||||
ESP_LOGCONFIG(TAG, " Wake On Touch: %s", YESNO(this->auto_wake_on_touch_));
|
||||
ESP_LOGCONFIG(TAG, " Exit reparse: %s", YESNO(this->exit_reparse_on_start_));
|
||||
|
||||
if (this->touch_sleep_timeout_ != 0) {
|
||||
ESP_LOGCONFIG(TAG, " Touch Timeout: %" PRIu32, this->touch_sleep_timeout_);
|
||||
|
@ -247,6 +252,7 @@ void Nextion::loop() {
|
|||
}
|
||||
|
||||
this->set_auto_wake_on_touch(this->auto_wake_on_touch_);
|
||||
this->set_exit_reparse_on_start(this->exit_reparse_on_start_);
|
||||
|
||||
if (this->touch_sleep_timeout_ != 0) {
|
||||
this->set_touch_sleep_timeout(this->touch_sleep_timeout_);
|
||||
|
|
|
@ -815,6 +815,19 @@ class Nextion : public NextionBase, public PollingComponent, public uart::UARTDe
|
|||
* The display will wake up by touch.
|
||||
*/
|
||||
void set_auto_wake_on_touch(bool auto_wake);
|
||||
/**
|
||||
* Sets if Nextion should exit the active reparse mode before the "connect" command is sent
|
||||
* @param exit_reparse True or false. When exit_reparse is true, the exit reparse command
|
||||
* will be sent before requesting the connection from Nextion.
|
||||
*
|
||||
* Example:
|
||||
* ```cpp
|
||||
* it.set_exit_reparse_on_start(true);
|
||||
* ```
|
||||
*
|
||||
* The display will be requested to leave active reparse mode before setup.
|
||||
*/
|
||||
void set_exit_reparse_on_start(bool exit_reparse);
|
||||
/**
|
||||
* Sets Nextion mode between sleep and awake
|
||||
* @param True or false. Sleep=true to enter sleep mode or sleep=false to exit sleep mode.
|
||||
|
@ -943,6 +956,9 @@ class Nextion : public NextionBase, public PollingComponent, public uart::UARTDe
|
|||
void set_wake_up_page_internal(uint8_t wake_up_page) { this->wake_up_page_ = wake_up_page; }
|
||||
void set_start_up_page_internal(uint8_t start_up_page) { this->start_up_page_ = start_up_page; }
|
||||
void set_auto_wake_on_touch_internal(bool auto_wake_on_touch) { this->auto_wake_on_touch_ = auto_wake_on_touch; }
|
||||
void set_exit_reparse_on_start_internal(bool exit_reparse_on_start) {
|
||||
this->exit_reparse_on_start_ = exit_reparse_on_start;
|
||||
}
|
||||
|
||||
protected:
|
||||
std::deque<NextionQueue *> nextion_queue_;
|
||||
|
@ -966,6 +982,7 @@ class Nextion : public NextionBase, public PollingComponent, public uart::UARTDe
|
|||
int wake_up_page_ = -1;
|
||||
int start_up_page_ = -1;
|
||||
bool auto_wake_on_touch_ = true;
|
||||
bool exit_reparse_on_start_ = false;
|
||||
|
||||
/**
|
||||
* Manually send a raw command to the display and don't wait for an acknowledgement packet.
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#include "nextion.h"
|
||||
#include "esphome/core/util.h"
|
||||
#include "esphome/core/log.h"
|
||||
#include <cinttypes>
|
||||
|
||||
namespace esphome {
|
||||
namespace nextion {
|
||||
|
@ -52,6 +53,7 @@ void Nextion::set_protocol_reparse_mode(bool active_mode) {
|
|||
this->write_str("connect");
|
||||
this->write_array(to_send, sizeof(to_send));
|
||||
}
|
||||
void Nextion::set_exit_reparse_on_start(bool exit_reparse) { this->exit_reparse_on_start_ = exit_reparse; }
|
||||
|
||||
// Set Colors - Background
|
||||
void Nextion::set_component_background_color(const char *component, uint16_t color) {
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
|
||||
namespace esphome {
|
||||
namespace nextion {
|
||||
static const char *const TAG = "nextion_upload";
|
||||
static const char *const TAG = "nextion.upload.arduino";
|
||||
|
||||
// Followed guide
|
||||
// https://unofficialnextion.com/t/nextion-upload-protocol-v1-2-the-fast-one/1044/2
|
||||
|
|
|
@ -11,10 +11,11 @@
|
|||
|
||||
#include <esp_heap_caps.h>
|
||||
#include <esp_http_client.h>
|
||||
#include <cinttypes>
|
||||
|
||||
namespace esphome {
|
||||
namespace nextion {
|
||||
static const char *const TAG = "nextion_upload";
|
||||
static const char *const TAG = "nextion.upload.idf";
|
||||
|
||||
// Followed guide
|
||||
// https://unofficialnextion.com/t/nextion-upload-protocol-v1-2-the-fast-one/1044/2
|
||||
|
|
|
@ -52,20 +52,15 @@ def validate_mode(value):
|
|||
return value
|
||||
|
||||
|
||||
PCA9554_PIN_SCHEMA = cv.All(
|
||||
PCA9554_PIN_SCHEMA = pins.gpio_base_schema(
|
||||
PCA9554GPIOPin,
|
||||
cv.int_range(min=0, max=15),
|
||||
modes=[CONF_INPUT, CONF_OUTPUT],
|
||||
mode_validator=validate_mode,
|
||||
).extend(
|
||||
{
|
||||
cv.GenerateID(): cv.declare_id(PCA9554GPIOPin),
|
||||
cv.Required(CONF_PCA9554): cv.use_id(PCA9554Component),
|
||||
cv.Required(CONF_NUMBER): cv.int_range(min=0, max=15),
|
||||
cv.Optional(CONF_MODE, default={}): cv.All(
|
||||
{
|
||||
cv.Optional(CONF_INPUT, default=False): cv.boolean,
|
||||
cv.Optional(CONF_OUTPUT, default=False): cv.boolean,
|
||||
},
|
||||
validate_mode,
|
||||
),
|
||||
cv.Optional(CONF_INVERTED, default=False): cv.boolean,
|
||||
},
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
|
|
|
@ -48,19 +48,15 @@ def validate_mode(value):
|
|||
return value
|
||||
|
||||
|
||||
PCF8574_PIN_SCHEMA = cv.All(
|
||||
PCF8574_PIN_SCHEMA = pins.gpio_base_schema(
|
||||
PCF8574GPIOPin,
|
||||
cv.int_range(min=0, max=17),
|
||||
modes=[CONF_INPUT, CONF_OUTPUT],
|
||||
mode_validator=validate_mode,
|
||||
invertable=True,
|
||||
).extend(
|
||||
{
|
||||
cv.GenerateID(): cv.declare_id(PCF8574GPIOPin),
|
||||
cv.Required(CONF_PCF8574): cv.use_id(PCF8574Component),
|
||||
cv.Required(CONF_NUMBER): cv.int_range(min=0, max=17),
|
||||
cv.Optional(CONF_MODE, default={}): cv.All(
|
||||
{
|
||||
cv.Optional(CONF_INPUT, default=False): cv.boolean,
|
||||
cv.Optional(CONF_OUTPUT, default=False): cv.boolean,
|
||||
},
|
||||
validate_mode,
|
||||
),
|
||||
cv.Optional(CONF_INVERTED, default=False): cv.boolean,
|
||||
}
|
||||
)
|
||||
|
||||
|
|
|
@ -397,8 +397,10 @@ RC522::StatusCode RC522::await_transceive_() {
|
|||
back_length_ = 0;
|
||||
ESP_LOGW(TAG, "Communication with the MFRC522 might be down, reset in %d",
|
||||
10 - error_counter_); // todo: trigger reset?
|
||||
if (error_counter_++ > 10)
|
||||
if (error_counter_++ >= 10) {
|
||||
setup();
|
||||
error_counter_ = 0; // reset the error counter
|
||||
}
|
||||
|
||||
return STATUS_TIMEOUT;
|
||||
}
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
import esphome.codegen as cg
|
||||
import esphome.config_validation as cv
|
||||
from esphome.const import (
|
||||
CONF_ANALOG,
|
||||
CONF_ID,
|
||||
CONF_INPUT,
|
||||
CONF_INVERTED,
|
||||
|
@ -11,6 +10,7 @@ from esphome.const import (
|
|||
CONF_OUTPUT,
|
||||
CONF_PULLDOWN,
|
||||
CONF_PULLUP,
|
||||
CONF_ANALOG,
|
||||
)
|
||||
from esphome.core import CORE
|
||||
from esphome import pins
|
||||
|
@ -78,22 +78,10 @@ def validate_supports(value):
|
|||
|
||||
|
||||
RP2040_PIN_SCHEMA = cv.All(
|
||||
cv.Schema(
|
||||
{
|
||||
cv.GenerateID(): cv.declare_id(RP2040GPIOPin),
|
||||
cv.Required(CONF_NUMBER): validate_gpio_pin,
|
||||
cv.Optional(CONF_MODE, default={}): cv.Schema(
|
||||
{
|
||||
cv.Optional(CONF_ANALOG, default=False): cv.boolean,
|
||||
cv.Optional(CONF_INPUT, default=False): cv.boolean,
|
||||
cv.Optional(CONF_OUTPUT, default=False): cv.boolean,
|
||||
cv.Optional(CONF_OPEN_DRAIN, default=False): cv.boolean,
|
||||
cv.Optional(CONF_PULLUP, default=False): cv.boolean,
|
||||
cv.Optional(CONF_PULLDOWN, default=False): cv.boolean,
|
||||
}
|
||||
),
|
||||
cv.Optional(CONF_INVERTED, default=False): cv.boolean,
|
||||
}
|
||||
pins.gpio_base_schema(
|
||||
RP2040GPIOPin,
|
||||
validate_gpio_pin,
|
||||
modes=pins.GPIO_STANDARD_MODES + (CONF_ANALOG,),
|
||||
),
|
||||
validate_supports,
|
||||
)
|
||||
|
|
|
@ -5,7 +5,6 @@ from esphome.components import spi
|
|||
from esphome.const import (
|
||||
CONF_ID,
|
||||
CONF_SPI_ID,
|
||||
CONF_MODE,
|
||||
CONF_NUMBER,
|
||||
CONF_INVERTED,
|
||||
CONF_DATA_PIN,
|
||||
|
@ -35,7 +34,6 @@ CONF_LATCH_PIN = "latch_pin"
|
|||
CONF_OE_PIN = "oe_pin"
|
||||
CONF_SR_COUNT = "sr_count"
|
||||
|
||||
|
||||
CONFIG_SCHEMA = cv.Any(
|
||||
cv.Schema(
|
||||
{
|
||||
|
@ -88,24 +86,20 @@ async def to_code(config):
|
|||
|
||||
|
||||
def _validate_output_mode(value):
|
||||
if value is not True:
|
||||
if value.get(CONF_OUTPUT) is not True:
|
||||
raise cv.Invalid("Only output mode is supported")
|
||||
return value
|
||||
|
||||
|
||||
SN74HC595_PIN_SCHEMA = cv.All(
|
||||
SN74HC595_PIN_SCHEMA = pins.gpio_base_schema(
|
||||
SN74HC595GPIOPin,
|
||||
cv.int_range(min=0, max=2047),
|
||||
modes=[CONF_OUTPUT],
|
||||
mode_validator=_validate_output_mode,
|
||||
invertable=True,
|
||||
).extend(
|
||||
{
|
||||
cv.GenerateID(): cv.declare_id(SN74HC595GPIOPin),
|
||||
cv.Required(CONF_SN74HC595): cv.use_id(SN74HC595Component),
|
||||
cv.Required(CONF_NUMBER): cv.int_range(min=0, max=2048, max_included=False),
|
||||
cv.Optional(CONF_MODE, default={}): cv.All(
|
||||
{
|
||||
cv.Optional(CONF_OUTPUT, default=True): cv.All(
|
||||
cv.boolean, _validate_output_mode
|
||||
),
|
||||
},
|
||||
),
|
||||
cv.Optional(CONF_INVERTED, default=False): cv.boolean,
|
||||
}
|
||||
)
|
||||
|
||||
|
|
|
@ -39,8 +39,8 @@ def validate(config):
|
|||
)
|
||||
|
||||
with cv.prepend_path(CONF_MIN_LENGTH):
|
||||
if config[CONF_MIN_LENGTH] >= config[CONF_MAX_LENGTH]:
|
||||
raise cv.Invalid("min_length must be less than max_length")
|
||||
if config[CONF_MIN_LENGTH] > config[CONF_MAX_LENGTH]:
|
||||
raise cv.Invalid("min_length must be less than or equal to max_length")
|
||||
return config
|
||||
|
||||
|
||||
|
|
|
@ -164,7 +164,7 @@ void WiFiComponent::loop() {
|
|||
|
||||
#ifdef USE_WIFI_AP
|
||||
if (this->has_ap() && !this->ap_setup_) {
|
||||
if (now - this->last_connected_ > this->ap_timeout_) {
|
||||
if (this->ap_timeout_ != 0 && (now - this->last_connected_ > this->ap_timeout_)) {
|
||||
ESP_LOGI(TAG, "Starting fallback AP!");
|
||||
this->setup_ap_config_();
|
||||
#ifdef USE_CAPTIVE_PORTAL
|
||||
|
|
|
@ -7,6 +7,7 @@ import re
|
|||
from typing import Optional, Union
|
||||
|
||||
from contextlib import contextmanager
|
||||
import contextvars
|
||||
|
||||
import voluptuous as vol
|
||||
|
||||
|
@ -25,7 +26,7 @@ from esphome.core import CORE, EsphomeError
|
|||
from esphome.helpers import indent
|
||||
from esphome.util import safe_print, OrderedDict
|
||||
|
||||
from esphome.config_helpers import Extend
|
||||
from esphome.config_helpers import Extend, Remove
|
||||
from esphome.loader import get_component, get_platform, ComponentManifest
|
||||
from esphome.yaml_util import is_secret, ESPHomeDataBase, ESPForceValue
|
||||
from esphome.voluptuous_schema import ExtraKeysInvalid
|
||||
|
@ -53,6 +54,7 @@ def iter_components(config):
|
|||
|
||||
|
||||
ConfigPath = list[Union[str, int]]
|
||||
path_context = contextvars.ContextVar("Config path")
|
||||
|
||||
|
||||
def _path_begins_with(path: ConfigPath, other: ConfigPath) -> bool:
|
||||
|
@ -343,6 +345,12 @@ class LoadValidationStep(ConfigValidationStep):
|
|||
path + [CONF_ID],
|
||||
)
|
||||
continue
|
||||
if isinstance(p_id, Remove):
|
||||
result.add_str_error(
|
||||
f"Source for removal of ID '{p_id.value}' was not found.",
|
||||
path + [CONF_ID],
|
||||
)
|
||||
continue
|
||||
result.add_str_error("No platform specified! See 'platform' key.", path)
|
||||
continue
|
||||
# Remove temp output path and construct new one
|
||||
|
@ -489,6 +497,7 @@ class SchemaValidationStep(ConfigValidationStep):
|
|||
def run(self, result: Config) -> None:
|
||||
if self.comp.config_schema is None:
|
||||
return
|
||||
token = path_context.set(self.path)
|
||||
with result.catch_error(self.path):
|
||||
if self.comp.is_platform:
|
||||
# Remove 'platform' key for validation
|
||||
|
@ -507,6 +516,7 @@ class SchemaValidationStep(ConfigValidationStep):
|
|||
validated = schema(self.conf)
|
||||
result.set_by_path(self.path, validated)
|
||||
|
||||
path_context.reset(token)
|
||||
result.add_validation_step(FinalValidateValidationStep(self.path, self.comp))
|
||||
|
||||
|
||||
|
@ -630,6 +640,35 @@ class IDPassValidationStep(ConfigValidationStep):
|
|||
)
|
||||
|
||||
|
||||
class RemoveReferenceValidationStep(ConfigValidationStep):
|
||||
"""
|
||||
Make sure all !remove references have been removed from the config.
|
||||
Any left overs mean the merge step couldn't find corresponding previously existing id/key
|
||||
"""
|
||||
|
||||
def run(self, result: Config) -> None:
|
||||
if result.errors:
|
||||
# If result already has errors, skip this step
|
||||
return
|
||||
|
||||
def recursive_check_remove_tag(config: Config, path: ConfigPath = None):
|
||||
path = path or []
|
||||
|
||||
if isinstance(config, Remove):
|
||||
result.add_str_error(
|
||||
f"Source for removal at '{'->'.join([str(p) for p in path])}' was not found.",
|
||||
path,
|
||||
)
|
||||
elif isinstance(config, list):
|
||||
for i, item in enumerate(config):
|
||||
recursive_check_remove_tag(item, path + [i])
|
||||
elif isinstance(config, dict):
|
||||
for key, value in config.items():
|
||||
recursive_check_remove_tag(value, path + [key])
|
||||
|
||||
recursive_check_remove_tag(result)
|
||||
|
||||
|
||||
class FinalValidateValidationStep(ConfigValidationStep):
|
||||
"""Run final_validate_schema for all components."""
|
||||
|
||||
|
@ -652,37 +691,24 @@ class FinalValidateValidationStep(ConfigValidationStep):
|
|||
if self.comp.final_validate_schema is not None:
|
||||
self.comp.final_validate_schema(conf)
|
||||
|
||||
fconf = fv.full_config.get()
|
||||
|
||||
def _check_pins(c):
|
||||
for value in c.values():
|
||||
if not isinstance(value, dict):
|
||||
continue
|
||||
for key, (
|
||||
_,
|
||||
_,
|
||||
pin_final_validate,
|
||||
) in pins.PIN_SCHEMA_REGISTRY.items():
|
||||
if (
|
||||
key != CORE.target_platform
|
||||
and key in value
|
||||
and pin_final_validate is not None
|
||||
):
|
||||
pin_final_validate(fconf, value)
|
||||
|
||||
# Check for pin configs and a final_validate schema in the pin registry
|
||||
confs = conf
|
||||
if not isinstance(
|
||||
confs, list
|
||||
): # Handle components like SPI that have a list instead of MULTI_CONF
|
||||
confs = [conf]
|
||||
for c in confs:
|
||||
if c: # Some component have None or empty schemas
|
||||
_check_pins(c)
|
||||
|
||||
fv.full_config.reset(token)
|
||||
|
||||
|
||||
class PinUseValidationCheck(ConfigValidationStep):
|
||||
"""Check for pin reuse"""
|
||||
|
||||
priority = -30 # Should happen after component final validations
|
||||
|
||||
def __init__(self) -> None:
|
||||
pass
|
||||
|
||||
def run(self, result: Config) -> None:
|
||||
if result.errors:
|
||||
# If result already has errors, skip this step
|
||||
return
|
||||
pins.PIN_SCHEMA_REGISTRY.final_validate(result)
|
||||
|
||||
|
||||
def validate_config(config, command_line_substitutions) -> Config:
|
||||
result = Config()
|
||||
|
||||
|
@ -778,6 +804,9 @@ def validate_config(config, command_line_substitutions) -> Config:
|
|||
for domain, conf in config.items():
|
||||
result.add_validation_step(LoadValidationStep(domain, conf))
|
||||
result.add_validation_step(IDPassValidationStep())
|
||||
result.add_validation_step(PinUseValidationCheck())
|
||||
|
||||
result.add_validation_step(RemoveReferenceValidationStep())
|
||||
|
||||
result.run_validation_steps()
|
||||
|
||||
|
|
|
@ -22,6 +22,22 @@ class Extend:
|
|||
return isinstance(b, Extend) and self.value == b.value
|
||||
|
||||
|
||||
class Remove:
|
||||
def __init__(self, value=None):
|
||||
self.value = value
|
||||
|
||||
def __str__(self):
|
||||
return f"!remove {self.value}"
|
||||
|
||||
def __eq__(self, b):
|
||||
"""
|
||||
Check if two Remove objects contain the same ID.
|
||||
|
||||
Only used in unit tests.
|
||||
"""
|
||||
return isinstance(b, Remove) and self.value == b.value
|
||||
|
||||
|
||||
def read_config_file(path: str) -> str:
|
||||
if CORE.vscode and (
|
||||
not CORE.ace or os.path.abspath(path) == os.path.abspath(CORE.config_path)
|
||||
|
@ -48,7 +64,10 @@ def merge_config(full_old, full_new):
|
|||
return new
|
||||
res = old.copy()
|
||||
for k, v in new.items():
|
||||
res[k] = merge(old[k], v) if k in old else v
|
||||
if isinstance(v, Remove) and k in old:
|
||||
del res[k]
|
||||
else:
|
||||
res[k] = merge(old[k], v) if k in old else v
|
||||
return res
|
||||
if isinstance(new, list):
|
||||
if not isinstance(old, list):
|
||||
|
@ -59,6 +78,7 @@ def merge_config(full_old, full_new):
|
|||
for i, v in enumerate(res)
|
||||
if CONF_ID in v and isinstance(v[CONF_ID], str)
|
||||
}
|
||||
ids_to_delete = []
|
||||
for v in new:
|
||||
if CONF_ID in v:
|
||||
new_id = v[CONF_ID]
|
||||
|
@ -68,9 +88,15 @@ def merge_config(full_old, full_new):
|
|||
v[CONF_ID] = new_id
|
||||
res[ids[new_id]] = merge(res[ids[new_id]], v)
|
||||
continue
|
||||
elif isinstance(new_id, Remove):
|
||||
new_id = new_id.value
|
||||
if new_id in ids:
|
||||
ids_to_delete.append(ids[new_id])
|
||||
continue
|
||||
else:
|
||||
ids[new_id] = len(res)
|
||||
res.append(v)
|
||||
res = [v for i, v in enumerate(res) if i not in ids_to_delete]
|
||||
return res
|
||||
if new is None:
|
||||
return old
|
||||
|
|
|
@ -13,7 +13,7 @@ import voluptuous as vol
|
|||
|
||||
from esphome import core
|
||||
import esphome.codegen as cg
|
||||
from esphome.config_helpers import Extend
|
||||
from esphome.config_helpers import Extend, Remove
|
||||
from esphome.const import (
|
||||
ALLOWED_NAME_CHARS,
|
||||
CONF_AVAILABILITY,
|
||||
|
@ -532,6 +532,10 @@ def declare_id(type):
|
|||
|
||||
if isinstance(value, Extend):
|
||||
raise Invalid(f"Source for extension of ID '{value.value}' was not found.")
|
||||
|
||||
if isinstance(value, Remove):
|
||||
raise Invalid(f"Source for Removal of ID '{value.value}' was not found.")
|
||||
|
||||
return core.ID(validate_id_name(value), is_declaration=True, type=type)
|
||||
|
||||
return validator
|
||||
|
|
|
@ -46,6 +46,7 @@ CONF_ADDRESS = "address"
|
|||
CONF_ADDRESSABLE_LIGHT_ID = "addressable_light_id"
|
||||
CONF_ADVANCED = "advanced"
|
||||
CONF_AFTER = "after"
|
||||
CONF_ALLOW_OTHER_USES = "allow_other_uses"
|
||||
CONF_ALPHA = "alpha"
|
||||
CONF_ALTITUDE = "altitude"
|
||||
CONF_ANALOG = "analog"
|
||||
|
|
|
@ -522,8 +522,12 @@ class EsphomeCore:
|
|||
self.component_ids = set()
|
||||
# Whether ESPHome was started in verbose mode
|
||||
self.verbose = False
|
||||
# Whether ESPHome was started in quiet mode
|
||||
self.quiet = False
|
||||
|
||||
def reset(self):
|
||||
from esphome.pins import PIN_SCHEMA_REGISTRY
|
||||
|
||||
self.dashboard = False
|
||||
self.name = None
|
||||
self.friendly_name = None
|
||||
|
@ -543,6 +547,7 @@ class EsphomeCore:
|
|||
self.platformio_options = {}
|
||||
self.loaded_integrations = set()
|
||||
self.component_ids = set()
|
||||
PIN_SCHEMA_REGISTRY.reset()
|
||||
|
||||
@property
|
||||
def address(self) -> Optional[str]:
|
||||
|
|
|
@ -78,6 +78,7 @@ def setup_log(
|
|||
CORE.verbose = True
|
||||
elif quiet:
|
||||
log_level = logging.CRITICAL
|
||||
CORE.quiet = True
|
||||
else:
|
||||
log_level = logging.INFO
|
||||
logging.basicConfig(level=log_level)
|
||||
|
|
185
esphome/pins.py
185
esphome/pins.py
|
@ -1,5 +1,7 @@
|
|||
import operator
|
||||
from functools import reduce
|
||||
import esphome.config_validation as cv
|
||||
from esphome.core import CORE, ID
|
||||
|
||||
from esphome.const import (
|
||||
CONF_INPUT,
|
||||
|
@ -10,16 +12,120 @@ from esphome.const import (
|
|||
CONF_PULLDOWN,
|
||||
CONF_PULLUP,
|
||||
CONF_IGNORE_STRAPPING_WARNING,
|
||||
CONF_ALLOW_OTHER_USES,
|
||||
CONF_INVERTED,
|
||||
)
|
||||
from esphome.util import PinRegistry
|
||||
from esphome.core import CORE
|
||||
|
||||
|
||||
class PinRegistry(dict):
|
||||
def __init__(self):
|
||||
super().__init__()
|
||||
self.pins_used = {}
|
||||
|
||||
def reset(self):
|
||||
self.pins_used = {}
|
||||
|
||||
def get_count(self, key, number):
|
||||
"""
|
||||
Get the number of places a given pin is used.
|
||||
:param key: The ID of the defining component
|
||||
:param number: The pin number
|
||||
:return: The number of places the pin is used.
|
||||
"""
|
||||
pin_key = (key, number)
|
||||
return self.pins_used[pin_key] if pin_key in self.pins_used else 0
|
||||
|
||||
def register(self, name, schema, final_validate=None):
|
||||
"""
|
||||
Register a pin schema
|
||||
:param name:
|
||||
:param schema:
|
||||
:param final_validate:
|
||||
:return:
|
||||
"""
|
||||
|
||||
def decorator(fun):
|
||||
self[name] = (fun, schema, final_validate)
|
||||
return fun
|
||||
|
||||
return decorator
|
||||
|
||||
def validate(self, conf, key=None):
|
||||
"""
|
||||
Validate a pin against a registered schema
|
||||
:param conf The pin config
|
||||
:param key: an optional scalar key (e.g. platform)
|
||||
:return: The transformed result
|
||||
"""
|
||||
from esphome.config import path_context
|
||||
|
||||
key = self.get_key(conf) if key is None else key
|
||||
# Element 1 is the pin validation function
|
||||
# evaluate here so a validation failure skips the rest
|
||||
result = self[key][1](conf)
|
||||
if CONF_NUMBER in result:
|
||||
# key maps to the pin schema
|
||||
if isinstance(key, ID):
|
||||
key = key.id
|
||||
pin_key = (key, result[CONF_NUMBER])
|
||||
if pin_key not in self.pins_used:
|
||||
self.pins_used[pin_key] = []
|
||||
# client_id identifies the instance of the providing component
|
||||
client_id = result.get(key)
|
||||
self.pins_used[pin_key].append((path_context.get(), client_id, result))
|
||||
# return the validated pin config
|
||||
return result
|
||||
|
||||
def get_key(self, conf):
|
||||
"""
|
||||
Is there a key in conf corresponding to a registered pin schema?
|
||||
If not, fall back to the default platform schema.
|
||||
:param conf The config for the component
|
||||
:return: the schema key
|
||||
"""
|
||||
keys = list(filter(lambda k: k in conf, self))
|
||||
return keys[0] if keys else CORE.target_platform
|
||||
|
||||
def get_to_code(self, key):
|
||||
"""
|
||||
Return the code generator function for a pin schema, stored as tuple element 0
|
||||
:param conf: The pin config
|
||||
:param key An optional specific key
|
||||
:return: The awaitable coroutine
|
||||
"""
|
||||
key = self.get_key(key) if isinstance(key, dict) else key
|
||||
return self[key][0]
|
||||
|
||||
def final_validate(self, fconf):
|
||||
"""
|
||||
Run the final validation for all pins, and check for reuse
|
||||
:param fconf: The full config
|
||||
"""
|
||||
for (key, _), pin_list in self.pins_used.items():
|
||||
count = len(pin_list) # number of places same pin used.
|
||||
final_val_fun = self[key][2] # final validation function
|
||||
for pin_path, client_id, pin_config in pin_list:
|
||||
with fconf.catch_error([cv.ROOT_CONFIG_PATH] + pin_path):
|
||||
if final_val_fun is not None:
|
||||
# Get the containing path of the config providing this pin.
|
||||
parent_path = fconf.get_path_for_id(client_id)[:-1]
|
||||
parent_config = fconf.get_config_for_path(parent_path)
|
||||
final_val_fun(pin_config, parent_config)
|
||||
allow_others = pin_config.get(CONF_ALLOW_OTHER_USES, False)
|
||||
if count != 1 and not allow_others:
|
||||
raise cv.Invalid(
|
||||
f"Pin {pin_config[CONF_NUMBER]} is used in multiple places"
|
||||
)
|
||||
if count == 1 and allow_others:
|
||||
raise cv.Invalid(
|
||||
f"Pin {pin_config[CONF_NUMBER]} incorrectly sets {CONF_ALLOW_OTHER_USES}: true"
|
||||
)
|
||||
|
||||
|
||||
PIN_SCHEMA_REGISTRY = PinRegistry()
|
||||
|
||||
|
||||
def _set_mode(value, default_mode):
|
||||
import esphome.config_validation as cv
|
||||
|
||||
if CONF_MODE not in value:
|
||||
return {**value, CONF_MODE: default_mode}
|
||||
mode = value[CONF_MODE]
|
||||
|
@ -65,20 +171,26 @@ def _schema_creator(default_mode, internal: bool = False):
|
|||
if not isinstance(value, dict):
|
||||
return validator({CONF_NUMBER: value})
|
||||
value = _set_mode(value, default_mode)
|
||||
if not internal:
|
||||
for key, entry in PIN_SCHEMA_REGISTRY.items():
|
||||
if key != CORE.target_platform and key in value:
|
||||
return entry[1](value)
|
||||
return PIN_SCHEMA_REGISTRY[CORE.target_platform][1](value)
|
||||
if internal:
|
||||
return PIN_SCHEMA_REGISTRY.validate(value, CORE.target_platform)
|
||||
return PIN_SCHEMA_REGISTRY.validate(value)
|
||||
|
||||
return validator
|
||||
|
||||
|
||||
def _internal_number_creator(mode):
|
||||
def validator(value):
|
||||
value_d = {CONF_NUMBER: value}
|
||||
if isinstance(value, dict):
|
||||
if CONF_MODE in value or CONF_INVERTED in value:
|
||||
raise cv.Invalid(
|
||||
"This variable only supports pin numbers, not full pin schemas "
|
||||
"(with inverted and mode)."
|
||||
)
|
||||
value_d = value
|
||||
else:
|
||||
value_d = {CONF_NUMBER: value}
|
||||
value_d = _set_mode(value_d, mode)
|
||||
return PIN_SCHEMA_REGISTRY[CORE.target_platform][1](value_d)[CONF_NUMBER]
|
||||
return PIN_SCHEMA_REGISTRY.validate(value_d, CORE.target_platform)[CONF_NUMBER]
|
||||
|
||||
return validator
|
||||
|
||||
|
@ -149,8 +261,6 @@ internal_gpio_input_pullup_pin_number = _internal_number_creator(
|
|||
|
||||
|
||||
def check_strapping_pin(conf, strapping_pin_list, logger):
|
||||
import esphome.config_validation as cv
|
||||
|
||||
num = conf[CONF_NUMBER]
|
||||
if num in strapping_pin_list and not conf.get(CONF_IGNORE_STRAPPING_WARNING):
|
||||
logger.warning(
|
||||
|
@ -161,3 +271,52 @@ def check_strapping_pin(conf, strapping_pin_list, logger):
|
|||
# mitigate undisciplined use of strapping:
|
||||
if num not in strapping_pin_list and conf.get(CONF_IGNORE_STRAPPING_WARNING):
|
||||
raise cv.Invalid(f"GPIO{num} is not a strapping pin")
|
||||
|
||||
|
||||
GPIO_STANDARD_MODES = (
|
||||
CONF_INPUT,
|
||||
CONF_OUTPUT,
|
||||
CONF_OPEN_DRAIN,
|
||||
CONF_PULLUP,
|
||||
CONF_PULLDOWN,
|
||||
)
|
||||
|
||||
|
||||
def gpio_validate_modes(value):
|
||||
if not value[CONF_INPUT] and not value[CONF_OUTPUT]:
|
||||
raise cv.Invalid("Mode must be input or output")
|
||||
return value
|
||||
|
||||
|
||||
def gpio_base_schema(
|
||||
pin_type,
|
||||
number_validator,
|
||||
modes=GPIO_STANDARD_MODES,
|
||||
mode_validator=gpio_validate_modes,
|
||||
invertable=True,
|
||||
):
|
||||
"""
|
||||
Generate a base gpio pin schema
|
||||
:param pin_type: The type for the pin variable
|
||||
:param number_validator: A validator for the pin number
|
||||
:param modes: The available modes, default is all standard modes
|
||||
:param mode_validator: A validator function for the pin mode
|
||||
:param invertable: If the pin supports hardware inversion
|
||||
:return: A schema for the pin
|
||||
"""
|
||||
mode_default = len(modes) == 1
|
||||
mode_dict = dict(
|
||||
map(lambda m: (cv.Optional(m, default=mode_default), cv.boolean), modes)
|
||||
)
|
||||
|
||||
schema = cv.Schema(
|
||||
{
|
||||
cv.GenerateID(): cv.declare_id(pin_type),
|
||||
cv.Required(CONF_NUMBER): number_validator,
|
||||
cv.Optional(CONF_ALLOW_OTHER_USES): cv.boolean,
|
||||
cv.Optional(CONF_MODE, default={}): cv.All(mode_dict, mode_validator),
|
||||
}
|
||||
)
|
||||
if invertable:
|
||||
return schema.extend({cv.Optional(CONF_INVERTED, default=False): cv.boolean})
|
||||
return schema
|
||||
|
|
|
@ -57,32 +57,6 @@ class SimpleRegistry(dict):
|
|||
return decorator
|
||||
|
||||
|
||||
def _final_validate(parent_id_key, fun):
|
||||
def validator(fconf, pin_config):
|
||||
import esphome.config_validation as cv
|
||||
|
||||
parent_path = fconf.get_path_for_id(pin_config[parent_id_key])[:-1]
|
||||
parent_config = fconf.get_config_for_path(parent_path)
|
||||
|
||||
pin_path = fconf.get_path_for_id(pin_config[const.CONF_ID])[:-1]
|
||||
with cv.prepend_path([cv.ROOT_CONFIG_PATH] + pin_path):
|
||||
fun(pin_config, parent_config)
|
||||
|
||||
return validator
|
||||
|
||||
|
||||
class PinRegistry(dict):
|
||||
def register(self, name, schema, final_validate=None):
|
||||
if final_validate is not None:
|
||||
final_validate = _final_validate(name, final_validate)
|
||||
|
||||
def decorator(fun):
|
||||
self[name] = (fun, schema, final_validate)
|
||||
return fun
|
||||
|
||||
return decorator
|
||||
|
||||
|
||||
def safe_print(message="", end="\n"):
|
||||
from esphome.core import CORE
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@ import yaml
|
|||
import yaml.constructor
|
||||
|
||||
from esphome import core
|
||||
from esphome.config_helpers import read_config_file, Extend
|
||||
from esphome.config_helpers import read_config_file, Extend, Remove
|
||||
from esphome.core import (
|
||||
EsphomeError,
|
||||
IPAddress,
|
||||
|
@ -362,6 +362,10 @@ class ESPHomeLoader(FastestAvailableSafeLoader):
|
|||
def construct_extend(self, node):
|
||||
return Extend(str(node.value))
|
||||
|
||||
@_add_data_ref
|
||||
def construct_remove(self, node):
|
||||
return Remove(str(node.value))
|
||||
|
||||
|
||||
ESPHomeLoader.add_constructor("tag:yaml.org,2002:int", ESPHomeLoader.construct_yaml_int)
|
||||
ESPHomeLoader.add_constructor(
|
||||
|
@ -394,6 +398,7 @@ ESPHomeLoader.add_constructor(
|
|||
ESPHomeLoader.add_constructor("!lambda", ESPHomeLoader.construct_lambda)
|
||||
ESPHomeLoader.add_constructor("!force", ESPHomeLoader.construct_force)
|
||||
ESPHomeLoader.add_constructor("!extend", ESPHomeLoader.construct_extend)
|
||||
ESPHomeLoader.add_constructor("!remove", ESPHomeLoader.construct_remove)
|
||||
|
||||
|
||||
def load_yaml(fname, clear_secrets=True):
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
voluptuous==0.13.1
|
||||
voluptuous==0.14.1
|
||||
PyYAML==6.0.1
|
||||
paho-mqtt==1.6.1
|
||||
colorama==0.4.6
|
||||
|
@ -10,8 +10,8 @@ platformio==6.1.11 # When updating platformio, also update Dockerfile
|
|||
esptool==4.6.2
|
||||
click==8.1.7
|
||||
esphome-dashboard==20231107.0
|
||||
aioesphomeapi==19.2.1
|
||||
zeroconf==0.127.0
|
||||
aioesphomeapi==19.3.0
|
||||
zeroconf==0.128.0
|
||||
python-magic==0.4.27
|
||||
|
||||
# esp-idf requires this, but doesn't bundle it by default
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
pylint==2.17.6
|
||||
pylint==3.0.2
|
||||
flake8==6.1.0 # also change in .pre-commit-config.yaml when updating
|
||||
black==23.11.0 # also change in .pre-commit-config.yaml when updating
|
||||
pyupgrade==3.15.0 # also change in .pre-commit-config.yaml when updating
|
||||
|
@ -8,7 +8,7 @@ pre-commit
|
|||
pytest==7.4.3
|
||||
pytest-cov==4.1.0
|
||||
pytest-mock==3.12.0
|
||||
pytest-asyncio==0.21.1
|
||||
pytest-asyncio==0.23.2
|
||||
asyncmock==0.4.2
|
||||
hypothesis==5.49.0
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@ from esphome.const import (
|
|||
CONF_WIFI,
|
||||
)
|
||||
from esphome.components.packages import do_packages_pass
|
||||
from esphome.config_helpers import Extend
|
||||
from esphome.config_helpers import Extend, Remove
|
||||
import esphome.config_validation as cv
|
||||
|
||||
# Test strings
|
||||
|
@ -349,3 +349,165 @@ def test_package_merge_by_missing_id():
|
|||
|
||||
actual = do_packages_pass(config)
|
||||
assert actual == expected
|
||||
|
||||
|
||||
def test_package_list_remove_by_id():
|
||||
"""
|
||||
Ensures that components with matching IDs are removed correctly.
|
||||
|
||||
In this test, two sensors are defined in a package, and one of them is removed at the top level.
|
||||
"""
|
||||
config = {
|
||||
CONF_PACKAGES: {
|
||||
"package_sensors": {
|
||||
CONF_SENSOR: [
|
||||
{
|
||||
CONF_ID: TEST_SENSOR_ID_1,
|
||||
CONF_PLATFORM: TEST_SENSOR_PLATFORM_1,
|
||||
CONF_NAME: TEST_SENSOR_NAME_1,
|
||||
},
|
||||
{
|
||||
CONF_ID: TEST_SENSOR_ID_2,
|
||||
CONF_PLATFORM: TEST_SENSOR_PLATFORM_1,
|
||||
CONF_NAME: TEST_SENSOR_NAME_2,
|
||||
},
|
||||
]
|
||||
},
|
||||
# "package2": {
|
||||
# CONF_SENSOR: [
|
||||
# {
|
||||
# CONF_ID: Remove(TEST_SENSOR_ID_1),
|
||||
# }
|
||||
# ],
|
||||
# },
|
||||
},
|
||||
CONF_SENSOR: [
|
||||
{
|
||||
CONF_ID: Remove(TEST_SENSOR_ID_1),
|
||||
},
|
||||
],
|
||||
}
|
||||
|
||||
expected = {
|
||||
CONF_SENSOR: [
|
||||
{
|
||||
CONF_ID: TEST_SENSOR_ID_2,
|
||||
CONF_PLATFORM: TEST_SENSOR_PLATFORM_1,
|
||||
CONF_NAME: TEST_SENSOR_NAME_2,
|
||||
},
|
||||
]
|
||||
}
|
||||
|
||||
actual = do_packages_pass(config)
|
||||
assert actual == expected
|
||||
|
||||
|
||||
def test_multiple_package_list_remove_by_id():
|
||||
"""
|
||||
Ensures that components with matching IDs are removed correctly.
|
||||
|
||||
In this test, two sensors are defined in a package, and one of them is removed in another package.
|
||||
"""
|
||||
config = {
|
||||
CONF_PACKAGES: {
|
||||
"package_sensors": {
|
||||
CONF_SENSOR: [
|
||||
{
|
||||
CONF_ID: TEST_SENSOR_ID_1,
|
||||
CONF_PLATFORM: TEST_SENSOR_PLATFORM_1,
|
||||
CONF_NAME: TEST_SENSOR_NAME_1,
|
||||
},
|
||||
{
|
||||
CONF_ID: TEST_SENSOR_ID_2,
|
||||
CONF_PLATFORM: TEST_SENSOR_PLATFORM_1,
|
||||
CONF_NAME: TEST_SENSOR_NAME_2,
|
||||
},
|
||||
]
|
||||
},
|
||||
"package2": {
|
||||
CONF_SENSOR: [
|
||||
{
|
||||
CONF_ID: Remove(TEST_SENSOR_ID_1),
|
||||
}
|
||||
],
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
expected = {
|
||||
CONF_SENSOR: [
|
||||
{
|
||||
CONF_ID: TEST_SENSOR_ID_2,
|
||||
CONF_PLATFORM: TEST_SENSOR_PLATFORM_1,
|
||||
CONF_NAME: TEST_SENSOR_NAME_2,
|
||||
},
|
||||
]
|
||||
}
|
||||
|
||||
actual = do_packages_pass(config)
|
||||
assert actual == expected
|
||||
|
||||
|
||||
def test_package_dict_remove_by_id(basic_wifi, basic_esphome):
|
||||
"""
|
||||
Ensures that components with missing IDs are removed from dict.
|
||||
"""
|
||||
"""
|
||||
Ensures that the top-level configuration takes precedence over duplicate keys defined in a package.
|
||||
|
||||
In this test, CONF_SSID should be overwritten by that defined in the top-level config.
|
||||
"""
|
||||
config = {
|
||||
CONF_ESPHOME: basic_esphome,
|
||||
CONF_PACKAGES: {"network": {CONF_WIFI: basic_wifi}},
|
||||
CONF_WIFI: Remove(),
|
||||
}
|
||||
|
||||
expected = {
|
||||
CONF_ESPHOME: basic_esphome,
|
||||
}
|
||||
|
||||
actual = do_packages_pass(config)
|
||||
assert actual == expected
|
||||
|
||||
|
||||
def test_package_remove_by_missing_id():
|
||||
"""
|
||||
Ensures that components with missing IDs are not merged.
|
||||
"""
|
||||
|
||||
config = {
|
||||
CONF_PACKAGES: {
|
||||
"sensors": {
|
||||
CONF_SENSOR: [
|
||||
{CONF_ID: TEST_SENSOR_ID_1, CONF_FILTERS: [{CONF_MULTIPLY: 42.0}]},
|
||||
]
|
||||
}
|
||||
},
|
||||
"missing_key": Remove(),
|
||||
CONF_SENSOR: [
|
||||
{CONF_ID: TEST_SENSOR_ID_1, CONF_FILTERS: [{CONF_MULTIPLY: 10.0}]},
|
||||
{CONF_ID: Remove(TEST_SENSOR_ID_2), CONF_FILTERS: [{CONF_OFFSET: 146.0}]},
|
||||
],
|
||||
}
|
||||
|
||||
expected = {
|
||||
"missing_key": Remove(),
|
||||
CONF_SENSOR: [
|
||||
{
|
||||
CONF_ID: TEST_SENSOR_ID_1,
|
||||
CONF_FILTERS: [{CONF_MULTIPLY: 42.0}],
|
||||
},
|
||||
{
|
||||
CONF_ID: TEST_SENSOR_ID_1,
|
||||
CONF_FILTERS: [{CONF_MULTIPLY: 10.0}],
|
||||
},
|
||||
{
|
||||
CONF_ID: Remove(TEST_SENSOR_ID_2),
|
||||
CONF_FILTERS: [{CONF_OFFSET: 146.0}],
|
||||
},
|
||||
],
|
||||
}
|
||||
|
||||
actual = do_packages_pass(config)
|
||||
assert actual == expected
|
||||
|
|
6
tests/dashboard/common.py
Normal file
6
tests/dashboard/common.py
Normal file
|
@ -0,0 +1,6 @@
|
|||
import pathlib
|
||||
|
||||
|
||||
def get_fixture_path(filename: str) -> pathlib.Path:
|
||||
"""Get path of fixture."""
|
||||
return pathlib.Path(__file__).parent.joinpath("fixtures", filename)
|
47
tests/dashboard/fixtures/conf/pico.yaml
Normal file
47
tests/dashboard/fixtures/conf/pico.yaml
Normal file
|
@ -0,0 +1,47 @@
|
|||
substitutions:
|
||||
name: picoproxy
|
||||
friendly_name: Pico Proxy
|
||||
|
||||
esphome:
|
||||
name: ${name}
|
||||
friendly_name: ${friendly_name}
|
||||
project:
|
||||
name: esphome.bluetooth-proxy
|
||||
version: "1.0"
|
||||
|
||||
esp32:
|
||||
board: esp32dev
|
||||
framework:
|
||||
type: esp-idf
|
||||
|
||||
wifi:
|
||||
ap:
|
||||
|
||||
api:
|
||||
logger:
|
||||
ota:
|
||||
improv_serial:
|
||||
|
||||
dashboard_import:
|
||||
package_import_url: github://esphome/firmware/bluetooth-proxy/esp32-generic.yaml@main
|
||||
|
||||
button:
|
||||
- platform: factory_reset
|
||||
id: resetf
|
||||
- platform: safe_mode
|
||||
name: Safe Mode Boot
|
||||
entity_category: diagnostic
|
||||
|
||||
sensor:
|
||||
- platform: template
|
||||
id: pm11
|
||||
name: "pm 1.0µm"
|
||||
lambda: return 1.0;
|
||||
- platform: template
|
||||
id: pm251
|
||||
name: "pm 2.5µm"
|
||||
lambda: return 2.5;
|
||||
- platform: template
|
||||
id: pm101
|
||||
name: "pm 10µm"
|
||||
lambda: return 10;
|
80
tests/dashboard/test_web_server.py
Normal file
80
tests/dashboard/test_web_server.py
Normal file
|
@ -0,0 +1,80 @@
|
|||
from __future__ import annotations
|
||||
|
||||
import asyncio
|
||||
import json
|
||||
import os
|
||||
from unittest.mock import Mock
|
||||
|
||||
import pytest
|
||||
import pytest_asyncio
|
||||
from tornado.httpclient import AsyncHTTPClient, HTTPResponse
|
||||
from tornado.httpserver import HTTPServer
|
||||
from tornado.ioloop import IOLoop
|
||||
from tornado.testing import bind_unused_port
|
||||
|
||||
from esphome.dashboard import web_server
|
||||
from esphome.dashboard.core import DASHBOARD
|
||||
|
||||
from .common import get_fixture_path
|
||||
|
||||
|
||||
class DashboardTestHelper:
|
||||
def __init__(self, io_loop: IOLoop, client: AsyncHTTPClient, port: int) -> None:
|
||||
self.io_loop = io_loop
|
||||
self.client = client
|
||||
self.port = port
|
||||
|
||||
async def fetch(self, path: str, **kwargs) -> HTTPResponse:
|
||||
"""Get a response for the given path."""
|
||||
if path.lower().startswith(("http://", "https://")):
|
||||
url = path
|
||||
else:
|
||||
url = f"http://127.0.0.1:{self.port}{path}"
|
||||
future = self.client.fetch(url, raise_error=True, **kwargs)
|
||||
result = await future
|
||||
return result
|
||||
|
||||
|
||||
@pytest_asyncio.fixture()
|
||||
async def dashboard() -> DashboardTestHelper:
|
||||
sock, port = bind_unused_port()
|
||||
args = Mock(
|
||||
ha_addon=True,
|
||||
configuration=get_fixture_path("conf"),
|
||||
port=port,
|
||||
)
|
||||
DASHBOARD.settings.parse_args(args)
|
||||
app = web_server.make_app()
|
||||
http_server = HTTPServer(app)
|
||||
http_server.add_sockets([sock])
|
||||
await DASHBOARD.async_setup()
|
||||
os.environ["DISABLE_HA_AUTHENTICATION"] = "1"
|
||||
assert DASHBOARD.settings.using_password is False
|
||||
assert DASHBOARD.settings.on_ha_addon is True
|
||||
assert DASHBOARD.settings.using_auth is False
|
||||
task = asyncio.create_task(DASHBOARD.async_run())
|
||||
client = AsyncHTTPClient()
|
||||
io_loop = IOLoop(make_current=False)
|
||||
yield DashboardTestHelper(io_loop, client, port)
|
||||
task.cancel()
|
||||
sock.close()
|
||||
client.close()
|
||||
io_loop.close()
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_main_page(dashboard: DashboardTestHelper) -> None:
|
||||
response = await dashboard.fetch("/")
|
||||
assert response.code == 200
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_devices_page(dashboard: DashboardTestHelper) -> None:
|
||||
response = await dashboard.fetch("/devices")
|
||||
assert response.code == 200
|
||||
assert response.headers["content-type"] == "application/json"
|
||||
json_data = json.loads(response.body.decode())
|
||||
configured_devices = json_data["configured"]
|
||||
first_device = configured_devices[0]
|
||||
assert first_device["name"] == "pico"
|
||||
assert first_device["configuration"] == "pico.yaml"
|
|
@ -54,7 +54,9 @@ power_supply:
|
|||
|
||||
i2c:
|
||||
sda: 21
|
||||
scl: 22
|
||||
scl:
|
||||
number: 22
|
||||
allow_other_uses: true
|
||||
scan: true
|
||||
frequency: 100kHz
|
||||
setup_priority: -100
|
||||
|
@ -86,7 +88,9 @@ light:
|
|||
- platform: fastled_clockless
|
||||
id: addr1
|
||||
chipset: WS2811
|
||||
pin: GPIO23
|
||||
pin:
|
||||
allow_other_uses: true
|
||||
number: GPIO23
|
||||
num_leds: 60
|
||||
rgb_order: BRG
|
||||
max_refresh_rate: 20ms
|
||||
|
@ -168,8 +172,12 @@ light:
|
|||
- platform: fastled_spi
|
||||
id: addr2
|
||||
chipset: WS2801
|
||||
data_pin: GPIO23
|
||||
clock_pin: GPIO22
|
||||
data_pin:
|
||||
allow_other_uses: true
|
||||
number: GPIO23
|
||||
clock_pin:
|
||||
number: GPIO22
|
||||
allow_other_uses: true
|
||||
data_rate: 2MHz
|
||||
num_leds: 60
|
||||
rgb_order: BRG
|
||||
|
@ -190,7 +198,9 @@ light:
|
|||
variant: SK6812
|
||||
method: ESP32_I2S_0
|
||||
num_leds: 60
|
||||
pin: GPIO23
|
||||
pin:
|
||||
allow_other_uses: true
|
||||
number: GPIO23
|
||||
- platform: partition
|
||||
name: Partition Light
|
||||
segments:
|
||||
|
|
539
tests/test1.yaml
539
tests/test1.yaml
|
@ -181,8 +181,12 @@ mqtt:
|
|||
- light.turn_off: ${roomname}_lights
|
||||
|
||||
i2c:
|
||||
sda: 21
|
||||
scl: 22
|
||||
sda:
|
||||
allow_other_uses: true
|
||||
number: 21
|
||||
scl:
|
||||
allow_other_uses: true
|
||||
number: 22
|
||||
scan: true
|
||||
frequency: 100kHz
|
||||
setup_priority: -100
|
||||
|
@ -190,15 +194,23 @@ i2c:
|
|||
|
||||
spi:
|
||||
id: spi_bus
|
||||
clk_pin: GPIO21
|
||||
mosi_pin: GPIO22
|
||||
miso_pin: GPIO23
|
||||
clk_pin:
|
||||
allow_other_uses: true
|
||||
number: GPIO21
|
||||
mosi_pin:
|
||||
allow_other_uses: true
|
||||
number: GPIO22
|
||||
miso_pin:
|
||||
allow_other_uses: true
|
||||
number: GPIO23
|
||||
|
||||
uart:
|
||||
- tx_pin:
|
||||
allow_other_uses: true
|
||||
number: GPIO22
|
||||
inverted: true
|
||||
rx_pin:
|
||||
allow_other_uses: true
|
||||
number: GPIO23
|
||||
inverted: true
|
||||
baud_rate: 115200
|
||||
|
@ -220,18 +232,30 @@ uart:
|
|||
- lambda: UARTDebug::log_int(direction, bytes, ',');
|
||||
- lambda: UARTDebug::log_binary(direction, bytes, ';');
|
||||
- id: ld2410_uart
|
||||
tx_pin: 18
|
||||
rx_pin: 23
|
||||
tx_pin:
|
||||
allow_other_uses: true
|
||||
number: 18
|
||||
rx_pin:
|
||||
allow_other_uses: true
|
||||
number: 23
|
||||
baud_rate: 256000
|
||||
parity: NONE
|
||||
stop_bits: 1
|
||||
- id: dfrobot_mmwave_uart
|
||||
tx_pin: 14
|
||||
rx_pin: 27
|
||||
tx_pin:
|
||||
allow_other_uses: true
|
||||
number: 14
|
||||
rx_pin:
|
||||
allow_other_uses: true
|
||||
number: 27
|
||||
baud_rate: 115200
|
||||
- id: ld2420_uart
|
||||
tx_pin: 17
|
||||
rx_pin: 16
|
||||
tx_pin:
|
||||
allow_other_uses: true
|
||||
number: 17
|
||||
rx_pin:
|
||||
allow_other_uses: true
|
||||
number: 16
|
||||
baud_rate: 115200
|
||||
parity: NONE
|
||||
stop_bits: 1
|
||||
|
@ -282,12 +306,16 @@ power_supply:
|
|||
keep_on_time: 10s
|
||||
pin:
|
||||
number: 13
|
||||
allow_other_uses: true
|
||||
inverted: true
|
||||
|
||||
deep_sleep:
|
||||
run_duration: 20s
|
||||
sleep_duration: 50s
|
||||
wakeup_pin: GPIO2
|
||||
wakeup_pin:
|
||||
allow_other_uses: true
|
||||
number: GPIO2
|
||||
ignore_strapping_warning: true
|
||||
wakeup_pin_mode: INVERT_WAKEUP
|
||||
|
||||
ads1115:
|
||||
|
@ -295,11 +323,18 @@ ads1115:
|
|||
i2c_id: i2c_bus
|
||||
|
||||
dallas:
|
||||
pin: GPIO23
|
||||
pin:
|
||||
allow_other_uses: true
|
||||
number: GPIO23
|
||||
|
||||
as3935_spi:
|
||||
cs_pin: GPIO12
|
||||
irq_pin: GPIO13
|
||||
cs_pin:
|
||||
ignore_strapping_warning: true
|
||||
allow_other_uses: true
|
||||
number: GPIO12
|
||||
irq_pin:
|
||||
allow_other_uses: true
|
||||
number: GPIO13
|
||||
|
||||
esp32_ble:
|
||||
io_capability: keyboard_only
|
||||
|
@ -339,16 +374,24 @@ bedjet:
|
|||
time_id: sntp_time
|
||||
mcp23s08:
|
||||
- id: mcp23s08_hub
|
||||
cs_pin: GPIO12
|
||||
cs_pin:
|
||||
ignore_strapping_warning: true
|
||||
number: GPIO12
|
||||
allow_other_uses: true
|
||||
deviceaddress: 0
|
||||
|
||||
mcp23s17:
|
||||
- id: mcp23s17_hub
|
||||
cs_pin: GPIO12
|
||||
cs_pin:
|
||||
ignore_strapping_warning: true
|
||||
number: GPIO12
|
||||
allow_other_uses: true
|
||||
deviceaddress: 1
|
||||
|
||||
micronova:
|
||||
enable_rx_pin: 4
|
||||
enable_rx_pin:
|
||||
allow_other_uses: true
|
||||
number: 4
|
||||
uart_id: uart_0
|
||||
|
||||
dfrobot_sen0395:
|
||||
|
@ -539,7 +582,9 @@ sensor:
|
|||
name: NIR
|
||||
i2c_id: i2c_bus
|
||||
- platform: atm90e26
|
||||
cs_pin: 5
|
||||
cs_pin:
|
||||
allow_other_uses: true
|
||||
number: 5
|
||||
voltage:
|
||||
name: Line Voltage
|
||||
current:
|
||||
|
@ -558,7 +603,9 @@ sensor:
|
|||
gain_voltage: 26400
|
||||
gain_ct: 31251
|
||||
- platform: atm90e32
|
||||
cs_pin: 5
|
||||
cs_pin:
|
||||
allow_other_uses: true
|
||||
number: 5
|
||||
phase_a:
|
||||
voltage:
|
||||
name: EMON Line Voltage A
|
||||
|
@ -675,7 +722,9 @@ sensor:
|
|||
index: 1
|
||||
name: Living Room Temperature 2
|
||||
- platform: dht
|
||||
pin: GPIO26
|
||||
pin:
|
||||
allow_other_uses: true
|
||||
number: GPIO26
|
||||
temperature:
|
||||
id: dht_temperature
|
||||
name: Living Room Temperature 3
|
||||
|
@ -692,7 +741,9 @@ sensor:
|
|||
update_interval: 15s
|
||||
i2c_id: i2c_bus
|
||||
- platform: duty_cycle
|
||||
pin: GPIO25
|
||||
pin:
|
||||
allow_other_uses: true
|
||||
number: GPIO25
|
||||
name: Duty Cycle Sensor
|
||||
- platform: ee895
|
||||
co2:
|
||||
|
@ -721,9 +772,15 @@ sensor:
|
|||
update_interval: 15s
|
||||
i2c_id: i2c_bus
|
||||
- platform: hlw8012
|
||||
sel_pin: 5
|
||||
cf_pin: 14
|
||||
cf1_pin: 13
|
||||
sel_pin:
|
||||
allow_other_uses: true
|
||||
number: 5
|
||||
cf_pin:
|
||||
allow_other_uses: true
|
||||
number: 14
|
||||
cf1_pin:
|
||||
allow_other_uses: true
|
||||
number: 13
|
||||
current:
|
||||
name: HLW8012 Current
|
||||
voltage:
|
||||
|
@ -772,7 +829,9 @@ sensor:
|
|||
max_pressure: 15
|
||||
temperature:
|
||||
name: Honeywell temperature
|
||||
cs_pin: GPIO5
|
||||
cs_pin:
|
||||
allow_other_uses: true
|
||||
number: GPIO5
|
||||
- platform: honeywellabp2_i2c
|
||||
pressure:
|
||||
name: Honeywell2 pressure
|
||||
|
@ -806,8 +865,12 @@ sensor:
|
|||
i2c_id: i2c_bus
|
||||
- platform: hx711
|
||||
name: HX711 Value
|
||||
dout_pin: GPIO23
|
||||
clk_pin: GPIO25
|
||||
dout_pin:
|
||||
allow_other_uses: true
|
||||
number: GPIO23
|
||||
clk_pin:
|
||||
allow_other_uses: true
|
||||
number: GPIO25
|
||||
gain: 128
|
||||
update_interval: 15s
|
||||
- platform: ina219
|
||||
|
@ -880,22 +943,30 @@ sensor:
|
|||
i2c_id: i2c_bus
|
||||
- platform: max6675
|
||||
name: Living Room Temperature
|
||||
cs_pin: GPIO23
|
||||
cs_pin:
|
||||
allow_other_uses: true
|
||||
number: GPIO23
|
||||
update_interval: 15s
|
||||
- platform: max31855
|
||||
name: Den Temperature
|
||||
cs_pin: GPIO23
|
||||
cs_pin:
|
||||
allow_other_uses: true
|
||||
number: GPIO23
|
||||
update_interval: 15s
|
||||
reference_temperature:
|
||||
name: MAX31855 Internal Temperature
|
||||
- platform: max31856
|
||||
name: BBQ Temperature
|
||||
cs_pin: GPIO17
|
||||
cs_pin:
|
||||
allow_other_uses: true
|
||||
number: GPIO17
|
||||
update_interval: 15s
|
||||
mains_filter: 50Hz
|
||||
- platform: max31865
|
||||
name: Water Tank Temperature
|
||||
cs_pin: GPIO23
|
||||
cs_pin:
|
||||
allow_other_uses: true
|
||||
number: GPIO23
|
||||
update_interval: 15s
|
||||
reference_resistance: 430 Ω
|
||||
rtd_nominal_resistance: 100 Ω
|
||||
|
@ -1007,7 +1078,10 @@ sensor:
|
|||
i2c_id: i2c_bus
|
||||
- platform: pulse_counter
|
||||
name: Pulse Counter
|
||||
pin: GPIO12
|
||||
pin:
|
||||
ignore_strapping_warning: true
|
||||
number: GPIO12
|
||||
allow_other_uses: true
|
||||
count_mode:
|
||||
rising_edge: INCREMENT
|
||||
falling_edge: DECREMENT
|
||||
|
@ -1016,7 +1090,10 @@ sensor:
|
|||
- platform: pulse_meter
|
||||
name: Pulse Meter
|
||||
id: pulse_meter_sensor
|
||||
pin: GPIO12
|
||||
pin:
|
||||
ignore_strapping_warning: true
|
||||
number: GPIO12
|
||||
allow_other_uses: true
|
||||
internal_filter: 100ms
|
||||
timeout: 2 min
|
||||
on_value:
|
||||
|
@ -1039,9 +1116,15 @@ sensor:
|
|||
- platform: rotary_encoder
|
||||
name: Rotary Encoder
|
||||
id: rotary_encoder1
|
||||
pin_a: GPIO23
|
||||
pin_b: GPIO25
|
||||
pin_reset: GPIO25
|
||||
pin_a:
|
||||
allow_other_uses: true
|
||||
number: GPIO23
|
||||
pin_b:
|
||||
allow_other_uses: true
|
||||
number: GPIO25
|
||||
pin_reset:
|
||||
allow_other_uses: true
|
||||
number: GPIO25
|
||||
filters:
|
||||
- or:
|
||||
- debounce: 0.1s
|
||||
|
@ -1064,7 +1147,9 @@ sensor:
|
|||
- display_menu.up:
|
||||
- platform: pulse_width
|
||||
name: Pulse Width
|
||||
pin: GPIO12
|
||||
pin:
|
||||
allow_other_uses: true
|
||||
number: GPIO12
|
||||
- platform: sm300d2
|
||||
uart_id: uart_0
|
||||
co2:
|
||||
|
@ -1247,9 +1332,12 @@ sensor:
|
|||
address: 0x48
|
||||
i2c_id: i2c_bus
|
||||
- platform: ultrasonic
|
||||
trigger_pin: GPIO25
|
||||
trigger_pin:
|
||||
allow_other_uses: true
|
||||
number: GPIO25
|
||||
echo_pin:
|
||||
number: GPIO23
|
||||
allow_other_uses: true
|
||||
inverted: true
|
||||
name: Ultrasonic Sensor
|
||||
timeout: 5.5m
|
||||
|
@ -1296,9 +1384,14 @@ sensor:
|
|||
pin:
|
||||
number: GPIO04
|
||||
mode: INPUT
|
||||
allow_other_uses: true
|
||||
- platform: zyaura
|
||||
clock_pin: GPIO5
|
||||
data_pin: GPIO4
|
||||
clock_pin:
|
||||
allow_other_uses: true
|
||||
number: GPIO5
|
||||
data_pin:
|
||||
allow_other_uses: true
|
||||
number: GPIO4
|
||||
co2:
|
||||
name: ZyAura CO2
|
||||
temperature:
|
||||
|
@ -1572,6 +1665,7 @@ binary_sensor:
|
|||
mcp23xxx: mcp23s08_hub
|
||||
# Use pin number 1
|
||||
number: 1
|
||||
allow_other_uses: true
|
||||
# One of INPUT or INPUT_PULLUP
|
||||
mode: INPUT_PULLUP
|
||||
inverted: false
|
||||
|
@ -1581,6 +1675,7 @@ binary_sensor:
|
|||
mcp23xxx: mcp23s17_hub
|
||||
# Use pin number 1
|
||||
number: 1
|
||||
allow_other_uses: true
|
||||
# One of INPUT or INPUT_PULLUP
|
||||
mode: INPUT_PULLUP
|
||||
inverted: false
|
||||
|
@ -1589,13 +1684,16 @@ binary_sensor:
|
|||
pin:
|
||||
mcp23xxx: mcp23s17_hub
|
||||
# Use pin number 1
|
||||
allow_other_uses: true
|
||||
number: 1
|
||||
# One of INPUT or INPUT_PULLUP
|
||||
mode: INPUT_PULLUP
|
||||
inverted: false
|
||||
interrupt: FALLING
|
||||
- platform: gpio
|
||||
pin: GPIO9
|
||||
pin:
|
||||
allow_other_uses: true
|
||||
number: GPIO9
|
||||
name: Living Room Window
|
||||
device_class: window
|
||||
filters:
|
||||
|
@ -1664,11 +1762,13 @@ binary_sensor:
|
|||
- platform: gpio
|
||||
pin:
|
||||
number: GPIO9
|
||||
allow_other_uses: true
|
||||
mode: INPUT_PULLUP
|
||||
name: Living Room Window 2
|
||||
- platform: gpio
|
||||
pin:
|
||||
number: GPIO9
|
||||
allow_other_uses: true
|
||||
mode: INPUT_OUTPUT_OPEN_DRAIN
|
||||
name: Living Room Button
|
||||
- platform: status
|
||||
|
@ -1747,6 +1847,7 @@ binary_sensor:
|
|||
pin:
|
||||
mcp23xxx: mcp23017_hub
|
||||
number: 1
|
||||
allow_other_uses: true
|
||||
mode: INPUT
|
||||
inverted: true
|
||||
- platform: gpio
|
||||
|
@ -1767,6 +1868,7 @@ binary_sensor:
|
|||
name: Speed Fan Cycle binary sensor"
|
||||
pin:
|
||||
number: 18
|
||||
allow_other_uses: true
|
||||
mode:
|
||||
input: true
|
||||
pulldown: true
|
||||
|
@ -1891,42 +1993,66 @@ tlc59208f:
|
|||
i2c_id: i2c_bus
|
||||
|
||||
my9231:
|
||||
data_pin: GPIO12
|
||||
clock_pin: GPIO14
|
||||
data_pin:
|
||||
allow_other_uses: true
|
||||
number: GPIO12
|
||||
clock_pin:
|
||||
allow_other_uses: true
|
||||
number: GPIO14
|
||||
num_channels: 6
|
||||
num_chips: 2
|
||||
bit_depth: 16
|
||||
|
||||
sm2235:
|
||||
data_pin: GPIO4
|
||||
clock_pin: GPIO5
|
||||
data_pin:
|
||||
allow_other_uses: true
|
||||
number: GPIO4
|
||||
clock_pin:
|
||||
allow_other_uses: true
|
||||
number: GPIO5
|
||||
max_power_color_channels: 9
|
||||
max_power_white_channels: 9
|
||||
|
||||
sm2335:
|
||||
data_pin: GPIO4
|
||||
clock_pin: GPIO5
|
||||
data_pin:
|
||||
allow_other_uses: true
|
||||
number: GPIO4
|
||||
clock_pin:
|
||||
allow_other_uses: true
|
||||
number: GPIO5
|
||||
max_power_color_channels: 9
|
||||
max_power_white_channels: 9
|
||||
|
||||
bp1658cj:
|
||||
data_pin: GPIO3
|
||||
clock_pin: GPIO5
|
||||
data_pin:
|
||||
allow_other_uses: true
|
||||
number: GPIO3
|
||||
clock_pin:
|
||||
allow_other_uses: true
|
||||
number: GPIO5
|
||||
max_power_color_channels: 4
|
||||
max_power_white_channels: 6
|
||||
|
||||
bp5758d:
|
||||
data_pin: GPIO3
|
||||
clock_pin: GPIO5
|
||||
data_pin:
|
||||
allow_other_uses: true
|
||||
number: GPIO3
|
||||
clock_pin:
|
||||
allow_other_uses: true
|
||||
number: GPIO5
|
||||
|
||||
output:
|
||||
- platform: gpio
|
||||
pin: GPIO26
|
||||
pin:
|
||||
allow_other_uses: true
|
||||
number: GPIO26
|
||||
id: gpio_26
|
||||
power_supply: atx_power_supply
|
||||
inverted: false
|
||||
- platform: ledc
|
||||
pin: 19
|
||||
pin:
|
||||
allow_other_uses: true
|
||||
number: 19
|
||||
id: gpio_19
|
||||
frequency: 1500Hz
|
||||
channel: 14
|
||||
|
@ -1996,6 +2122,7 @@ output:
|
|||
pin:
|
||||
pcf8574: pcf8574_hub
|
||||
number: 0
|
||||
#allow_other_uses: true
|
||||
mode: OUTPUT
|
||||
inverted: false
|
||||
- platform: gpio
|
||||
|
@ -2003,6 +2130,7 @@ output:
|
|||
pin:
|
||||
pca9554: pca9554_hub
|
||||
number: 0
|
||||
#allow_other_uses: true
|
||||
mode: OUTPUT
|
||||
inverted: false
|
||||
- platform: gpio
|
||||
|
@ -2010,6 +2138,7 @@ output:
|
|||
pin:
|
||||
mcp23xxx: mcp23017_hub
|
||||
number: 0
|
||||
allow_other_uses: true
|
||||
mode: OUTPUT
|
||||
inverted: false
|
||||
- platform: gpio
|
||||
|
@ -2017,6 +2146,7 @@ output:
|
|||
pin:
|
||||
mcp23xxx: mcp23008_hub
|
||||
number: 0
|
||||
allow_other_uses: true
|
||||
mode: OUTPUT
|
||||
inverted: false
|
||||
- platform: gpio
|
||||
|
@ -2076,14 +2206,22 @@ output:
|
|||
channel: 3
|
||||
- platform: slow_pwm
|
||||
id: id24
|
||||
pin: GPIO26
|
||||
pin:
|
||||
allow_other_uses: true
|
||||
number: GPIO26
|
||||
period: 15s
|
||||
- platform: ac_dimmer
|
||||
id: dimmer1
|
||||
gate_pin: GPIO5
|
||||
zero_cross_pin: GPIO26
|
||||
gate_pin:
|
||||
allow_other_uses: true
|
||||
number: GPIO5
|
||||
zero_cross_pin:
|
||||
allow_other_uses: true
|
||||
number: GPIO26
|
||||
- platform: esp32_dac
|
||||
pin: GPIO25
|
||||
pin:
|
||||
allow_other_uses: true
|
||||
number: GPIO25
|
||||
id: dac_output
|
||||
- platform: mcp4725
|
||||
id: mcp4725_dac_output
|
||||
|
@ -2147,9 +2285,15 @@ output:
|
|||
current: 10
|
||||
- platform: x9c
|
||||
id: test_x9c
|
||||
cs_pin: GPIO25
|
||||
inc_pin: GPIO26
|
||||
ud_pin: GPIO27
|
||||
cs_pin:
|
||||
allow_other_uses: true
|
||||
number: GPIO25
|
||||
inc_pin:
|
||||
allow_other_uses: true
|
||||
number: GPIO26
|
||||
ud_pin:
|
||||
allow_other_uses: true
|
||||
number: GPIO27
|
||||
initial_value: 0.5
|
||||
|
||||
light:
|
||||
|
@ -2256,7 +2400,9 @@ light:
|
|||
warm_white_color_temperature: 500 mireds
|
||||
|
||||
remote_transmitter:
|
||||
- pin: 32
|
||||
- pin:
|
||||
allow_other_uses: true
|
||||
number: 32
|
||||
carrier_duty_percent: 100%
|
||||
|
||||
climate:
|
||||
|
@ -2440,6 +2586,7 @@ switch:
|
|||
mcp23xxx: mcp23s08_hub
|
||||
# Use pin number 0
|
||||
number: 0
|
||||
allow_other_uses: true
|
||||
mode: OUTPUT
|
||||
inverted: false
|
||||
- platform: gpio
|
||||
|
@ -2448,10 +2595,13 @@ switch:
|
|||
mcp23xxx: mcp23s17_hub
|
||||
# Use pin number 0
|
||||
number: 1
|
||||
allow_other_uses: true
|
||||
mode: OUTPUT
|
||||
inverted: false
|
||||
- platform: gpio
|
||||
pin: GPIO25
|
||||
pin:
|
||||
allow_other_uses: true
|
||||
number: GPIO25
|
||||
name: Living Room Dehumidifier
|
||||
icon: "mdi:restart"
|
||||
inverted: true
|
||||
|
@ -2834,12 +2984,24 @@ display:
|
|||
id: my_lcd_gpio
|
||||
dimensions: 18x4
|
||||
data_pins:
|
||||
- GPIO19
|
||||
- GPIO21
|
||||
- GPIO22
|
||||
- GPIO23
|
||||
enable_pin: GPIO23
|
||||
rs_pin: GPIO25
|
||||
-
|
||||
allow_other_uses: true
|
||||
number: GPIO19
|
||||
-
|
||||
allow_other_uses: true
|
||||
number: GPIO21
|
||||
-
|
||||
allow_other_uses: true
|
||||
number: GPIO22
|
||||
-
|
||||
allow_other_uses: true
|
||||
number: GPIO23
|
||||
enable_pin:
|
||||
allow_other_uses: true
|
||||
number: GPIO23
|
||||
rs_pin:
|
||||
allow_other_uses: true
|
||||
number: GPIO25
|
||||
lambda: |-
|
||||
it.print("Hello World!");
|
||||
- platform: lcd_pcf8574
|
||||
|
@ -2860,13 +3022,19 @@ display:
|
|||
it.print("Hello World!");
|
||||
i2c_id: i2c_bus
|
||||
- platform: max7219
|
||||
cs_pin: GPIO23
|
||||
cs_pin:
|
||||
allow_other_uses: true
|
||||
number: GPIO23
|
||||
num_chips: 1
|
||||
lambda: |-
|
||||
it.print("01234567");
|
||||
- platform: tm1637
|
||||
clk_pin: GPIO23
|
||||
dio_pin: GPIO25
|
||||
clk_pin:
|
||||
allow_other_uses: true
|
||||
number: GPIO23
|
||||
dio_pin:
|
||||
allow_other_uses: true
|
||||
number: GPIO25
|
||||
intensity: 3
|
||||
lambda: |-
|
||||
it.print("1234");
|
||||
|
@ -2874,6 +3042,7 @@ display:
|
|||
clk_pin:
|
||||
mcp23xxx: mcp23017_hub
|
||||
number: 1
|
||||
allow_other_uses: true
|
||||
dio_pin:
|
||||
mcp23xxx: mcp23017_hub
|
||||
number: 2
|
||||
|
@ -2883,15 +3052,23 @@ display:
|
|||
lambda: |-
|
||||
it.print("1234");
|
||||
- platform: pcd8544
|
||||
cs_pin: GPIO23
|
||||
dc_pin: GPIO23
|
||||
reset_pin: GPIO23
|
||||
cs_pin:
|
||||
allow_other_uses: true
|
||||
number: GPIO23
|
||||
dc_pin:
|
||||
allow_other_uses: true
|
||||
number: GPIO23
|
||||
reset_pin:
|
||||
allow_other_uses: true
|
||||
number: GPIO23
|
||||
contrast: 60
|
||||
lambda: |-
|
||||
it.rectangle(0, 0, it.get_width(), it.get_height());
|
||||
- platform: ssd1306_i2c
|
||||
model: SSD1306_128X64
|
||||
reset_pin: GPIO23
|
||||
reset_pin:
|
||||
allow_other_uses: true
|
||||
number: GPIO23
|
||||
address: 0x3C
|
||||
id: display1
|
||||
contrast: 60%
|
||||
|
@ -2912,28 +3089,48 @@ display:
|
|||
i2c_id: i2c_bus
|
||||
- platform: ssd1306_spi
|
||||
model: SSD1306 128x64
|
||||
cs_pin: GPIO23
|
||||
dc_pin: GPIO23
|
||||
reset_pin: GPIO23
|
||||
cs_pin:
|
||||
allow_other_uses: true
|
||||
number: GPIO23
|
||||
dc_pin:
|
||||
allow_other_uses: true
|
||||
number: GPIO23
|
||||
reset_pin:
|
||||
allow_other_uses: true
|
||||
number: GPIO23
|
||||
lambda: |-
|
||||
it.rectangle(0, 0, it.get_width(), it.get_height());
|
||||
- platform: ssd1322_spi
|
||||
model: SSD1322 256x64
|
||||
cs_pin: GPIO23
|
||||
dc_pin: GPIO23
|
||||
reset_pin: GPIO23
|
||||
cs_pin:
|
||||
allow_other_uses: true
|
||||
number: GPIO23
|
||||
dc_pin:
|
||||
allow_other_uses: true
|
||||
number: GPIO23
|
||||
reset_pin:
|
||||
allow_other_uses: true
|
||||
number: GPIO23
|
||||
lambda: |-
|
||||
it.rectangle(0, 0, it.get_width(), it.get_height());
|
||||
- platform: ssd1325_spi
|
||||
model: SSD1325 128x64
|
||||
cs_pin: GPIO23
|
||||
dc_pin: GPIO23
|
||||
reset_pin: GPIO23
|
||||
cs_pin:
|
||||
allow_other_uses: true
|
||||
number: GPIO23
|
||||
dc_pin:
|
||||
allow_other_uses: true
|
||||
number: GPIO23
|
||||
reset_pin:
|
||||
allow_other_uses: true
|
||||
number: GPIO23
|
||||
lambda: |-
|
||||
it.rectangle(0, 0, it.get_width(), it.get_height());
|
||||
- platform: ssd1327_i2c
|
||||
model: SSD1327 128X128
|
||||
reset_pin: GPIO23
|
||||
reset_pin:
|
||||
allow_other_uses: true
|
||||
number: GPIO23
|
||||
address: 0x3D
|
||||
id: display1327
|
||||
brightness: 60%
|
||||
|
@ -2947,29 +3144,53 @@ display:
|
|||
i2c_id: i2c_bus
|
||||
- platform: ssd1327_spi
|
||||
model: SSD1327 128x128
|
||||
cs_pin: GPIO23
|
||||
dc_pin: GPIO23
|
||||
reset_pin: GPIO23
|
||||
cs_pin:
|
||||
allow_other_uses: true
|
||||
number: GPIO23
|
||||
dc_pin:
|
||||
allow_other_uses: true
|
||||
number: GPIO23
|
||||
reset_pin:
|
||||
allow_other_uses: true
|
||||
number: GPIO23
|
||||
lambda: |-
|
||||
it.rectangle(0, 0, it.get_width(), it.get_height());
|
||||
- platform: ssd1331_spi
|
||||
cs_pin: GPIO23
|
||||
dc_pin: GPIO23
|
||||
reset_pin: GPIO23
|
||||
cs_pin:
|
||||
allow_other_uses: true
|
||||
number: GPIO23
|
||||
dc_pin:
|
||||
allow_other_uses: true
|
||||
number: GPIO23
|
||||
reset_pin:
|
||||
allow_other_uses: true
|
||||
number: GPIO23
|
||||
lambda: |-
|
||||
it.rectangle(0, 0, it.get_width(), it.get_height());
|
||||
- platform: ssd1351_spi
|
||||
model: SSD1351 128x128
|
||||
cs_pin: GPIO23
|
||||
dc_pin: GPIO23
|
||||
reset_pin: GPIO23
|
||||
cs_pin:
|
||||
allow_other_uses: true
|
||||
number: GPIO23
|
||||
dc_pin:
|
||||
allow_other_uses: true
|
||||
number: GPIO23
|
||||
reset_pin:
|
||||
allow_other_uses: true
|
||||
number: GPIO23
|
||||
lambda: |-
|
||||
it.rectangle(0, 0, it.get_width(), it.get_height());
|
||||
- platform: st7789v
|
||||
model: TTGO TDisplay 135x240
|
||||
cs_pin: GPIO5
|
||||
dc_pin: GPIO16
|
||||
reset_pin: GPIO23
|
||||
cs_pin:
|
||||
allow_other_uses: true
|
||||
number: GPIO5
|
||||
dc_pin:
|
||||
allow_other_uses: true
|
||||
number: GPIO16
|
||||
reset_pin:
|
||||
allow_other_uses: true
|
||||
number: GPIO23
|
||||
backlight_pin: no
|
||||
lambda: |-
|
||||
it.rectangle(0, 0, it.get_width(), it.get_height());
|
||||
|
@ -2977,15 +3198,22 @@ display:
|
|||
width: 128
|
||||
height: 64
|
||||
cs_pin:
|
||||
allow_other_uses: true
|
||||
number: GPIO23
|
||||
inverted: true
|
||||
lambda: |-
|
||||
it.rectangle(0, 0, it.get_width(), it.get_height());
|
||||
- platform: st7735
|
||||
model: INITR_BLACKTAB
|
||||
cs_pin: GPIO5
|
||||
dc_pin: GPIO16
|
||||
reset_pin: GPIO23
|
||||
cs_pin:
|
||||
allow_other_uses: true
|
||||
number: GPIO5
|
||||
dc_pin:
|
||||
allow_other_uses: true
|
||||
number: GPIO16
|
||||
reset_pin:
|
||||
allow_other_uses: true
|
||||
number: GPIO23
|
||||
rotation: 0
|
||||
device_width: 128
|
||||
device_height: 160
|
||||
|
@ -3001,10 +3229,16 @@ display:
|
|||
mirror_x: true
|
||||
mirror_y: false
|
||||
model: TFT 2.4
|
||||
cs_pin: GPIO5
|
||||
dc_pin: GPIO4
|
||||
cs_pin:
|
||||
allow_other_uses: true
|
||||
number: GPIO5
|
||||
dc_pin:
|
||||
allow_other_uses: true
|
||||
number: GPIO4
|
||||
color_palette: GRAYSCALE
|
||||
reset_pin: GPIO22
|
||||
reset_pin:
|
||||
allow_other_uses: true
|
||||
number: GPIO22
|
||||
lambda: |-
|
||||
it.rectangle(0, 0, it.get_width(), it.get_height());
|
||||
- platform: ili9xxx
|
||||
|
@ -3014,9 +3248,15 @@ display:
|
|||
offset_width: 20
|
||||
offset_height: 10
|
||||
model: TFT 2.4
|
||||
cs_pin: GPIO5
|
||||
dc_pin: GPIO4
|
||||
reset_pin: GPIO22
|
||||
cs_pin:
|
||||
allow_other_uses: true
|
||||
number: GPIO5
|
||||
dc_pin:
|
||||
allow_other_uses: true
|
||||
number: GPIO4
|
||||
reset_pin:
|
||||
allow_other_uses: true
|
||||
number: GPIO22
|
||||
auto_clear_enabled: false
|
||||
rotation: 90
|
||||
lambda: |-
|
||||
|
@ -3041,10 +3281,18 @@ display:
|
|||
it.print_battery(true);
|
||||
- platform: tm1621
|
||||
id: tm1621_display
|
||||
cs_pin: GPIO17
|
||||
data_pin: GPIO5
|
||||
read_pin: GPIO23
|
||||
write_pin: GPIO18
|
||||
cs_pin:
|
||||
allow_other_uses: true
|
||||
number: GPIO17
|
||||
data_pin:
|
||||
allow_other_uses: true
|
||||
number: GPIO5
|
||||
read_pin:
|
||||
allow_other_uses: true
|
||||
number: GPIO23
|
||||
write_pin:
|
||||
allow_other_uses: true
|
||||
number: GPIO18
|
||||
lambda: |-
|
||||
it.printf(0, "%.1f", id(dht_temperature).state);
|
||||
it.display_celsius(true);
|
||||
|
@ -3053,12 +3301,18 @@ display:
|
|||
|
||||
tm1651:
|
||||
id: tm1651_battery
|
||||
clk_pin: GPIO23
|
||||
dio_pin: GPIO23
|
||||
clk_pin:
|
||||
allow_other_uses: true
|
||||
number: GPIO23
|
||||
dio_pin:
|
||||
allow_other_uses: true
|
||||
number: GPIO23
|
||||
|
||||
remote_receiver:
|
||||
id: rcvr
|
||||
pin: GPIO32
|
||||
pin:
|
||||
allow_other_uses: true
|
||||
number: GPIO32
|
||||
dump: all
|
||||
on_coolix:
|
||||
then:
|
||||
|
@ -3068,11 +3322,16 @@ remote_receiver:
|
|||
delay: !lambda "return uint32_t(x.code) + x.protocol;"
|
||||
|
||||
status_led:
|
||||
pin: GPIO2
|
||||
pin:
|
||||
allow_other_uses: true
|
||||
number: GPIO2
|
||||
ignore_strapping_warning: true
|
||||
|
||||
pn532_spi:
|
||||
id: pn532_bs
|
||||
cs_pin: GPIO23
|
||||
cs_pin:
|
||||
allow_other_uses: true
|
||||
number: GPIO23
|
||||
update_interval: 1s
|
||||
on_tag:
|
||||
- lambda: |-
|
||||
|
@ -3094,7 +3353,9 @@ rdm6300:
|
|||
uart_id: uart_0
|
||||
|
||||
rc522_spi:
|
||||
cs_pin: GPIO23
|
||||
cs_pin:
|
||||
allow_other_uses: true
|
||||
number: GPIO23
|
||||
update_interval: 1s
|
||||
on_tag:
|
||||
- lambda: |-
|
||||
|
@ -3287,9 +3548,15 @@ mcp23016:
|
|||
stepper:
|
||||
- platform: a4988
|
||||
id: my_stepper
|
||||
step_pin: GPIO23
|
||||
dir_pin: GPIO25
|
||||
sleep_pin: GPIO25
|
||||
step_pin:
|
||||
allow_other_uses: true
|
||||
number: GPIO23
|
||||
dir_pin:
|
||||
allow_other_uses: true
|
||||
number: GPIO25
|
||||
sleep_pin:
|
||||
allow_other_uses: true
|
||||
number: GPIO25
|
||||
max_speed: 250 steps/s
|
||||
acceleration: 100 steps/s^2
|
||||
deceleration: 200 steps/s^2
|
||||
|
@ -3397,14 +3664,26 @@ text_sensor:
|
|||
|
||||
sn74hc595:
|
||||
- id: sn74hc595_hub
|
||||
data_pin: GPIO21
|
||||
clock_pin: GPIO23
|
||||
latch_pin: GPIO22
|
||||
oe_pin: GPIO32
|
||||
data_pin:
|
||||
allow_other_uses: true
|
||||
number: GPIO21
|
||||
clock_pin:
|
||||
allow_other_uses: true
|
||||
number: GPIO23
|
||||
latch_pin:
|
||||
allow_other_uses: true
|
||||
number: GPIO22
|
||||
oe_pin:
|
||||
allow_other_uses: true
|
||||
number: GPIO32
|
||||
sr_count: 2
|
||||
- id: sn74hc595_hub_2
|
||||
latch_pin: GPIO22
|
||||
oe_pin: GPIO32
|
||||
latch_pin:
|
||||
allow_other_uses: true
|
||||
number: GPIO22
|
||||
oe_pin:
|
||||
allow_other_uses: true
|
||||
number: GPIO32
|
||||
sr_count: 2
|
||||
spi_id: spi_bus
|
||||
|
||||
|
@ -3456,8 +3735,12 @@ canbus:
|
|||
}
|
||||
- platform: esp32_can
|
||||
id: esp32_internal_can
|
||||
rx_pin: GPIO04
|
||||
tx_pin: GPIO05
|
||||
rx_pin:
|
||||
allow_other_uses: true
|
||||
number: GPIO04
|
||||
tx_pin:
|
||||
allow_other_uses: true
|
||||
number: GPIO05
|
||||
can_id: 4
|
||||
bit_rate: 50kbps
|
||||
on_frame:
|
||||
|
|
|
@ -44,25 +44,42 @@ uart:
|
|||
rx_pin: 3
|
||||
baud_rate: 9600
|
||||
- id: uart_2
|
||||
tx_pin: 17
|
||||
rx_pin: 16
|
||||
tx_pin:
|
||||
allow_other_uses: true
|
||||
number: 17
|
||||
rx_pin:
|
||||
allow_other_uses: true
|
||||
number: 16
|
||||
baud_rate: 19200
|
||||
|
||||
i2c:
|
||||
sda:
|
||||
number: 21
|
||||
allow_other_uses: true
|
||||
frequency: 100khz
|
||||
|
||||
spi:
|
||||
- id: spi_1
|
||||
clk_pin: 12
|
||||
mosi_pin: 13
|
||||
miso_pin: 14
|
||||
clk_pin:
|
||||
allow_other_uses: true
|
||||
number: 12
|
||||
mosi_pin:
|
||||
allow_other_uses: true
|
||||
number: 13
|
||||
miso_pin:
|
||||
allow_other_uses: true
|
||||
number: 14
|
||||
- id: spi_2
|
||||
clk_pin: 32
|
||||
clk_pin:
|
||||
allow_other_uses: true
|
||||
number: 32
|
||||
mosi_pin: 33
|
||||
|
||||
modbus:
|
||||
uart_id: uart_1
|
||||
flow_control_pin: 5
|
||||
flow_control_pin:
|
||||
allow_other_uses: true
|
||||
number: 5
|
||||
id: mod_bus1
|
||||
|
||||
modbus_controller:
|
||||
|
@ -229,9 +246,15 @@ binary_sensor:
|
|||
lambda: return x[0] & 1;
|
||||
|
||||
tlc5947:
|
||||
data_pin: GPIO12
|
||||
clock_pin: GPIO14
|
||||
lat_pin: GPIO15
|
||||
data_pin:
|
||||
allow_other_uses: true
|
||||
number: GPIO12
|
||||
clock_pin:
|
||||
allow_other_uses: true
|
||||
number: GPIO14
|
||||
lat_pin:
|
||||
allow_other_uses: true
|
||||
number: GPIO15
|
||||
|
||||
gp8403:
|
||||
- id: gp8403_5v
|
||||
|
@ -417,7 +440,9 @@ sensor:
|
|||
- platform: adc
|
||||
id: adc_sensor_p32
|
||||
name: ADC pin 32
|
||||
pin: 32
|
||||
pin:
|
||||
allow_other_uses: true
|
||||
number: 32
|
||||
attenuation: 11db
|
||||
update_interval: 1s
|
||||
- platform: internal_temperature
|
||||
|
@ -584,7 +609,9 @@ sensor:
|
|||
name: Kuntze temperature
|
||||
|
||||
- platform: ade7953_i2c
|
||||
irq_pin: 16
|
||||
irq_pin:
|
||||
allow_other_uses: true
|
||||
number: 16
|
||||
voltage:
|
||||
name: ADE7953 Voltage
|
||||
current_a:
|
||||
|
@ -612,7 +639,9 @@ sensor:
|
|||
- platform: ade7953_spi
|
||||
spi_id: spi_1
|
||||
cs_pin: 04
|
||||
irq_pin: 16
|
||||
irq_pin:
|
||||
allow_other_uses: true
|
||||
number: 16
|
||||
voltage:
|
||||
name: ADE7953 Voltage
|
||||
current_a:
|
||||
|
@ -683,7 +712,9 @@ switch:
|
|||
display:
|
||||
- platform: tm1638
|
||||
id: primarydisplay
|
||||
stb_pin: 5 #TM1638 STB
|
||||
stb_pin:
|
||||
allow_other_uses: true
|
||||
number: 5 #TM1638 STB
|
||||
clk_pin: 18 #TM1638 CLK
|
||||
dio_pin: 23 #TM1638 DIO
|
||||
update_interval: 5s
|
||||
|
@ -728,20 +759,32 @@ text_sensor:
|
|||
|
||||
sn74hc165:
|
||||
id: sn74hc165_hub
|
||||
data_pin: GPIO12
|
||||
clock_pin: GPIO14
|
||||
load_pin: GPIO27
|
||||
clock_inhibit_pin: GPIO26
|
||||
data_pin:
|
||||
allow_other_uses: true
|
||||
number: GPIO12
|
||||
clock_pin:
|
||||
allow_other_uses: true
|
||||
number: GPIO14
|
||||
load_pin:
|
||||
number: GPIO27
|
||||
clock_inhibit_pin:
|
||||
number: GPIO26
|
||||
sr_count: 4
|
||||
|
||||
matrix_keypad:
|
||||
id: keypad
|
||||
rows:
|
||||
- pin: 21
|
||||
- pin:
|
||||
allow_other_uses: true
|
||||
number: 21
|
||||
- pin: 19
|
||||
columns:
|
||||
- pin: 17
|
||||
- pin: 16
|
||||
- pin:
|
||||
allow_other_uses: true
|
||||
number: 17
|
||||
- pin:
|
||||
allow_other_uses: true
|
||||
number: 16
|
||||
keys: "1234"
|
||||
|
||||
key_collector:
|
||||
|
@ -753,14 +796,18 @@ key_collector:
|
|||
light:
|
||||
- platform: esp32_rmt_led_strip
|
||||
id: led_strip
|
||||
pin: 13
|
||||
pin:
|
||||
allow_other_uses: true
|
||||
number: 13
|
||||
num_leds: 60
|
||||
rmt_channel: 6
|
||||
rgb_order: GRB
|
||||
chipset: ws2812
|
||||
- platform: esp32_rmt_led_strip
|
||||
id: led_strip2
|
||||
pin: 15
|
||||
pin:
|
||||
allow_other_uses: true
|
||||
number: 15
|
||||
num_leds: 60
|
||||
rmt_channel: 2
|
||||
rgb_order: RGB
|
||||
|
|
|
@ -17,11 +17,17 @@ substitutions:
|
|||
|
||||
ethernet:
|
||||
type: LAN8720
|
||||
mdc_pin: GPIO23
|
||||
mdio_pin: GPIO25
|
||||
mdc_pin:
|
||||
allow_other_uses: true
|
||||
number: GPIO23
|
||||
mdio_pin:
|
||||
allow_other_uses: true
|
||||
number: GPIO25
|
||||
clk_mode: GPIO0_IN
|
||||
phy_addr: 0
|
||||
power_pin: GPIO25
|
||||
power_pin:
|
||||
allow_other_uses: true
|
||||
number: GPIO25
|
||||
manual_ip:
|
||||
static_ip: 192.168.178.56
|
||||
gateway: 192.168.178.1
|
||||
|
@ -37,18 +43,32 @@ mdns:
|
|||
api:
|
||||
|
||||
i2c:
|
||||
sda: 21
|
||||
scl: 22
|
||||
sda:
|
||||
allow_other_uses: true
|
||||
number: 21
|
||||
scl:
|
||||
allow_other_uses: true
|
||||
number: 22
|
||||
scan: false
|
||||
|
||||
spi:
|
||||
clk_pin: GPIO21
|
||||
mosi_pin: GPIO22
|
||||
miso_pin: GPIO23
|
||||
clk_pin:
|
||||
allow_other_uses: true
|
||||
number: GPIO21
|
||||
mosi_pin:
|
||||
allow_other_uses: true
|
||||
number: GPIO22
|
||||
miso_pin:
|
||||
allow_other_uses: true
|
||||
number: GPIO23
|
||||
|
||||
uart:
|
||||
tx_pin: GPIO22
|
||||
rx_pin: GPIO23
|
||||
tx_pin:
|
||||
allow_other_uses: true
|
||||
number: GPIO22
|
||||
rx_pin:
|
||||
allow_other_uses: true
|
||||
number: GPIO23
|
||||
baud_rate: 115200
|
||||
# Specifically added for testing debug with no after: definition.
|
||||
debug:
|
||||
|
@ -73,21 +93,29 @@ deep_sleep:
|
|||
gpio_wakeup_reason: 10s
|
||||
touch_wakeup_reason: 15s
|
||||
sleep_duration: 50s
|
||||
wakeup_pin: GPIO2
|
||||
wakeup_pin:
|
||||
allow_other_uses: true
|
||||
number: GPIO2
|
||||
wakeup_pin_mode: INVERT_WAKEUP
|
||||
|
||||
as3935_i2c:
|
||||
irq_pin: GPIO12
|
||||
irq_pin:
|
||||
allow_other_uses: true
|
||||
number: GPIO12
|
||||
|
||||
mcp3008:
|
||||
- id: mcp3008_hub
|
||||
cs_pin: GPIO12
|
||||
cs_pin:
|
||||
allow_other_uses: true
|
||||
number: GPIO12
|
||||
|
||||
output:
|
||||
- platform: ac_dimmer
|
||||
id: dimmer1
|
||||
gate_pin: GPIO5
|
||||
zero_cross_pin: GPIO12
|
||||
zero_cross_pin:
|
||||
allow_other_uses: true
|
||||
number: GPIO12
|
||||
|
||||
sensor:
|
||||
- platform: homeassistant
|
||||
|
@ -534,7 +562,9 @@ binary_sensor:
|
|||
name: Mi Motion Sensor 2 Button
|
||||
- platform: gpio
|
||||
id: gpio_set_retry_test
|
||||
pin: GPIO9
|
||||
pin:
|
||||
allow_other_uses: true
|
||||
number: GPIO9
|
||||
on_press:
|
||||
then:
|
||||
- lambda: |-
|
||||
|
@ -601,7 +631,9 @@ xiaomi_rtcgq02lm:
|
|||
bindkey: "48403ebe2d385db8d0c187f81e62cb64"
|
||||
|
||||
status_led:
|
||||
pin: GPIO2
|
||||
pin:
|
||||
allow_other_uses: true
|
||||
number: GPIO2
|
||||
|
||||
text_sensor:
|
||||
- platform: version
|
||||
|
@ -704,9 +736,13 @@ script:
|
|||
stepper:
|
||||
- platform: uln2003
|
||||
id: my_stepper
|
||||
pin_a: GPIO23
|
||||
pin_a:
|
||||
allow_other_uses: true
|
||||
number: GPIO23
|
||||
pin_b: GPIO27
|
||||
pin_c: GPIO25
|
||||
pin_c:
|
||||
allow_other_uses: true
|
||||
number: GPIO25
|
||||
pin_d: GPIO26
|
||||
sleep_when_done: false
|
||||
step_mode: HALF_STEP
|
||||
|
@ -731,7 +767,9 @@ display:
|
|||
offset_height: 35
|
||||
offset_width: 0
|
||||
dc_pin: GPIO13
|
||||
reset_pin: GPIO9
|
||||
reset_pin:
|
||||
allow_other_uses: true
|
||||
number: GPIO9
|
||||
|
||||
image:
|
||||
- id: binary_image
|
||||
|
|
|
@ -29,14 +29,24 @@ web_server:
|
|||
version: 2
|
||||
|
||||
i2c:
|
||||
sda: 4
|
||||
scl: 5
|
||||
sda:
|
||||
allow_other_uses: true
|
||||
number: 4
|
||||
scl:
|
||||
allow_other_uses: true
|
||||
number: 5
|
||||
scan: false
|
||||
|
||||
spi:
|
||||
clk_pin: GPIO12
|
||||
mosi_pin: GPIO13
|
||||
miso_pin: GPIO14
|
||||
clk_pin:
|
||||
allow_other_uses: true
|
||||
number: GPIO12
|
||||
mosi_pin:
|
||||
allow_other_uses: true
|
||||
number: GPIO13
|
||||
miso_pin:
|
||||
allow_other_uses: true
|
||||
number: GPIO14
|
||||
|
||||
ota:
|
||||
|
||||
|
@ -52,7 +62,9 @@ sensor:
|
|||
name: VL53L0x Distance
|
||||
address: 0x29
|
||||
update_interval: 60s
|
||||
enable_pin: GPIO13
|
||||
enable_pin:
|
||||
allow_other_uses: true
|
||||
number: GPIO13
|
||||
timeout: 200us
|
||||
- platform: apds9960
|
||||
type: clear
|
||||
|
@ -170,7 +182,9 @@ sensor:
|
|||
name: Custom Sensor
|
||||
|
||||
- platform: ade7953_i2c
|
||||
irq_pin: GPIO16
|
||||
irq_pin:
|
||||
allow_other_uses: true
|
||||
number: GPIO16
|
||||
voltage:
|
||||
name: ADE7953 Voltage
|
||||
id: ade7953_voltage
|
||||
|
@ -199,8 +213,12 @@ sensor:
|
|||
update_interval: 1s
|
||||
|
||||
- platform: ade7953_spi
|
||||
cs_pin: GPIO04
|
||||
irq_pin: GPIO16
|
||||
cs_pin:
|
||||
allow_other_uses: true
|
||||
number: GPIO04
|
||||
irq_pin:
|
||||
allow_other_uses: true
|
||||
number: GPIO16
|
||||
voltage:
|
||||
name: ADE7953 Voltage
|
||||
current_a:
|
||||
|
@ -360,8 +378,12 @@ text_sensor:
|
|||
name: Custom Text Sensor
|
||||
|
||||
sm2135:
|
||||
data_pin: GPIO12
|
||||
clock_pin: GPIO14
|
||||
data_pin:
|
||||
allow_other_uses: true
|
||||
number: GPIO12
|
||||
clock_pin:
|
||||
allow_other_uses: true
|
||||
number: GPIO14
|
||||
rgb_current: 20mA
|
||||
cw_current: 60mA
|
||||
|
||||
|
@ -379,6 +401,7 @@ switch:
|
|||
pin:
|
||||
mcp23xxx: mcp23017_hub
|
||||
number: 0
|
||||
allow_other_uses: true
|
||||
mode: OUTPUT
|
||||
interlock: &interlock [gpio_switch1, gpio_switch2, gpio_switch3]
|
||||
- platform: gpio
|
||||
|
@ -386,11 +409,14 @@ switch:
|
|||
pin:
|
||||
mcp23xxx: mcp23008_hub
|
||||
number: 0
|
||||
allow_other_uses: true
|
||||
mode: OUTPUT
|
||||
interlock: *interlock
|
||||
- platform: gpio
|
||||
id: gpio_switch3
|
||||
pin: GPIO1
|
||||
pin:
|
||||
allow_other_uses: true
|
||||
number: GPIO1
|
||||
interlock: *interlock
|
||||
- platform: custom
|
||||
lambda: |-
|
||||
|
@ -440,10 +466,18 @@ custom_component:
|
|||
stepper:
|
||||
- platform: uln2003
|
||||
id: my_stepper
|
||||
pin_a: GPIO12
|
||||
pin_b: GPIO13
|
||||
pin_c: GPIO14
|
||||
pin_d: GPIO15
|
||||
pin_a:
|
||||
allow_other_uses: true
|
||||
number: GPIO12
|
||||
pin_b:
|
||||
allow_other_uses: true
|
||||
number: GPIO13
|
||||
pin_c:
|
||||
allow_other_uses: true
|
||||
number: GPIO14
|
||||
pin_d:
|
||||
allow_other_uses: true
|
||||
number: GPIO15
|
||||
sleep_when_done: false
|
||||
step_mode: HALF_STEP
|
||||
max_speed: 250 steps/s
|
||||
|
@ -451,8 +485,12 @@ stepper:
|
|||
deceleration: inf
|
||||
- platform: a4988
|
||||
id: my_stepper2
|
||||
step_pin: GPIO1
|
||||
dir_pin: GPIO2
|
||||
step_pin:
|
||||
allow_other_uses: true
|
||||
number: GPIO1
|
||||
dir_pin:
|
||||
allow_other_uses: true
|
||||
number: GPIO2
|
||||
max_speed: 0.1 steps/s
|
||||
acceleration: 10 steps/s^2
|
||||
deceleration: 10 steps/s^2
|
||||
|
@ -556,11 +594,14 @@ cover:
|
|||
output:
|
||||
- platform: esp8266_pwm
|
||||
id: out
|
||||
pin: D3
|
||||
pin:
|
||||
number: D3
|
||||
frequency: 50Hz
|
||||
- platform: esp8266_pwm
|
||||
id: out2
|
||||
pin: D4
|
||||
pin:
|
||||
allow_other_uses: true
|
||||
number: D4
|
||||
- platform: custom
|
||||
type: binary
|
||||
lambda: |-
|
||||
|
@ -572,7 +613,9 @@ output:
|
|||
- platform: sigma_delta_output
|
||||
id: sddac
|
||||
update_interval: 60s
|
||||
pin: D4
|
||||
pin:
|
||||
allow_other_uses: true
|
||||
number: D4
|
||||
turn_on_action:
|
||||
then:
|
||||
- logger.log: "Turned on"
|
||||
|
@ -593,7 +636,9 @@ output:
|
|||
outputs:
|
||||
- id: custom_float
|
||||
- platform: slow_pwm
|
||||
pin: GPIO5
|
||||
pin:
|
||||
allow_other_uses: true
|
||||
number: GPIO5
|
||||
id: my_slow_pwm
|
||||
period: 15s
|
||||
restart_cycle_on_state_change: false
|
||||
|
@ -635,12 +680,18 @@ servo:
|
|||
ttp229_lsf:
|
||||
|
||||
ttp229_bsf:
|
||||
sdo_pin: D2
|
||||
scl_pin: D1
|
||||
sdo_pin:
|
||||
allow_other_uses: true
|
||||
number: D2
|
||||
scl_pin:
|
||||
allow_other_uses: true
|
||||
number: D1
|
||||
|
||||
display:
|
||||
- platform: max7219digit
|
||||
cs_pin: GPIO15
|
||||
cs_pin:
|
||||
allow_other_uses: true
|
||||
number: GPIO15
|
||||
num_chips: 4
|
||||
rotate_chip: 0
|
||||
intensity: 10
|
||||
|
@ -666,10 +717,20 @@ button:
|
|||
name: Restart Button (Factory Default Settings)
|
||||
|
||||
cd74hc4067:
|
||||
pin_s0: GPIO12
|
||||
pin_s1: GPIO13
|
||||
pin_s2: GPIO14
|
||||
pin_s3: GPIO15
|
||||
pin_s0:
|
||||
allow_other_uses: true
|
||||
number: GPIO12
|
||||
pin_s1:
|
||||
allow_other_uses: true
|
||||
number: GPIO13
|
||||
pin_s2:
|
||||
allow_other_uses: true
|
||||
number: GPIO14
|
||||
pin_s3:
|
||||
allow_other_uses: true
|
||||
number: GPIO15
|
||||
|
||||
adc128s102:
|
||||
cs_pin: GPIO12
|
||||
cs_pin:
|
||||
allow_other_uses: true
|
||||
number: GPIO12
|
||||
|
|
169
tests/test3.yaml
169
tests/test3.yaml
|
@ -223,55 +223,102 @@ uart:
|
|||
tx_pin:
|
||||
number: GPIO1
|
||||
inverted: true
|
||||
rx_pin: GPIO3
|
||||
allow_other_uses: true
|
||||
rx_pin:
|
||||
allow_other_uses: true
|
||||
number: GPIO3
|
||||
baud_rate: 115200
|
||||
- id: uart_2
|
||||
tx_pin: GPIO4
|
||||
rx_pin: GPIO5
|
||||
tx_pin:
|
||||
allow_other_uses: true
|
||||
number: GPIO4
|
||||
rx_pin:
|
||||
allow_other_uses: true
|
||||
number: GPIO5
|
||||
baud_rate: 9600
|
||||
- id: uart_3
|
||||
tx_pin: GPIO4
|
||||
rx_pin: GPIO5
|
||||
tx_pin:
|
||||
allow_other_uses: true
|
||||
number: GPIO4
|
||||
rx_pin:
|
||||
allow_other_uses: true
|
||||
number: GPIO5
|
||||
baud_rate: 4800
|
||||
- id: uart_4
|
||||
tx_pin: GPIO4
|
||||
rx_pin: GPIO5
|
||||
tx_pin:
|
||||
allow_other_uses: true
|
||||
number: GPIO4
|
||||
rx_pin:
|
||||
allow_other_uses: true
|
||||
number: GPIO5
|
||||
baud_rate: 9600
|
||||
- id: uart_5
|
||||
tx_pin: GPIO4
|
||||
rx_pin: GPIO5
|
||||
tx_pin:
|
||||
allow_other_uses: true
|
||||
number: GPIO4
|
||||
rx_pin:
|
||||
allow_other_uses: true
|
||||
number: GPIO5
|
||||
baud_rate: 9600
|
||||
- id: uart_6
|
||||
tx_pin: GPIO4
|
||||
rx_pin: GPIO5
|
||||
tx_pin:
|
||||
allow_other_uses: true
|
||||
number: GPIO4
|
||||
rx_pin:
|
||||
allow_other_uses: true
|
||||
number: GPIO5
|
||||
baud_rate: 9600
|
||||
- id: uart_7
|
||||
tx_pin: GPIO4
|
||||
rx_pin: GPIO5
|
||||
tx_pin:
|
||||
allow_other_uses: true
|
||||
number: GPIO4
|
||||
rx_pin:
|
||||
allow_other_uses: true
|
||||
number: GPIO5
|
||||
baud_rate: 38400
|
||||
- id: uart_8
|
||||
tx_pin: GPIO4
|
||||
rx_pin: GPIO5
|
||||
tx_pin:
|
||||
allow_other_uses: true
|
||||
number: GPIO4
|
||||
rx_pin:
|
||||
allow_other_uses: true
|
||||
number: GPIO5
|
||||
baud_rate: 4800
|
||||
parity: NONE
|
||||
stop_bits: 2
|
||||
# Specifically added for testing debug with no options at all.
|
||||
debug:
|
||||
- id: uart_9
|
||||
tx_pin: GPIO4
|
||||
rx_pin: GPIO5
|
||||
tx_pin:
|
||||
allow_other_uses: true
|
||||
number: GPIO4
|
||||
rx_pin:
|
||||
allow_other_uses: true
|
||||
number: GPIO5
|
||||
baud_rate: 9600
|
||||
- id: uart_10
|
||||
tx_pin: GPIO4
|
||||
rx_pin: GPIO5
|
||||
tx_pin:
|
||||
allow_other_uses: true
|
||||
number: GPIO4
|
||||
rx_pin:
|
||||
allow_other_uses: true
|
||||
number: GPIO5
|
||||
baud_rate: 9600
|
||||
- id: uart_11
|
||||
tx_pin: GPIO4
|
||||
rx_pin: GPIO5
|
||||
tx_pin:
|
||||
allow_other_uses: true
|
||||
number: GPIO4
|
||||
rx_pin:
|
||||
allow_other_uses: true
|
||||
number: GPIO5
|
||||
baud_rate: 9600
|
||||
- id: uart_12
|
||||
tx_pin: GPIO4
|
||||
rx_pin: GPIO5
|
||||
tx_pin:
|
||||
allow_other_uses: true
|
||||
number: GPIO4
|
||||
rx_pin:
|
||||
allow_other_uses: true
|
||||
number: GPIO5
|
||||
baud_rate: 9600
|
||||
|
||||
modbus:
|
||||
|
@ -748,13 +795,19 @@ binary_sensor:
|
|||
|
||||
- platform: gpio
|
||||
id: bin1
|
||||
pin: 1
|
||||
pin:
|
||||
allow_other_uses: true
|
||||
number: 1
|
||||
- platform: gpio
|
||||
id: bin2
|
||||
pin: 2
|
||||
pin:
|
||||
allow_other_uses: true
|
||||
number: 2
|
||||
- platform: gpio
|
||||
id: bin3
|
||||
pin: 3
|
||||
pin:
|
||||
allow_other_uses: true
|
||||
number: 3
|
||||
|
||||
globals:
|
||||
- id: my_global_string
|
||||
|
@ -762,11 +815,15 @@ globals:
|
|||
initial_value: '""'
|
||||
|
||||
remote_receiver:
|
||||
pin: GPIO12
|
||||
pin:
|
||||
allow_other_uses: true
|
||||
number: GPIO12
|
||||
dump: []
|
||||
|
||||
status_led:
|
||||
pin: GPIO2
|
||||
pin:
|
||||
allow_other_uses: true
|
||||
number: GPIO2
|
||||
|
||||
text_sensor:
|
||||
- platform: daly_bms
|
||||
|
@ -819,13 +876,19 @@ script:
|
|||
switch:
|
||||
- platform: gpio
|
||||
id: gpio_switch1
|
||||
pin: 1
|
||||
pin:
|
||||
allow_other_uses: true
|
||||
number: 1
|
||||
- platform: gpio
|
||||
id: gpio_switch2
|
||||
pin: 2
|
||||
pin:
|
||||
allow_other_uses: true
|
||||
number: 2
|
||||
- platform: gpio
|
||||
id: gpio_switch3
|
||||
pin: 3
|
||||
pin:
|
||||
allow_other_uses: true
|
||||
number: 3
|
||||
|
||||
- platform: nextion
|
||||
id: r0
|
||||
|
@ -1023,13 +1086,18 @@ sprinkler:
|
|||
output:
|
||||
- platform: esp8266_pwm
|
||||
id: out
|
||||
pin: D3
|
||||
pin:
|
||||
number: D3
|
||||
frequency: 50Hz
|
||||
- platform: esp8266_pwm
|
||||
id: out2
|
||||
pin: D4
|
||||
pin:
|
||||
allow_other_uses: true
|
||||
number: D4
|
||||
- platform: slow_pwm
|
||||
pin: GPIO5
|
||||
pin:
|
||||
allow_other_uses: true
|
||||
number: GPIO5
|
||||
id: my_slow_pwm
|
||||
period: 15s
|
||||
restart_cycle_on_state_change: false
|
||||
|
@ -1039,7 +1107,9 @@ e131:
|
|||
light:
|
||||
- platform: neopixelbus
|
||||
name: Neopixelbus Light
|
||||
pin: GPIO1
|
||||
pin:
|
||||
allow_other_uses: true
|
||||
number: GPIO1
|
||||
type: GRBW
|
||||
variant: SK6812
|
||||
method: ESP8266_UART0
|
||||
|
@ -1071,6 +1141,12 @@ light:
|
|||
max_brightness: 500
|
||||
firmware: "51.6"
|
||||
uart_id: uart_11
|
||||
nrst_pin:
|
||||
number: 5
|
||||
allow_other_uses: true
|
||||
boot0_pin:
|
||||
number: 4
|
||||
allow_other_uses: true
|
||||
|
||||
sim800l:
|
||||
uart_id: uart_4
|
||||
|
@ -1096,8 +1172,12 @@ dfplayer:
|
|||
logger.log: Playback finished event
|
||||
tm1651:
|
||||
id: tm1651_battery
|
||||
clk_pin: D6
|
||||
dio_pin: D5
|
||||
clk_pin:
|
||||
allow_other_uses: true
|
||||
number: D6
|
||||
dio_pin:
|
||||
allow_other_uses: true
|
||||
number: D5
|
||||
|
||||
rf_bridge:
|
||||
uart_id: uart_5
|
||||
|
@ -1150,7 +1230,9 @@ display:
|
|||
lambda: 'ESP_LOGD("display","Display shows new page %u", x);'
|
||||
|
||||
fingerprint_grow:
|
||||
sensing_pin: 4
|
||||
sensing_pin:
|
||||
allow_other_uses: true
|
||||
number: 4
|
||||
password: 0x12FE37DC
|
||||
new_password: 0xA65B9840
|
||||
on_finger_scan_matched:
|
||||
|
@ -1184,7 +1266,9 @@ dsmr:
|
|||
decryption_key: 00112233445566778899aabbccddeeff
|
||||
uart_id: uart_6
|
||||
max_telegram_length: 1000
|
||||
request_pin: D5
|
||||
request_pin:
|
||||
allow_other_uses: true
|
||||
number: D5
|
||||
request_interval: 20s
|
||||
receive_timeout: 100ms
|
||||
|
||||
|
@ -1197,8 +1281,11 @@ qr_code:
|
|||
value: https://esphome.io/index.html
|
||||
|
||||
lightwaverf:
|
||||
read_pin: 13
|
||||
write_pin: 14
|
||||
read_pin:
|
||||
number: 13
|
||||
write_pin:
|
||||
allow_other_uses: true
|
||||
number: 14
|
||||
|
||||
alarm_control_panel:
|
||||
- platform: template
|
||||
|
|
299
tests/test4.yaml
299
tests/test4.yaml
|
@ -10,11 +10,17 @@ substitutions:
|
|||
|
||||
ethernet:
|
||||
type: LAN8720
|
||||
mdc_pin: GPIO23
|
||||
mdio_pin: GPIO25
|
||||
mdc_pin:
|
||||
allow_other_uses: true
|
||||
number: GPIO23
|
||||
mdio_pin:
|
||||
allow_other_uses: true
|
||||
number: GPIO25
|
||||
clk_mode: GPIO0_IN
|
||||
phy_addr: 0
|
||||
power_pin: GPIO25
|
||||
power_pin:
|
||||
allow_other_uses: true
|
||||
number: GPIO25
|
||||
manual_ip:
|
||||
static_ip: 192.168.178.56
|
||||
gateway: 192.168.178.1
|
||||
|
@ -34,37 +40,60 @@ mqtt:
|
|||
api:
|
||||
|
||||
i2c:
|
||||
sda: 21
|
||||
scl: 22
|
||||
sda:
|
||||
allow_other_uses: true
|
||||
number: 21
|
||||
scl:
|
||||
allow_other_uses: true
|
||||
number: 22
|
||||
scan: false
|
||||
|
||||
spi:
|
||||
- id: spi_id_1
|
||||
clk_pin: GPIO21
|
||||
mosi_pin: GPIO22
|
||||
miso_pin: GPIO23
|
||||
clk_pin:
|
||||
allow_other_uses: true
|
||||
number: GPIO21
|
||||
mosi_pin:
|
||||
allow_other_uses: true
|
||||
number: GPIO22
|
||||
miso_pin:
|
||||
allow_other_uses: true
|
||||
number: GPIO23
|
||||
interface: hardware
|
||||
- id: spi_id_2
|
||||
clk_pin: GPIO32
|
||||
mosi_pin: GPIO33
|
||||
clk_pin:
|
||||
number: GPIO32
|
||||
mosi_pin:
|
||||
number: GPIO33
|
||||
interface: hardware
|
||||
|
||||
uart:
|
||||
- id: uart115200
|
||||
tx_pin: GPIO22
|
||||
rx_pin: GPIO23
|
||||
tx_pin:
|
||||
allow_other_uses: true
|
||||
number: GPIO22
|
||||
rx_pin:
|
||||
allow_other_uses: true
|
||||
number: GPIO23
|
||||
baud_rate: 115200
|
||||
- id: uart9600
|
||||
tx_pin: GPIO22
|
||||
rx_pin: GPIO23
|
||||
tx_pin:
|
||||
allow_other_uses: true
|
||||
number: GPIO25
|
||||
rx_pin:
|
||||
allow_other_uses: true
|
||||
number: GPIO26
|
||||
baud_rate: 9600
|
||||
- id: uart_he60r
|
||||
tx_pin: 22
|
||||
rx_pin: 23
|
||||
tx_pin:
|
||||
number: GPIO18
|
||||
allow_other_uses: true
|
||||
rx_pin:
|
||||
number: GPIO36
|
||||
allow_other_uses: true
|
||||
baud_rate: 1200
|
||||
parity: EVEN
|
||||
|
||||
|
||||
ota:
|
||||
safe_mode: true
|
||||
port: 3286
|
||||
|
@ -89,8 +118,9 @@ tuya:
|
|||
time_id: sntp_time
|
||||
uart_id: uart115200
|
||||
status_pin:
|
||||
number: 14
|
||||
number: GPIO5
|
||||
inverted: true
|
||||
allow_other_uses: true
|
||||
|
||||
select:
|
||||
- platform: tuya
|
||||
|
@ -117,7 +147,9 @@ sx1509:
|
|||
|
||||
mcp3204:
|
||||
spi_id: spi_id_1
|
||||
cs_pin: GPIO23
|
||||
cs_pin:
|
||||
allow_other_uses: true
|
||||
number: GPIO23
|
||||
|
||||
dac7678:
|
||||
address: 0x4A
|
||||
|
@ -510,7 +542,9 @@ light:
|
|||
id: led_matrix_32x8
|
||||
name: led_matrix_32x8
|
||||
chipset: WS2812B
|
||||
pin: GPIO15
|
||||
pin:
|
||||
allow_other_uses: true
|
||||
number: GPIO15
|
||||
num_leds: 256
|
||||
rgb_order: GRB
|
||||
default_transition_length: 0s
|
||||
|
@ -566,20 +600,36 @@ display:
|
|||
|
||||
- platform: waveshare_epaper
|
||||
spi_id: spi_id_1
|
||||
cs_pin: GPIO23
|
||||
dc_pin: GPIO23
|
||||
busy_pin: GPIO23
|
||||
reset_pin: GPIO23
|
||||
cs_pin:
|
||||
allow_other_uses: true
|
||||
number: GPIO23
|
||||
dc_pin:
|
||||
allow_other_uses: true
|
||||
number: GPIO23
|
||||
busy_pin:
|
||||
allow_other_uses: true
|
||||
number: GPIO23
|
||||
reset_pin:
|
||||
allow_other_uses: true
|
||||
number: GPIO23
|
||||
model: 2.13in-ttgo-b1
|
||||
full_update_every: 30
|
||||
lambda: |-
|
||||
it.rectangle(0, 0, it.get_width(), it.get_height());
|
||||
- platform: waveshare_epaper
|
||||
spi_id: spi_id_1
|
||||
cs_pin: GPIO23
|
||||
dc_pin: GPIO23
|
||||
busy_pin: GPIO23
|
||||
reset_pin: GPIO23
|
||||
cs_pin:
|
||||
allow_other_uses: true
|
||||
number: GPIO23
|
||||
dc_pin:
|
||||
allow_other_uses: true
|
||||
number: GPIO23
|
||||
busy_pin:
|
||||
allow_other_uses: true
|
||||
number: GPIO23
|
||||
reset_pin:
|
||||
allow_other_uses: true
|
||||
number: GPIO23
|
||||
model: 2.90in
|
||||
full_update_every: 30
|
||||
reset_duration: 200ms
|
||||
|
@ -587,20 +637,36 @@ display:
|
|||
it.rectangle(0, 0, it.get_width(), it.get_height());
|
||||
- platform: waveshare_epaper
|
||||
spi_id: spi_id_1
|
||||
cs_pin: GPIO23
|
||||
dc_pin: GPIO23
|
||||
busy_pin: GPIO23
|
||||
reset_pin: GPIO23
|
||||
cs_pin:
|
||||
allow_other_uses: true
|
||||
number: GPIO23
|
||||
dc_pin:
|
||||
allow_other_uses: true
|
||||
number: GPIO23
|
||||
busy_pin:
|
||||
allow_other_uses: true
|
||||
number: GPIO23
|
||||
reset_pin:
|
||||
allow_other_uses: true
|
||||
number: GPIO23
|
||||
model: 2.90inv2
|
||||
full_update_every: 30
|
||||
lambda: |-
|
||||
it.rectangle(0, 0, it.get_width(), it.get_height());
|
||||
- platform: waveshare_epaper
|
||||
spi_id: spi_id_1
|
||||
cs_pin: GPIO23
|
||||
dc_pin: GPIO23
|
||||
busy_pin: GPIO23
|
||||
reset_pin: GPIO23
|
||||
cs_pin:
|
||||
allow_other_uses: true
|
||||
number: GPIO23
|
||||
dc_pin:
|
||||
allow_other_uses: true
|
||||
number: GPIO23
|
||||
busy_pin:
|
||||
allow_other_uses: true
|
||||
number: GPIO23
|
||||
reset_pin:
|
||||
allow_other_uses: true
|
||||
number: GPIO23
|
||||
model: 1.54in-m5coreink-m09
|
||||
lambda: |-
|
||||
it.rectangle(0, 0, it.get_width(), it.get_height());
|
||||
|
@ -610,15 +676,54 @@ display:
|
|||
partial_updating: false
|
||||
update_interval: 60s
|
||||
|
||||
ckv_pin: GPIO1
|
||||
sph_pin: GPIO1
|
||||
gmod_pin: GPIO1
|
||||
gpio0_enable_pin: GPIO1
|
||||
oe_pin: GPIO1
|
||||
spv_pin: GPIO1
|
||||
powerup_pin: GPIO1
|
||||
wakeup_pin: GPIO1
|
||||
vcom_pin: GPIO1
|
||||
display_data_1_pin:
|
||||
number: 5
|
||||
allow_other_uses: true
|
||||
display_data_2_pin:
|
||||
number: 18
|
||||
allow_other_uses: true
|
||||
display_data_3_pin:
|
||||
number: 19
|
||||
allow_other_uses: true
|
||||
display_data_5_pin:
|
||||
number: 25
|
||||
allow_other_uses: true
|
||||
display_data_4_pin:
|
||||
number: 23
|
||||
allow_other_uses: true
|
||||
display_data_6_pin:
|
||||
number: 26
|
||||
allow_other_uses: true
|
||||
display_data_7_pin:
|
||||
number: 27
|
||||
allow_other_uses: true
|
||||
ckv_pin:
|
||||
allow_other_uses: true
|
||||
number: GPIO1
|
||||
sph_pin:
|
||||
allow_other_uses: true
|
||||
number: GPIO1
|
||||
gmod_pin:
|
||||
allow_other_uses: true
|
||||
number: GPIO1
|
||||
gpio0_enable_pin:
|
||||
allow_other_uses: true
|
||||
number: GPIO1
|
||||
oe_pin:
|
||||
allow_other_uses: true
|
||||
number: GPIO1
|
||||
spv_pin:
|
||||
allow_other_uses: true
|
||||
number: GPIO1
|
||||
powerup_pin:
|
||||
allow_other_uses: true
|
||||
number: GPIO1
|
||||
wakeup_pin:
|
||||
allow_other_uses: true
|
||||
number: GPIO1
|
||||
vcom_pin:
|
||||
allow_other_uses: true
|
||||
number: GPIO1
|
||||
|
||||
number:
|
||||
- platform: tuya
|
||||
|
@ -706,18 +811,54 @@ output:
|
|||
id: dac7678_1_ch7
|
||||
esp32_camera:
|
||||
name: ESP-32 Camera
|
||||
data_pins: [GPIO17, GPIO35, GPIO34, GPIO5, GPIO39, GPIO18, GPIO36, GPIO19]
|
||||
vsync_pin: GPIO22
|
||||
href_pin: GPIO26
|
||||
pixel_clock_pin: GPIO21
|
||||
data_pins:
|
||||
- number: GPIO17
|
||||
allow_other_uses: true
|
||||
- number: GPIO35
|
||||
allow_other_uses: true
|
||||
-
|
||||
number: GPIO34
|
||||
-
|
||||
number: GPIO5
|
||||
allow_other_uses: true
|
||||
-
|
||||
number: GPIO39
|
||||
-
|
||||
number: GPIO18
|
||||
allow_other_uses: true
|
||||
-
|
||||
number: GPIO36
|
||||
allow_other_uses: true
|
||||
-
|
||||
number: GPIO19
|
||||
allow_other_uses: true
|
||||
vsync_pin:
|
||||
allow_other_uses: true
|
||||
number: GPIO22
|
||||
href_pin:
|
||||
allow_other_uses: true
|
||||
number: GPIO26
|
||||
pixel_clock_pin:
|
||||
allow_other_uses: true
|
||||
number: GPIO21
|
||||
external_clock:
|
||||
pin: GPIO27
|
||||
pin:
|
||||
allow_other_uses: true
|
||||
number: GPIO27
|
||||
frequency: 20MHz
|
||||
i2c_pins:
|
||||
sda: GPIO25
|
||||
scl: GPIO23
|
||||
reset_pin: GPIO15
|
||||
power_down_pin: GPIO1
|
||||
sda:
|
||||
allow_other_uses: true
|
||||
number: GPIO25
|
||||
scl:
|
||||
allow_other_uses: true
|
||||
number: GPIO23
|
||||
reset_pin:
|
||||
allow_other_uses: true
|
||||
number: GPIO15
|
||||
power_down_pin:
|
||||
allow_other_uses: true
|
||||
number: GPIO1
|
||||
resolution: 640x480
|
||||
jpeg_quality: 10
|
||||
|
||||
|
@ -748,8 +889,12 @@ button:
|
|||
|
||||
touchscreen:
|
||||
- platform: ektf2232
|
||||
interrupt_pin: GPIO36
|
||||
rts_pin: GPIO5
|
||||
interrupt_pin:
|
||||
allow_other_uses: true
|
||||
number: GPIO36
|
||||
rts_pin:
|
||||
allow_other_uses: true
|
||||
number: GPIO5
|
||||
display: inkplate_display
|
||||
on_touch:
|
||||
- logger.log:
|
||||
|
@ -759,8 +904,11 @@ touchscreen:
|
|||
- platform: xpt2046
|
||||
id: xpt_touchscreen
|
||||
spi_id: spi_id_2
|
||||
cs_pin: 17
|
||||
interrupt_pin: 16
|
||||
cs_pin:
|
||||
allow_other_uses: true
|
||||
number: 17
|
||||
interrupt_pin:
|
||||
number: 16
|
||||
display: inkplate_display
|
||||
update_interval: 50ms
|
||||
report_interval: 1s
|
||||
|
@ -777,7 +925,9 @@ touchscreen:
|
|||
|
||||
- platform: lilygo_t5_47
|
||||
id: lilygo_touchscreen
|
||||
interrupt_pin: GPIO36
|
||||
interrupt_pin:
|
||||
allow_other_uses: true
|
||||
number: GPIO36
|
||||
display: inkplate_display
|
||||
on_touch:
|
||||
- logger.log:
|
||||
|
@ -789,16 +939,25 @@ touchscreen:
|
|||
|
||||
|
||||
i2s_audio:
|
||||
i2s_lrclk_pin: GPIO26
|
||||
i2s_bclk_pin: GPIO27
|
||||
i2s_mclk_pin: GPIO25
|
||||
i2s_lrclk_pin:
|
||||
allow_other_uses: true
|
||||
number: GPIO26
|
||||
i2s_bclk_pin:
|
||||
allow_other_uses: true
|
||||
number: GPIO27
|
||||
i2s_mclk_pin:
|
||||
allow_other_uses: true
|
||||
number: GPIO25
|
||||
|
||||
media_player:
|
||||
- platform: i2s_audio
|
||||
name: None
|
||||
dac_type: external
|
||||
i2s_dout_pin: GPIO25
|
||||
mute_pin: GPIO14
|
||||
i2s_dout_pin:
|
||||
allow_other_uses: true
|
||||
number: GPIO25
|
||||
mute_pin:
|
||||
number: GPIO14
|
||||
on_state:
|
||||
- media_player.play:
|
||||
- media_player.play_media: http://localhost/media.mp3
|
||||
|
@ -827,12 +986,16 @@ prometheus:
|
|||
microphone:
|
||||
- platform: i2s_audio
|
||||
id: mic_id_adc
|
||||
adc_pin: GPIO35
|
||||
adc_pin:
|
||||
allow_other_uses: true
|
||||
number: GPIO35
|
||||
adc_type: internal
|
||||
|
||||
- platform: i2s_audio
|
||||
id: mic_id_external
|
||||
i2s_din_pin: GPIO23
|
||||
i2s_din_pin:
|
||||
allow_other_uses: true
|
||||
number: GPIO23
|
||||
adc_type: external
|
||||
pdm: false
|
||||
|
||||
|
@ -840,7 +1003,9 @@ speaker:
|
|||
- platform: i2s_audio
|
||||
id: speaker_id
|
||||
dac_type: external
|
||||
i2s_dout_pin: GPIO25
|
||||
i2s_dout_pin:
|
||||
allow_other_uses: true
|
||||
number: GPIO25
|
||||
mode: mono
|
||||
|
||||
voice_assistant:
|
||||
|
|
|
@ -42,17 +42,27 @@ uart:
|
|||
baud_rate: 9600
|
||||
- id: uart_2
|
||||
tx_pin:
|
||||
allow_other_uses: true
|
||||
number: 17
|
||||
inverted: true
|
||||
rx_pin: 16
|
||||
rx_pin:
|
||||
allow_other_uses: true
|
||||
number: 16
|
||||
baud_rate: 19200
|
||||
|
||||
i2c:
|
||||
sda:
|
||||
allow_other_uses: true
|
||||
number: 21
|
||||
scl:
|
||||
number: 22
|
||||
frequency: 100khz
|
||||
|
||||
modbus:
|
||||
uart_id: uart_1
|
||||
flow_control_pin: 5
|
||||
flow_control_pin:
|
||||
allow_other_uses: true
|
||||
number: 5
|
||||
id: mod_bus1
|
||||
|
||||
modbus_controller:
|
||||
|
@ -214,9 +224,15 @@ binary_sensor:
|
|||
lambda: return x[0] & 1;
|
||||
|
||||
tlc5947:
|
||||
data_pin: GPIO12
|
||||
clock_pin: GPIO14
|
||||
lat_pin: GPIO15
|
||||
data_pin:
|
||||
number: GPIO12
|
||||
allow_other_uses: true
|
||||
clock_pin:
|
||||
allow_other_uses: true
|
||||
number: GPIO14
|
||||
lat_pin:
|
||||
allow_other_uses: true
|
||||
number: GPIO15
|
||||
|
||||
gp8403:
|
||||
- id: gp8403_5v
|
||||
|
@ -614,7 +630,9 @@ switch:
|
|||
display:
|
||||
- platform: tm1638
|
||||
id: primarydisplay
|
||||
stb_pin: 5 #TM1638 STB
|
||||
stb_pin:
|
||||
allow_other_uses: true
|
||||
number: 5 #TM1638 STB
|
||||
clk_pin: 18 #TM1638 CLK
|
||||
dio_pin: 23 #TM1638 DIO
|
||||
update_interval: 5s
|
||||
|
@ -659,8 +677,12 @@ text_sensor:
|
|||
|
||||
sn74hc165:
|
||||
id: sn74hc165_hub
|
||||
data_pin: GPIO12
|
||||
clock_pin: GPIO14
|
||||
data_pin:
|
||||
allow_other_uses: true
|
||||
number: GPIO12
|
||||
clock_pin:
|
||||
allow_other_uses: true
|
||||
number: GPIO14
|
||||
load_pin: GPIO27
|
||||
clock_inhibit_pin: GPIO26
|
||||
sr_count: 4
|
||||
|
@ -668,11 +690,17 @@ sn74hc165:
|
|||
matrix_keypad:
|
||||
id: keypad
|
||||
rows:
|
||||
- pin: 21
|
||||
- pin:
|
||||
allow_other_uses: true
|
||||
number: 21
|
||||
- pin: 19
|
||||
columns:
|
||||
- pin: 17
|
||||
- pin: 16
|
||||
- pin:
|
||||
allow_other_uses: true
|
||||
number: 17
|
||||
- pin:
|
||||
allow_other_uses: true
|
||||
number: 16
|
||||
keys: "1234"
|
||||
has_pulldowns: true
|
||||
|
||||
|
@ -692,7 +720,9 @@ light:
|
|||
chipset: ws2812
|
||||
- platform: esp32_rmt_led_strip
|
||||
id: led_strip2
|
||||
pin: 15
|
||||
pin:
|
||||
allow_other_uses: true
|
||||
number: 15
|
||||
num_leds: 60
|
||||
rmt_channel: 2
|
||||
rgb_order: RGB
|
||||
|
|
|
@ -57,7 +57,9 @@ display:
|
|||
model: ili9342
|
||||
cs_pin: GPIO5
|
||||
dc_pin: GPIO4
|
||||
reset_pin: GPIO48
|
||||
reset_pin:
|
||||
number: GPIO48
|
||||
allow_other_uses: true
|
||||
|
||||
i2c:
|
||||
scl: GPIO18
|
||||
|
@ -68,7 +70,10 @@ touchscreen:
|
|||
interrupt_pin:
|
||||
number: GPIO3
|
||||
ignore_strapping_warning: true
|
||||
reset_pin: GPIO48
|
||||
allow_other_uses: false
|
||||
reset_pin:
|
||||
number: GPIO48
|
||||
allow_other_uses: true
|
||||
|
||||
binary_sensor:
|
||||
- platform: tt21100
|
||||
|
|
Loading…
Reference in a new issue