Deep sleep is only available on esp32 and esp8266 (#5507)

This commit is contained in:
Jesse Hills 2023-10-10 09:41:28 +13:00 committed by GitHub
parent c65d78f568
commit be7e167c63
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -14,6 +14,8 @@ from esphome.const import (
CONF_SLEEP_DURATION,
CONF_TIME_ID,
CONF_WAKEUP_PIN,
PLATFORM_ESP32,
PLATFORM_ESP8266,
)
from esphome.components.esp32 import get_esp32_variant
@ -165,7 +167,8 @@ WAKEUP_CAUSES_SCHEMA = cv.Schema(
}
)
CONFIG_SCHEMA = cv.Schema(
CONFIG_SCHEMA = cv.All(
cv.Schema(
{
cv.GenerateID(): cv.declare_id(DeepSleepComponent),
cv.Optional(CONF_RUN_DURATION): cv.Any(
@ -174,7 +177,9 @@ CONFIG_SCHEMA = cv.Schema(
),
cv.Optional(CONF_SLEEP_DURATION): cv.positive_time_period_milliseconds,
cv.Optional(CONF_WAKEUP_PIN): cv.All(
cv.only_on_esp32, pins.internal_gpio_input_pin_schema, validate_pin_number
cv.only_on_esp32,
pins.internal_gpio_input_pin_schema,
validate_pin_number,
),
cv.Optional(CONF_WAKEUP_PIN_MODE): cv.All(
cv.only_on_esp32, cv.enum(WAKEUP_PIN_MODES), upper=True
@ -192,7 +197,9 @@ CONFIG_SCHEMA = cv.Schema(
),
cv.Optional(CONF_TOUCH_WAKEUP): cv.All(cv.only_on_esp32, cv.boolean),
}
).extend(cv.COMPONENT_SCHEMA)
).extend(cv.COMPONENT_SCHEMA),
cv.only_on([PLATFORM_ESP32, PLATFORM_ESP8266]),
)
async def to_code(config):