mirror of
https://github.com/esphome/esphome.git
synced 2024-11-10 01:07:45 +01:00
Deep sleep is only available on esp32 and esp8266 (#5507)
This commit is contained in:
parent
c65d78f568
commit
be7e167c63
1 changed files with 34 additions and 27 deletions
|
@ -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):
|
||||
|
|
Loading…
Reference in a new issue