Skip to content

Commit

Permalink
disable entities at startup that are not enabled in HA
Browse files Browse the repository at this point in the history
  • Loading branch information
dmulcahey committed Sep 22, 2024
1 parent f44b793 commit 697c6b0
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion homeassistant/components/zha/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -1154,7 +1154,7 @@ async def async_add_entities(
if not entities:
return

entities_to_add = []
entities_to_add: list[ZHAEntity] = []
for entity_data in entities:
try:
entities_to_add.append(entity_class(entity_data))
Expand All @@ -1166,6 +1166,9 @@ async def async_add_entities(
"Error while adding entity from entity data: %s", entity_data
)
_async_add_entities(entities_to_add, update_before_add=False)
for entity in entities_to_add:
if not entity.enabled:
entity.entity_data.entity.disable()
entities.clear()


Expand Down

0 comments on commit 697c6b0

Please sign in to comment.