mirror of
https://github.com/Threnklyn/esphome-dev.git
synced 2026-05-31 18:18:27 +02:00
Use /data directory for .esphome folder when running as HA add-on (#5374)
This commit is contained in:
@@ -98,10 +98,9 @@ def validate_truetype_file(value):
|
||||
|
||||
|
||||
def _compute_local_font_dir(name) -> Path:
|
||||
base_dir = Path(CORE.config_dir) / ".esphome" / DOMAIN
|
||||
h = hashlib.new("sha256")
|
||||
h.update(name.encode())
|
||||
return base_dir / h.hexdigest()[:8]
|
||||
return Path(CORE.data_dir) / DOMAIN / h.hexdigest()[:8]
|
||||
|
||||
|
||||
def _compute_gfonts_local_path(value) -> Path:
|
||||
|
||||
@@ -52,7 +52,7 @@ Image_ = image_ns.class_("Image")
|
||||
|
||||
|
||||
def _compute_local_icon_path(value) -> Path:
|
||||
base_dir = Path(CORE.config_dir) / ".esphome" / DOMAIN / "mdi"
|
||||
base_dir = Path(CORE.data_dir) / DOMAIN / "mdi"
|
||||
return base_dir / f"{value[CONF_ICON]}.svg"
|
||||
|
||||
|
||||
|
||||
@@ -87,12 +87,7 @@ def get_firmware(value):
|
||||
url = value[CONF_URL]
|
||||
|
||||
if CONF_SHA256 in value: # we have a hash, enable caching
|
||||
path = (
|
||||
Path(CORE.config_dir)
|
||||
/ ".esphome"
|
||||
/ DOMAIN
|
||||
/ (value[CONF_SHA256] + "_fw_stm.bin")
|
||||
)
|
||||
path = Path(CORE.data_dir) / DOMAIN / (value[CONF_SHA256] + "_fw_stm.bin")
|
||||
|
||||
if not path.is_file():
|
||||
firmware_data, dl_hash = dl(url)
|
||||
|
||||
Reference in New Issue
Block a user