Allow duration for deep_sleep.enter to be templateable (#1765)

This commit is contained in:
Jesse Hills 2021-05-12 03:36:14 +12:00 committed by GitHub
parent 66b0b6feeb
commit 5c3af1d3f6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 1 deletions

View file

@ -108,7 +108,9 @@ def to_code(config):
DEEP_SLEEP_ENTER_SCHEMA = automation.maybe_simple_id( DEEP_SLEEP_ENTER_SCHEMA = automation.maybe_simple_id(
{ {
cv.GenerateID(): cv.use_id(DeepSleepComponent), cv.GenerateID(): cv.use_id(DeepSleepComponent),
cv.Optional(CONF_SLEEP_DURATION): cv.positive_time_period_milliseconds, cv.Optional(CONF_SLEEP_DURATION): cv.templatable(
cv.positive_time_period_milliseconds
),
} }
) )

View file

@ -346,6 +346,8 @@ text_sensor:
- homeassistant.tag_scanned: 1234-abcd - homeassistant.tag_scanned: 1234-abcd
- deep_sleep.enter: - deep_sleep.enter:
sleep_duration: 30min sleep_duration: 30min
- deep_sleep.enter:
sleep_duration: !lambda "return 30 * 60 * 1000;"
- platform: template - platform: template
name: 'Template Text Sensor' name: 'Template Text Sensor'
lambda: |- lambda: |-