Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug fixes #156

Merged
merged 2 commits into from
Feb 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 15 additions & 12 deletions custom_components/rental_control/sensors/mapsensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,7 @@ def entity_category(self) -> EntityCategory:
@property
def extra_state_attributes(self) -> dict:
"""Return the mapping attributes."""
attrib = {
**self._mapping_attributes,
}

return attrib
return self._mapping_attributes

@property
def icon(self) -> str:
Expand Down Expand Up @@ -114,15 +110,22 @@ async def async_update(self):

overrides = self.rental_control.event_overrides.copy()

_LOGGER.debug("Current event_overrides: %s", overrides)
_LOGGER.debug(
"Current mapping attributes: %s", self._mapping_attributes["mapping"]
)

for override in overrides:
if override not in self._mapping_attributes["mapping"].values():
_LOGGER.debug("%s is not in current mapping", override)
if "Slot " not in override:
self._mapping_attributes["mapping"][
overrides[override]["slot"]
] = override
if "Slot " not in override:
self._mapping_attributes["mapping"][
overrides[override]["slot"]
] = override
else:
_LOGGER.debug("%s is in current mapping", override)
self._mapping_attributes["mapping"][overrides[override]["slot"]] = None

_LOGGER.debug(
"Updated mapping attributes: %s", self._mapping_attributes["mapping"]
)

slots = filter(lambda k: ("Slot " in k), overrides)
for event in get_event_names(self.rental_control):
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
automation:
id: "{{ config_entry["unique_id"] }} - {{ NAME }} - Clear code slot {{ rc_name }}"
alias: "{{ NAME }} - Clear code slot {{ rc_name }}"
description: ""
trigger:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
automation:
id: "{{ config_entry["unique_id"] }} - {{ NAME }} - Set code {{ rc_name }}"
alias: {{ NAME }} - Set Code {{ rc_name }}
description: ""
mode: queued
Expand Down
1 change: 1 addition & 0 deletions custom_components/rental_control/templates/startup.yaml.j2
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
automation:
id: "{{ config_entry["unique_id"] }} - {{ NAME }} - Update {{ rc_name }} - startup"
alias: "{{ NAME }} - Update {{ rc_name }} - startup"
description: ""
trigger:
Expand Down
1 change: 1 addition & 0 deletions custom_components/rental_control/templates/update.yaml.j2
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
automation:
id: "{{ config_entry["unique_id"] }} - {{ NAME }} - Update {{ rc_name }}"
alias: "{{ NAME }} - Update {{ rc_name }}"
description: ""
trigger:
Expand Down