Giter Site home page Giter Site logo

Comments (9)

bramstroker avatar bramstroker commented on August 15, 2024 1

There were some changes to make things more robust in v1.12.x revisions, and better retry mechanism and error handling.
I improved more on it and just released v1.13.1 which contains latest improvement in logging. The error you got @tvwerkhoven were fixed in recent versions of powercalc.

I tried myself by disconnecting the internet and then it should just fallback to local files which were already downloaded before, and successfully startup powercalc.
So in essence it should work like you want @tvwerkhoven with the latest version.

When you never want Powercalc to attempt connecting to the internet ever you can use this configuration:
https://homeassistant-powercalc.readthedocs.io/en/latest/library/library.html#disable-download-feature
But that also means you'll need to manage all the downloading and copying of the profiles manually.

Could you please try again with v1.13.1 and let me know if this starts up correctly without internet access?
When still problems please also enable debug logging and share the logs after startup.

from homeassistant-powercalc.

tvwerkhoven avatar tvwerkhoven commented on August 15, 2024 1

Thanks @bramstroker! I've installed v1.13.4 and it seems at least the library is created, I will check internet-less startup later.

root@proteus:~# ls -al /var/lib/homeassistant/.storage/powercalc_profiles/
total 100
drwxr-xr-x  5 root root  4096 Jul 22 15:02 .
drwxr-xr-x  4  996  996  4096 Jul 22 15:03 ..
-rw-r--r--  1 root root    18 Jul 22 15:02 .last_update
-rw-r--r--  1 root root 74988 Jul 22 15:02 library.json

from homeassistant-powercalc.

bramstroker avatar bramstroker commented on August 15, 2024

@fullerms Powercalc complete profile library previously was included in the component, but it's size was growing out of control.
So since a few months powercalc downloads the needed profiles from the internet. It should only do that once and load locally when it has already downloaded.
On every startup powercalc downloads meta data about the full library to see if certain profiles have been updated and than it should redownload.

It seems you got an error on downloading this metadata, but this should also fallback to local to not break the powercalc setup.

I will have a look into this to see why this fallback was not working for you and to make it more robust.

Also more information about the library and download feature is here: https://homeassistant-powercalc.readthedocs.io/en/latest/library/library.html

from homeassistant-powercalc.

tvwerkhoven avatar tvwerkhoven commented on August 15, 2024

I have a related issue: my powercalc v1.12.1 fails to start when there is no internet when starting Home Assistant. It tried to connect to the internet, fails, and then the sensors are unavailable.

This is the log file:

