Skip to content

Commit

Permalink
Merge pull request #108 from tykeal/link_to_keymaster
Browse files Browse the repository at this point in the history
Fix: Correct upgrade issues for package_path
  • Loading branch information
tykeal authored Jun 29, 2022
2 parents f8723e1 + 01c80c2 commit f461e23
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions custom_components/rental_control/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,9 @@ async def update_listener(hass: HomeAssistant, entry: ConfigEntry) -> None:
options={},
)

# Update the calendar config
hass.data[DOMAIN][entry.unique_id].update_config(new_data)

# Update package files
if new_data[CONF_LOCK_ENTRY]:
rc_name = new_data[CONF_NAME]
Expand All @@ -278,9 +281,6 @@ async def update_listener(hass: HomeAssistant, entry: ConfigEntry) -> None:
},
)

# Update the calendar config
hass.data[DOMAIN][entry.unique_id].update_config(new_data)


class RentalControl:
"""Get a list of events."""
Expand Down Expand Up @@ -449,6 +449,19 @@ def update_config(self, config):
self.ignore_non_reserved = None
self.verify_ssl = config.get(CONF_VERIFY_SSL)

# make sure we have a path set
self.path = config.get(CONF_PATH, None)

# This should not be possible during this phase!
if self.path is None and self.lockname is not None:
notification_id = f"{DOMAIN}_{self._name}_missing_path"
async_create(
self.hass,
(f"Please update configuration for {NAME} {self._name}"),
title=f"{NAME} - Missing configuration",
notification_id=notification_id,
)

# updated the calendar in case the fetch days has changed
self.calendar = self._refresh_event_dict()

Expand Down

0 comments on commit f461e23

Please sign in to comment.