1
0
mirror of https://github.com/esphome/esphome.git synced 2025-09-29 08:32:26 +01:00
This commit is contained in:
J. Nick Koston
2025-07-25 11:59:13 -10:00
parent 1ac444a558
commit 9c4fc5d354
2 changed files with 3 additions and 2 deletions

View File

@@ -148,8 +148,8 @@ async def to_code(config):
if config.get(CONF_ACTIONS) or config[CONF_CUSTOM_SERVICES]: if config.get(CONF_ACTIONS) or config[CONF_CUSTOM_SERVICES]:
cg.add_define("USE_API_SERVICES") cg.add_define("USE_API_SERVICES")
# Set USE_API_HOMEASSISTANT_STATES if enabled or homeassistant component is loaded # Set USE_API_HOMEASSISTANT_STATES if enabled
if config[CONF_HOMEASSISTANT_STATES] or "homeassistant" in CORE.loaded_integrations: if config[CONF_HOMEASSISTANT_STATES]:
cg.add_define("USE_API_HOMEASSISTANT_STATES") cg.add_define("USE_API_HOMEASSISTANT_STATES")
if actions := config.get(CONF_ACTIONS, []): if actions := config.get(CONF_ACTIONS, []):

View File

@@ -38,3 +38,4 @@ def setup_home_assistant_entity(var, config):
cg.add(var.set_entity_id(config[CONF_ENTITY_ID])) cg.add(var.set_entity_id(config[CONF_ENTITY_ID]))
if CONF_ATTRIBUTE in config: if CONF_ATTRIBUTE in config:
cg.add(var.set_attribute(config[CONF_ATTRIBUTE])) cg.add(var.set_attribute(config[CONF_ATTRIBUTE]))
cg.add_define("USE_API_HOMEASSISTANT_STATES")