2024-06-08 13:58:04.363 ERROR (MainThread) [homeassistant.setup] Error during setup of component powercalc
Traceback (most recent call last):
  File "/usr/local/lib/python3.12/site-packages/aiohttp/connector.py", line 1203, in _create_direct_connection
    hosts = await self._resolve_host(host, port, traces=traces)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/aiohttp/connector.py", line 880, in _resolve_host
    return await asyncio.shield(resolved_host_task)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/aiohttp/connector.py", line 917, in _resolve_host_with_throttle
    addrs = await self._resolver.resolve(host, port, family=self._family)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/aiohttp/resolver.py", line 33, in resolve
    infos = await self._loop.getaddrinfo(
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/asyncio/base_events.py", line 899, in getaddrinfo
    return await self.run_in_executor(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/socket.py", line 963, in getaddrinfo
    for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
socket.gaierror: [Errno -3] Try again

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/setup.py", line 404, in _async_setup_component
    result = await task
             ^^^^^^^^^^
  File "/config/custom_components/powercalc/__init__.py", line 238, in async_setup
    await discovery_manager.start_discovery()
  File "/config/custom_components/powercalc/discovery.py", line 123, in start_discovery
    power_profile = await self.get_power_profile(
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/powercalc/discovery.py", line 144, in get_power_profile
    self.power_profiles[entity_id] = await get_power_profile(
                                     ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/powercalc/power_profile/factory.py", line 39, in get_power_profile
    library = await ProfileLibrary.factory(hass)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/powercalc/power_profile/library.py", line 49, in factory
    await library.initialize()
  File "/config/custom_components/powercalc/power_profile/library.py", line 35, in initialize
    await self._loader.initialize()
  File "/config/custom_components/powercalc/power_profile/loader/composite.py", line 14, in initialize
    [await loader.initialize() for loader in self.loaders]  # type: ignore[func-returns-value]
     ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/powercalc/power_profile/loader/remote.py", line 33, in initialize
    self.library_contents = await self.load_library_json()
                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/powercalc/power_profile/loader/remote.py", line 53, in load_library_json
    async with aiohttp.ClientSession() as session, session.get(ENDPOINT_LIBRARY) as resp:
  File "/usr/local/lib/python3.12/site-packages/aiohttp/client.py", line 1197, in __aenter__
    self._resp = await self._coro
                 ^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/aiohttp/client.py", line 581, in _request
    conn = await self._connector.connect(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/aiohttp/connector.py", line 544, in connect
    proto = await self._create_connection(req, traces, timeout)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/aiohttp/connector.py", line 944, in _create_connection
    _, proto = await self._create_direct_connection(req, traces, timeout)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/aiohttp/connector.py", line 1209, in _create_direct_connection
    raise ClientConnectorError(req.connection_key, exc) from exc
aiohttp.client_exceptions.ClientConnectorError: Cannot connect to host powercalc.lauwbier.nl:443 ssl:default [Try again]

I like the option to manually download the libraries. Perhaps it's an idea to download once, and make the check for updates opt-in/opt-out/manual/(more) robust against lack of internet.

P.S. really like your add-on :)

from homeassistant-powercalc.

fullerms avatar fullerms commented on August 15, 2024

@bramstroker thanks for the prompt response. Will test after upgrading to the new release and let you know.

from homeassistant-powercalc.

bramstroker avatar bramstroker commented on August 15, 2024

@fullerms did you already had some time to verify?

from homeassistant-powercalc.

mmalolepszy avatar mmalolepszy commented on August 15, 2024

I had a similar issue with powercalc today. There was a power outage in my area that was longer than my UPS could handle, so everything went down. After power was restored my HA server booted up faster than my modem acquired Internet connection. This led to following notification appearing in HA:
obraz
In the logs there are warnings for failed download retry and an exception:

Traceback (most recent call last):
  File "/usr/local/lib/python3.12/site-packages/aiohttp/connector.py", line 1203, in _create_direct_connection
    hosts = await self._resolve_host(host, port, traces=traces)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/aiohttp/connector.py", line 880, in _resolve_host
    return await asyncio.shield(resolved_host_task)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/aiohttp/connector.py", line 917, in _resolve_host_with_throttle
    addrs = await self._resolver.resolve(host, port, family=self._family)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/aiohttp/resolver.py", line 33, in resolve
    infos = await self._loop.getaddrinfo(
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/asyncio/base_events.py", line 899, in getaddrinfo
    return await self.run_in_executor(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/socket.py", line 963, in getaddrinfo
    for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
socket.gaierror: [Errno -3] Try again

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/config/custom_components/powercalc/power_profile/loader/remote.py", line 205, in download_with_retry
    return await callback()
           ^^^^^^^^^^^^^^^^
  File "/config/custom_components/powercalc/power_profile/loader/remote.py", line 72, in _download_remote_library_json
    async with aiohttp.ClientSession() as session, session.get(ENDPOINT_LIBRARY) as resp:
  File "/usr/local/lib/python3.12/site-packages/aiohttp/client.py", line 1197, in __aenter__
    self._resp = await self._coro
                 ^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/aiohttp/client.py", line 581, in _request
    conn = await self._connector.connect(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/aiohttp/connector.py", line 544, in connect
    proto = await self._create_connection(req, traces, timeout)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/aiohttp/connector.py", line 944, in _create_connection
    _, proto = await self._create_direct_connection(req, traces, timeout)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/aiohttp/connector.py", line 1209, in _create_direct_connection
    raise ClientConnectorError(req.connection_key, exc) from exc
aiohttp.client_exceptions.ClientConnectorError: Cannot connect to host powercalc.lauwbier.nl:443 ssl:default [Try again]

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/config/custom_components/powercalc/power_profile/loader/remote.py", line 78, in load_library_json
    return cast(dict[str, Any], await self.download_with_retry(_download_remote_library_json))
                                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/powercalc/power_profile/loader/remote.py", line 210, in download_with_retry
    raise ProfileDownloadError(f"Failed to download even after {max_retries} retries, falling back to local copy") from e
custom_components.powercalc.power_profile.error.ProfileDownloadError: Failed to download even after 3 retries, falling back to local copy

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/setup.py", line 402, in _async_setup_component
    result = await task
             ^^^^^^^^^^
  File "/config/custom_components/powercalc/__init__.py", line 242, in async_setup
    await discovery_manager.start_discovery()
  File "/config/custom_components/powercalc/discovery.py", line 69, in start_discovery
    power_profile = await self.get_power_profile(
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/powercalc/discovery.py", line 93, in get_power_profile
    self.power_profiles[entity_id] = await get_power_profile(
                                     ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/powercalc/power_profile/factory.py", line 39, in get_power_profile
    library = await ProfileLibrary.factory(hass)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/powercalc/power_profile/library.py", line 48, in factory
    await library.initialize()
  File "/config/custom_components/powercalc/power_profile/library.py", line 34, in initialize
    await self._loader.initialize()
  File "/config/custom_components/powercalc/power_profile/loader/composite.py", line 14, in initialize
    [await loader.initialize() for loader in self.loaders]  # type: ignore[func-returns-value]
     ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/powercalc/power_profile/loader/remote.py", line 42, in initialize
    self.library_contents = await self.load_library_json()
                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/powercalc/power_profile/loader/remote.py", line 81, in load_library_json
    return await self.hass.async_add_executor_job(_load_local_library_json)  # type: ignore
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/powercalc/power_profile/loader/remote.py", line 66, in _load_local_library_json
    with open(get_library_json_path()) as f:
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/util/loop.py", line 131, in protected_loop_func
    return func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^
FileNotFoundError: [Errno 2] No such file or directory: '/config/custom_components/powercalc/../../profile_library/library.json'

The weird outcome of that is that now powercalc integration is in "not loaded" state and I don't see any option to reload it other than restarting Home Assistant.

I'm running HA Core 2024.6.4 in docker with powercalc 1.13.3.

from homeassistant-powercalc.

tvwerkhoven avatar tvwerkhoven commented on August 15, 2024

Could you please try again with v1.13.1 and let me know if this starts up correctly without internet access? When still problems please also enable debug logging and share the logs after startup.

Thanks for the quick update! I just tested and unfortunately disconnecting internet, then rebooting HA (or rather: the server running it) still results in powercalc 'not loaded'. The OpenWeather integration similarly gets into a 'service unavailable' state, but recovers once I re-connect the internet, powercalc does not. I think it might be due to powercalc using DATA_DIR which doesn't exist, however creating it manually doesn't help, and I can't find where generate_library_json() is called.

Details below.

HA log entry
Logger: homeassistant.setup
Source: setup.py:404
First occurred: 19:15:39 (1 occurrences)
Last logged: 19:15:39

Error during setup of component powercalc
Traceback (most recent call last):
  File "/usr/local/lib/python3.12/site-packages/aiohttp/connector.py", line 1203, in _create_direct_connection
    hosts = await self._resolve_host(host, port, traces=traces)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/aiohttp/connector.py", line 880, in _resolve_host
    return await asyncio.shield(resolved_host_task)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/aiohttp/connector.py", line 917, in _resolve_host_with_throttle
    addrs = await self._resolver.resolve(host, port, family=self._family)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/aiohttp/resolver.py", line 33, in resolve
    infos = await self._loop.getaddrinfo(
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/asyncio/base_events.py", line 899, in getaddrinfo
    return await self.run_in_executor(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/socket.py", line 963, in getaddrinfo
    for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
socket.gaierror: [Errno -3] Try again

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/config/custom_components/powercalc/power_profile/loader/remote.py", line 198, in download_with_retry
    return await callback()
           ^^^^^^^^^^^^^^^^
  File "/config/custom_components/powercalc/power_profile/loader/remote.py", line 67, in _download_remote_library_json
    async with aiohttp.ClientSession() as session, session.get(ENDPOINT_LIBRARY) as resp:
  File "/usr/local/lib/python3.12/site-packages/aiohttp/client.py", line 1197, in __aenter__
    self._resp = await self._coro
                 ^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/aiohttp/client.py", line 581, in _request
    conn = await self._connector.connect(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/aiohttp/connector.py", line 544, in connect
    proto = await self._create_connection(req, traces, timeout)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/aiohttp/connector.py", line 944, in _create_connection
    _, proto = await self._create_direct_connection(req, traces, timeout)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/aiohttp/connector.py", line 1209, in _create_direct_connection
    raise ClientConnectorError(req.connection_key, exc) from exc
aiohttp.client_exceptions.ClientConnectorError: Cannot connect to host powercalc.lauwbier.nl:443 ssl:default [Try again]

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/config/custom_components/powercalc/power_profile/loader/remote.py", line 73, in load_library_json
    return cast(dict[str, Any], await self.download_with_retry(_download_remote_library_json))
                                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/powercalc/power_profile/loader/remote.py", line 203, in download_with_retry
    raise ProfileDownloadError(f"Failed to download even after {max_retries} retries, falling back to local copy") from e
custom_components.powercalc.power_profile.error.ProfileDownloadError: Failed to download even after 3 retries, falling back to local copy

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/setup.py", line 404, in _async_setup_component
    result = await task
             ^^^^^^^^^^
  File "/config/custom_components/powercalc/__init__.py", line 242, in async_setup
    await discovery_manager.start_discovery()
  File "/config/custom_components/powercalc/discovery.py", line 119, in start_discovery
    power_profile = await self.get_power_profile(
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/powercalc/discovery.py", line 143, in get_power_profile
    self.power_profiles[entity_id] = await get_power_profile(
                                     ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/powercalc/power_profile/factory.py", line 39, in get_power_profile
    library = await ProfileLibrary.factory(hass)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/powercalc/power_profile/library.py", line 49, in factory
    await library.initialize()
  File "/config/custom_components/powercalc/power_profile/library.py", line 35, in initialize
    await self._loader.initialize()
  File "/config/custom_components/powercalc/power_profile/loader/composite.py", line 14, in initialize
    [await loader.initialize() for loader in self.loaders]  # type: ignore[func-returns-value]
     ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/powercalc/power_profile/loader/remote.py", line 41, in initialize
    self.library_contents = await self.load_library_json()
                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/powercalc/power_profile/loader/remote.py", line 76, in load_library_json
    return await self.hass.async_add_executor_job(_load_local_library_json)  # type: ignore
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/powercalc/power_profile/loader/remote.py", line 61, in _load_local_library_json
    with open(get_library_json_path()) as f:
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
FileNotFoundError: [Errno 2] No such file or directory: '/config/custom_components/powercalc/../../profile_library/library.json'

It seems the Internet-less fallback of using local copies is failing when loading the file /config/custom_components/powercalc/../../profile_library/library.json (see logs, similar to @mmalolepszy's). Neither the file, nor the profile_library exist:

tim@proteus:~$ sudo find  /var/lib/homeassistant/ | grep library.json
tim@proteus:~$ sudo find  /var/lib/homeassistant/ | grep profile_library
tim@proteus:~$

The only way I know to get powercalc out of this state is restarting HA. Once I do that, the files are still not created, nor do I see any powercalc entries in the log file. I think the cause might be that profile_library doesn't exist while

def generate_library_json(model_listing: list[dict]) -> None:
fails is expecting it, and hence this function fails to write the offline copy to library.json.

Creating the directory manually, ensuring ownership is the same as other files, and then restarting HA does not create library.json either.

Finally, chowning the files in custom_components to the right user/group (it was a mix of root, my login, and user 996) and restarting HA also does not help.

Furthermore, it seems powercalc does store config data on individual devices which I manually added, but this is under /var/lib/homeassistant/.storage/powercalc_profiles/ (which I see is populated by the variable STORAGE_DIR). Can it be a solution to store the offline cache here as well? Or: what is the difference between STORAGE_DIR and DATA_DIR?

In my (fairly vanilla Docker setup), I have root owning the directory /var/lib/homeassistant/, where most individual files are owned by user/group 996 (I think this is something Docker-related but not sure).

I'm running v1.13.1 manually installed (not via HACS) on HA 2024.5.4 in Docker.

from homeassistant-powercalc.

bramstroker avatar bramstroker commented on August 15, 2024

@tvwerkhoven thanks for the detailed information.
The fallback implementation was indeed incorrect. It was succeeding on my dev machine and in test suite as I have the profile_library available in the project root there.
When building distribution zip for HACS the profile_library is removed from the zip

It should be fixed now by also downloading the library.json to the local storage dir .storage/powercalc_profiles.

So after one successful startup powercalc will download the file there. Whenever on a subsequent restart internet is down it should fallback to that file and still continue starting up HA without errors.

Fixed with this PR: #2391
Will be in next release.

from homeassistant-powercalc.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.