mirror of
https://github.com/esphome/esphome.git
synced 2024-11-22 06:58:11 +01:00
Require reset_pin for certain waveshare_epaper models in YAML validation (#6357)
This commit is contained in:
parent
b0a192d6a5
commit
f5b02056b9
2 changed files with 29 additions and 0 deletions
|
@ -131,6 +131,8 @@ MODELS = {
|
||||||
"1.54in-m5coreink-m09": ("c", GDEW0154M09),
|
"1.54in-m5coreink-m09": ("c", GDEW0154M09),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
RESET_PIN_REQUIRED_MODELS = ("2.13inv2", "2.13in-ttgo-b74")
|
||||||
|
|
||||||
|
|
||||||
def validate_full_update_every_only_types_ac(value):
|
def validate_full_update_every_only_types_ac(value):
|
||||||
if CONF_FULL_UPDATE_EVERY not in value:
|
if CONF_FULL_UPDATE_EVERY not in value:
|
||||||
|
@ -147,6 +149,14 @@ def validate_full_update_every_only_types_ac(value):
|
||||||
return value
|
return value
|
||||||
|
|
||||||
|
|
||||||
|
def validate_reset_pin_required(config):
|
||||||
|
if config[CONF_MODEL] in RESET_PIN_REQUIRED_MODELS and CONF_RESET_PIN not in config:
|
||||||
|
raise cv.Invalid(
|
||||||
|
f"'{CONF_RESET_PIN}' is required for model {config[CONF_MODEL]}"
|
||||||
|
)
|
||||||
|
return config
|
||||||
|
|
||||||
|
|
||||||
CONFIG_SCHEMA = cv.All(
|
CONFIG_SCHEMA = cv.All(
|
||||||
display.FULL_DISPLAY_SCHEMA.extend(
|
display.FULL_DISPLAY_SCHEMA.extend(
|
||||||
{
|
{
|
||||||
|
@ -165,6 +175,7 @@ CONFIG_SCHEMA = cv.All(
|
||||||
.extend(cv.polling_component_schema("1s"))
|
.extend(cv.polling_component_schema("1s"))
|
||||||
.extend(spi.spi_device_schema()),
|
.extend(spi.spi_device_schema()),
|
||||||
validate_full_update_every_only_types_ac,
|
validate_full_update_every_only_types_ac,
|
||||||
|
validate_reset_pin_required,
|
||||||
cv.has_at_most_one_key(CONF_PAGES, CONF_LAMBDA),
|
cv.has_at_most_one_key(CONF_PAGES, CONF_LAMBDA),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -28,6 +28,24 @@ display:
|
||||||
full_update_every: 30
|
full_update_every: 30
|
||||||
lambda: |-
|
lambda: |-
|
||||||
it.rectangle(0, 0, it.get_width(), it.get_height());
|
it.rectangle(0, 0, it.get_width(), it.get_height());
|
||||||
|
- platform: waveshare_epaper
|
||||||
|
model: 2.13in-ttgo-b74
|
||||||
|
spi_id: spi_id_1
|
||||||
|
cs_pin:
|
||||||
|
allow_other_uses: true
|
||||||
|
number: GPIO25
|
||||||
|
dc_pin:
|
||||||
|
allow_other_uses: true
|
||||||
|
number: GPIO26
|
||||||
|
busy_pin:
|
||||||
|
allow_other_uses: true
|
||||||
|
number: GPIO27
|
||||||
|
reset_pin:
|
||||||
|
allow_other_uses: true
|
||||||
|
number: GPIO32
|
||||||
|
full_update_every: 30
|
||||||
|
lambda: |-
|
||||||
|
it.rectangle(0, 0, it.get_width(), it.get_height());
|
||||||
- platform: waveshare_epaper
|
- platform: waveshare_epaper
|
||||||
model: 2.90in
|
model: 2.90in
|
||||||
spi_id: spi_id_1
|
spi_id: spi_id_1
|
||||||
|
|
Loading…
Reference in a new issue