mirror of
https://github.com/esphome/esphome.git
synced 2025-10-03 02:22:25 +01:00
preen
This commit is contained in:
@@ -1,3 +1,5 @@
|
|||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
@@ -43,6 +45,7 @@ from esphome.helpers import (
|
|||||||
slugify,
|
slugify,
|
||||||
walk_files,
|
walk_files,
|
||||||
)
|
)
|
||||||
|
from esphome.types import ConfigType
|
||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
@@ -372,7 +375,7 @@ async def _add_platform_reserves() -> None:
|
|||||||
|
|
||||||
|
|
||||||
@coroutine_with_priority(100.0)
|
@coroutine_with_priority(100.0)
|
||||||
async def to_code(config):
|
async def to_code(config: ConfigType) -> None:
|
||||||
cg.add_global(cg.global_ns.namespace("esphome").using)
|
cg.add_global(cg.global_ns.namespace("esphome").using)
|
||||||
# These can be used by user lambdas, put them to default scope
|
# These can be used by user lambdas, put them to default scope
|
||||||
cg.add_global(cg.RawExpression("using std::isnan"))
|
cg.add_global(cg.RawExpression("using std::isnan"))
|
||||||
@@ -464,6 +467,7 @@ async def to_code(config):
|
|||||||
cg.add_define("USE_AREAS")
|
cg.add_define("USE_AREAS")
|
||||||
|
|
||||||
# Handle area configuration
|
# Handle area configuration
|
||||||
|
area_conf: dict[str, str] | str | None
|
||||||
if area_conf := config.get(CONF_AREA):
|
if area_conf := config.get(CONF_AREA):
|
||||||
if isinstance(area_conf, dict):
|
if isinstance(area_conf, dict):
|
||||||
# New way: structured area configuration
|
# New way: structured area configuration
|
||||||
|
Reference in New Issue
Block a user