[core] Fix polling_component_schema and type consistency (#12478)
Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -71,6 +71,7 @@ from esphome.const import (
|
||||
PLATFORM_ESP32,
|
||||
PLATFORM_ESP8266,
|
||||
PLATFORM_RP2040,
|
||||
SCHEDULER_DONT_RUN,
|
||||
TYPE_GIT,
|
||||
TYPE_LOCAL,
|
||||
VALID_SUBSTITUTIONS_CHARACTERS,
|
||||
@@ -894,7 +895,7 @@ def time_period_in_minutes_(value):
|
||||
|
||||
def update_interval(value):
|
||||
if value == "never":
|
||||
return 4294967295 # uint32_t max
|
||||
return TimePeriodMilliseconds(milliseconds=SCHEDULER_DONT_RUN)
|
||||
return positive_time_period_milliseconds(value)
|
||||
|
||||
|
||||
@@ -2009,7 +2010,7 @@ def polling_component_schema(default_update_interval):
|
||||
if default_update_interval is None:
|
||||
return COMPONENT_SCHEMA.extend(
|
||||
{
|
||||
Required(CONF_UPDATE_INTERVAL): default_update_interval,
|
||||
Required(CONF_UPDATE_INTERVAL): update_interval,
|
||||
}
|
||||
)
|
||||
assert isinstance(default_update_interval, str)
|
||||
|
||||
Reference in New Issue
Block a user