Skip to content

Conversation

@netmaxt3r
Copy link

@netmaxt3r netmaxt3r commented Jan 8, 2026

Summary by Sourcery

Update NiceHash Home Assistant integration for compatibility with HA 2026.x and add local development tooling.

Enhancements:

  • Align Home Assistant integration entry setup functions with the current HomeAssistant type usage for HA 2026.x.
  • Introduce Ruff configuration aligned with Home Assistant core linting standards.
  • Add example Home Assistant configuration for local debugging of the NiceHash custom component.

Build:

  • Add Python requirements file pinning Home Assistant 2026.1.0 and development dependencies.
  • Add helper scripts and devcontainer configuration to support local development and linting of the integration.

Chores:

  • Update repository ignore and ancillary config files to match the new development setup.

@sourcery-ai
Copy link

sourcery-ai bot commented Jan 8, 2026

Reviewer's Guide

Update the NiceHash custom component to be compatible with Home Assistant 2026.x and add local development and linting tooling aligned with Home Assistant core practices.

Flow diagram for local development workflow with new tooling

flowchart TD
    A["Clone repository"] --> B["Create dev container or local venv"]
    B --> C["pip install -r requirements.txt"]
    C --> D["Run scripts/setup"]
    D --> E["Run scripts/develop to start Home Assistant 2026.x"]
    E --> F["Home Assistant loads custom_components.nicehash using HomeAssistant type"]

    C --> G["Run scripts/lint"]
    G --> H["ruff uses .ruff.toml rules"]

    E --> I["Edit integration code in editor"]
    I --> G

    subgraph Runtime_Config
        J["config/configuration.yaml"]
        K["logger: custom_components.nicehash = debug"]
    end

    J --> E
    K --> E
Loading

File-Level Changes

Change Details Files
Align Home Assistant integration entry setup signatures with current Home Assistant typing expectations for 2026.x.
  • Change async_setup_entry hass parameter type from HomeAssistantType to HomeAssistant in the integration’s main module.
  • Update sensor platform async_setup_entry hass parameter type to HomeAssistant.
  • Update switch platform async_setup_entry hass parameter type to HomeAssistant.
custom_components/nicehash/__init__.py
custom_components/nicehash/sensor.py
custom_components/nicehash/switch.py
Introduce local development, linting, and configuration tooling consistent with Home Assistant core.
  • Add a Ruff configuration mirroring Home Assistant core linting rules, including selected checks and ignores.
  • Add a base Home Assistant configuration.yaml enabling default_config, debugging, and debug logging for the NiceHash integration.
  • Add a requirements file pinning Home Assistant 2026.1.0 and related dev tools (ruff, colorlog, pip).
  • Add or update devcontainer configuration and gitignore for containerized development and repo hygiene.
  • Add helper scripts for setup, linting, and general development workflow.
.ruff.toml
config/configuration.yaml
requirements.txt
.devcontainer/devcontainer.json
.gitignore
scripts/develop
scripts/lint
scripts/setup

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've found 1 issue, and left some high level feedback:

  • The new scripts/develop, scripts/lint, and scripts/setup files are empty in this diff; consider either adding their intended logic or removing them to avoid confusion about their purpose.
  • The newly added config/configuration.yaml and pinned homeassistant==2026.1.0 in requirements.txt look like local dev tooling; consider isolating these into a dedicated dev environment setup (e.g., under .devcontainer or similar) so they don't affect consumers of the integration.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- The new `scripts/develop`, `scripts/lint`, and `scripts/setup` files are empty in this diff; consider either adding their intended logic or removing them to avoid confusion about their purpose.
- The newly added `config/configuration.yaml` and pinned `homeassistant==2026.1.0` in `requirements.txt` look like local dev tooling; consider isolating these into a dedicated dev environment setup (e.g., under `.devcontainer` or similar) so they don't affect consumers of the integration.

## Individual Comments

### Comment 1
<location> `config/configuration.yaml:5-6` </location>
<code_context>
+default_config:
+
+# https://www.home-assistant.io/integrations/homeassistant/
+homeassistant:
+  debug: true
+
+# https://www.home-assistant.io/integrations/logger/
</code_context>

<issue_to_address>
**issue (bug_risk):** `homeassistant: debug: true` is not a valid core config option and may break config loading.

If this file is intended to be used directly, this key will likely cause a configuration error. To enable debug logging, rely on the existing `logger:` configuration (which already sets `custom_components.nicehash` to `debug`) and remove `debug: true` from the `homeassistant:` block.
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Comment on lines +5 to +6
homeassistant:
debug: true
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue (bug_risk): homeassistant: debug: true is not a valid core config option and may break config loading.

If this file is intended to be used directly, this key will likely cause a configuration error. To enable debug logging, rely on the existing logger: configuration (which already sets custom_components.nicehash to debug) and remove debug: true from the homeassistant: block.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant