Skip to content

Commit

Permalink
- prevent attempted updates of disabled entities (resolves part of #34)
Browse files Browse the repository at this point in the history
  • Loading branch information
simbaja committed Aug 20, 2021
1 parent 5d23378 commit e0a19f8
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions custom_components/ge_home/update_coordinator.py
Original file line number Diff line number Diff line change
Expand Up @@ -262,19 +262,21 @@ async def on_device_update(self, data: Tuple[GeAppliance, Dict[ErdCodeType, Any]
except KeyError:
return
for entity in api.entities:
_LOGGER.debug(f"Updating {entity} ({entity.unique_id}, {entity.entity_id})")
entity.async_write_ha_state()
if entity.enabled:
_LOGGER.debug(f"Updating {entity} ({entity.unique_id}, {entity.entity_id})")
entity.async_write_ha_state()

async def _refresh_ha_state(self):
entities = [
entity for api in self.appliance_apis.values() for entity in api.entities
]
for entity in entities:
try:
_LOGGER.debug(f"Refreshing state for {entity} ({entity.unique_id}, {entity.entity_id}")
entity.async_write_ha_state()
except:
_LOGGER.debug(f"Could not refresh state for {entity} ({entity.unique_id}, {entity.entity_id}")
if entity.enabled:
try:
_LOGGER.debug(f"Refreshing state for {entity} ({entity.unique_id}, {entity.entity_id}")
entity.async_write_ha_state()
except:
_LOGGER.debug(f"Could not refresh state for {entity} ({entity.unique_id}, {entity.entity_id}")

@property
def all_appliances_updated(self) -> bool:
Expand Down

0 comments on commit e0a19f8

Please sign in to comment.