Skip to content

home-assistant-custom-modules.battery_notes: init at 2.8.3 #380571

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

matthiasbeyer
Copy link
Contributor

I did not yet test this integration in my local setup.

Things done

  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandboxing enabled in nix.conf? (See Nix manual)
    • sandbox = relaxed
    • sandbox = true
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • 25.05 Release Notes (or backporting 24.11 and 25.05 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
  • Fits CONTRIBUTING.md.

Add a 👍 reaction to pull requests you find important.

Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
@nix-owners nix-owners bot requested a review from mweinelt February 9, 2025 09:16
@github-actions github-actions bot added 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin. 10.rebuild-linux: 1 This PR causes 1 package to rebuild on Linux. 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux. labels Feb 9, 2025
@matthiasbeyer
Copy link
Contributor Author

Pushed a formatting fixup.

This fails for me with:

Traceback (most recent call last):
  File "/nix/store/x9222s87a0g16n873rpmrickw39zalh9-homeassistant-2025.1.2/lib/python3.13/site-packages/homeassistant/setup.py", line 416, in _async_setup_component
    result = await task
             ^^^^^^^^^^
  File "/var/lib/hass/custom_components/battery_notes/__init__.py", line 134, in async_setup
    await library_updater.get_library_updates(dt_util.utcnow())
  File "/var/lib/hass/custom_components/battery_notes/library_updater.py", line 102, in get_library_updates
    await self.hass.async_add_executor_job(
        _update_library_json, json_path, content
    )
  File "/nix/store/29a6wlyr860xg3i9n3pzavrlggmyxzkr-python3-3.13.1/lib/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/var/lib/hass/custom_components/battery_notes/library_updater.py", line 87, in _update_library_json
    with open(library_file, mode="w", encoding="utf-8") as file:
         ~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/nix/store/x9222s87a0g16n873rpmrickw39zalh9-homeassistant-2025.1.2/lib/python3.13/site-packages/homeassistant/util/loop.py", line 200, in protected_loop_func
    return func(*args, **kwargs)
OSError: [Errno 30] Read-only file system: '/var/lib/hass/custom_components/battery_notes/data/library.json'

Which I don't know how to fix properly. If someone wants to help here, more than welcome!

@dotlambda
Copy link
Member

dotlambda commented Feb 10, 2025

https://battery-notes-data.codechimp.org/library.json isn't versioned. Instead it's downloaded at every import of the custom component: https://github.com/andrew-codechimp/HA-Battery-Notes/blob/2.8.3/custom_components/battery_notes/__init__.py#L134
After that it's re-downloaded every 24 hours: https://github.com/andrew-codechimp/HA-Battery-Notes/blob/2.8.3/custom_components/battery_notes/library_updater.py#L56
The file is stored in the same directory as the code: https://github.com/andrew-codechimp/HA-Battery-Notes/blob/main/custom_components/battery_notes/library_updater.py#L31
You could specify a user_library but it still needs to be put in that directory: https://github.com/andrew-codechimp/HA-Battery-Notes/blob/2.8.3/custom_components/battery_notes/library.py#L61
One way to fix this would be for upstream to store the file in a temporary directory or under HA's config instead.

@matthiasbeyer
Copy link
Contributor Author

Filed an upstream issue to the best of my ability here.

@dotlambda dotlambda marked this pull request as draft February 19, 2025 20:38
@nixpkgs-ci nixpkgs-ci bot added the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Aug 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin. 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux. 10.rebuild-linux: 1 This PR causes 1 package to rebuild on Linux.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants