Skip to content

Commit

Permalink
fix: use correct path also in hass os (Raspi)
Browse files Browse the repository at this point in the history
  • Loading branch information
klausj1 committed Feb 14, 2024
1 parent e510e2e commit c1dd1ae
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions custom_components/import_statistics/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,11 @@ def handle_import_from_file(call):
_LOGGER.debug(f"Decimal separator: {decimal}") # noqa: G004

hass.states.set("import_statistics.import_from_file", filename)
base_path = "config"
file_path = f"{base_path}/{filename}"

file_path = f"{hass.config.config_dir}/{filename}"

if not os.path.exists(file_path):
_handle_error(f"filename {filename} does not exist in config folder")
_handle_error(f"path {file_path} does not exist.")

with open(file_path, encoding="UTF-8") as csvfile:
df = pd.read_csv(csvfile, sep=delimiter, decimal=decimal, engine="python")
Expand Down

0 comments on commit c1dd1ae

Please sign in to comment.