Skip to content

Add update_pin_code service for Nintendo parental controls#169865

Open
pantherale0 wants to merge 5 commits intohome-assistant:devfrom
pantherale0:feat/3497
Open

Add update_pin_code service for Nintendo parental controls#169865
pantherale0 wants to merge 5 commits intohome-assistant:devfrom
pantherale0:feat/3497

Conversation

@pantherale0
Copy link
Copy Markdown
Contributor

@pantherale0 pantherale0 commented May 5, 2026

Proposed change

Introduced a new service to update the PIN code for Nintendo devices. The service requires a device ID and a new PIN, with validation for the PIN range. Updated the corresponding YAML and strings files to include this new service and its description. Enhanced tests to cover the new functionality and ensure proper error handling for invalid devices.

Type of change

  • Dependency upgrade
  • Bugfix (non-breaking change which fixes an issue)
  • New integration (thank you!)
  • New feature (which adds functionality to an existing integration)
  • Deprecation (breaking change to happen in the future)
  • Breaking change (fix/feature causing existing functionality to break)
  • Code quality improvements to existing code or addition of tests

Additional information

Checklist

  • I understand the code I am submitting and can explain how it works.
  • The code change is tested and works locally.
  • Local tests pass. Your PR cannot be merged unless tests pass
  • There is no commented out code in this PR.
  • I have followed the development checklist
  • I have followed the perfect PR recommendations
  • The code has been formatted using Ruff (ruff format homeassistant tests)
  • Tests have been added to verify that the new code works.
  • Any generated code has been carefully reviewed for correctness and compliance with project standards.

If user exposed functionality or configuration variables are added/changed:

If the code communicates with devices, web services, or third-party tools:

  • The manifest file has all fields filled out correctly.
    Updated and included derived files by running: python3 -m script.hassfest.
  • New or updated dependencies have been added to requirements_all.txt.
    Updated by running python3 -m script.gen_requirements_all.
  • For the updated dependencies a diff between library versions and ideally a link to the changelog/release notes is added to the PR description.

To help with the load of incoming pull requests:

Introduced a new service to update the PIN code for Nintendo devices. The service requires a device ID and a new PIN, with validation for the PIN range. Updated the corresponding YAML and strings files to include this new service and its description. Enhanced tests to cover the new functionality and ensure proper error handling for invalid devices.
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds a new update_pin_code service to the nintendo_parental_controls integration so users can change a Nintendo device’s PIN from Home Assistant, along with UI metadata (services.yaml/strings/icons) and test coverage for success and common error cases.

Changes:

  • Register a new update_pin_code service (device + PIN) and wire it to the Nintendo API call.
  • Expose the service in the UI via services.yaml, strings.json, and icons.json.
  • Extend service tests to cover the new service and consolidate invalid-device cases via parametrization.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
tests/components/nintendo_parental_controls/test_services.py Adds coverage for update_pin_code and consolidates service error tests with parametrization.
homeassistant/components/nintendo_parental_controls/strings.json Adds localized strings/field descriptions for the new service.
homeassistant/components/nintendo_parental_controls/services.yaml Declares the new service fields/selectors for the UI service picker.
homeassistant/components/nintendo_parental_controls/services.py Implements and registers async_update_pin_code service handler.
homeassistant/components/nintendo_parental_controls/icons.json Adds an icon mapping for the new service.

Comment thread homeassistant/components/nintendo_parental_controls/services.py Outdated
Comment thread homeassistant/components/nintendo_parental_controls/services.yaml Outdated
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings May 5, 2026 18:12
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

Comment thread homeassistant/components/nintendo_parental_controls/services.py
Comment thread homeassistant/components/nintendo_parental_controls/strings.json Outdated
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings May 5, 2026 18:27
@pantherale0 pantherale0 marked this pull request as ready for review May 5, 2026 18:27
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.

Comment thread homeassistant/components/nintendo_parental_controls/services.py
Comment thread homeassistant/components/nintendo_parental_controls/services.yaml Outdated
Comment thread homeassistant/components/nintendo_parental_controls/services.py
Comment on lines +119 to +122
"device_id": {
"description": "The ID of the device to update the PIN code for.",
"example": "1234567890abcdef",
"name": "Device"
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Device IDs are generated and therefore the examples will always be incorrect regardless the length

Comment thread homeassistant/components/nintendo_parental_controls/services.py Outdated
Updated the update_pin_code service to accept PIN codes as strings and added validation for PIN length (4 to 8 characters). Adjusted the corresponding YAML configuration to reflect the change in PIN input type. Added error handling for invalid PIN lengths and updated tests to cover these scenarios.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants