Skip to content

Commit

Permalink
Fix core wrong reference
Browse files Browse the repository at this point in the history
  • Loading branch information
elad-bar committed Oct 13, 2022
1 parent b55393a commit b6a1778
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 6 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## 2.0.11

- Fix core wrong reference

## 2.0.10

- Update core to latest
Expand Down
14 changes: 9 additions & 5 deletions custom_components/edgeos/core/managers/entity_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@ async def _async_update(self):
)

def _compare_data(self,
entity_name: str,
entity: EntityData,
state: str | int | float | bool,
attributes: dict,
Expand Down Expand Up @@ -206,7 +207,7 @@ def _compare_data(self,
if modified:
full_message = " | ".join(msgs)

_LOGGER.debug(f"{entity.entity_description.name} | {entity.domain} | {full_message}")
_LOGGER.debug(f"{entity_name} | {entity.domain} | {full_message}")

return modified

Expand Down Expand Up @@ -238,19 +239,19 @@ def set_entity(self,
):

entity = self.entities.get(entity_description.key)

entity_name = entity_description.name
original_status = None

if entity is None:
entity = EntityData(entry_id)
entity.status = EntityStatus.CREATED
entity.domain = domain

self._compare_data(entity, state, attributes, device_name)
self._compare_data(entity_name, entity, state, attributes, device_name)

else:
original_status = entity.status
was_modified = self._compare_data(entity, state, attributes, device_name, entity_description, details)
was_modified = self._compare_data(entity_name, entity, state, attributes, device_name, entity_description, details)

if was_modified:
entity.status = EntityStatus.UPDATED
Expand All @@ -276,4 +277,7 @@ def set_entity(self,
self.entities[entity_description.key] = entity

if entity.status != EntityStatus.READY:
_LOGGER.info(f"{entity.name} ({entity.domain}) {entity.status}, state: {entity.state} | {original_status}")
_LOGGER.info(
f"{entity_name} ({entity.domain}) {entity.status}, "
f"state: {entity.state} | {original_status}"
)
2 changes: 1 addition & 1 deletion custom_components/edgeos/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@
"codeowners": ["@elad-bar"],
"requirements": ["aiohttp"],
"config_flow": true,
"version": "2.0.10",
"version": "2.0.11",
"iot_class": "local_polling"
}

0 comments on commit b6a1778

Please sign in to comment.