Skip to content

Commit

Permalink
fix: CONF_PATH fix for fresh installs (#1070)
Browse files Browse the repository at this point in the history
  • Loading branch information
firstof9 authored Feb 18, 2025
1 parent 786937d commit 7ef5b3c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
3 changes: 3 additions & 0 deletions custom_components/mail_and_packages/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@ async def async_setup_entry(hass: HomeAssistant, config_entry: ConfigEntry) -> b
# Sort the resources
updated_config[CONF_RESOURCES] = sorted(updated_config[CONF_RESOURCES])

if CONF_PATH not in updated_config:
updated_config[CONF_PATH] = "custom_components/mail_and_packages/images/"

if updated_config != config_entry.data:
hass.config_entries.async_update_entry(config_entry, data=updated_config)

Expand Down
4 changes: 3 additions & 1 deletion custom_components/mail_and_packages/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,9 @@ def native_value(self) -> Optional[str]:

grid_image = self.coordinator.data.get(ATTR_GRID_IMAGE_NAME)

path = self.coordinator.data.get(ATTR_IMAGE_PATH, self._config.data[CONF_PATH])
path = self.coordinator.data.get(
ATTR_IMAGE_PATH, self._config.data.get(CONF_PATH)
)

if self.type == "usps_mail_image_system_path":
_LOGGER.debug("Updating system image path to: %s", path)
Expand Down

0 comments on commit 7ef5b3c

Please sign in to comment.