Skip to content

Add binary sensor platform to PlayStation Network Integration#147639

Merged
frenck merged 10 commits into
home-assistant:devfrom
JackJPowell:psn_binary_sensor
Jul 5, 2025
Merged

Add binary sensor platform to PlayStation Network Integration#147639
frenck merged 10 commits into
home-assistant:devfrom
JackJPowell:psn_binary_sensor

Conversation

@JackJPowell
Copy link
Copy Markdown
Contributor

@JackJPowell JackJPowell commented Jun 26, 2025

Proposed change

Adds binary sensor platform to the playstation network integration.
Includes: psn online status and playstation plus subscription status
Documentation PR

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

  • This PR fixes or closes issue: fixes #
  • This PR is related to issue:
  • Link to documentation pull request:
  • Link to developer documentation pull request:
  • Link to frontend pull request:

Checklist

  • 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.

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 link to the changelog, or at minimum a diff between library versions is added to the PR description.

To help with the load of incoming pull requests:

@home-assistant
Copy link
Copy Markdown
Contributor

Hey there @tr4nt0r, mind taking a look at this pull request as it has been labeled with an integration (playstation_network) you are listed as a code owner for? Thanks!

Code owner commands

Code owners of playstation_network can trigger bot actions by commenting:

  • @home-assistant close Closes the pull request.
  • @home-assistant rename Awesome new title Renames the pull request.
  • @home-assistant reopen Reopen the pull request.
  • @home-assistant unassign playstation_network Removes the current integration label and assignees on the pull request, add the integration domain after the command.
  • @home-assistant add-label needs-more-information Add a label (needs-more-information, problem in dependency, problem in custom component) to the pull request.
  • @home-assistant remove-label needs-more-information Remove a label (needs-more-information, problem in dependency, problem in custom component) on the pull request.

Comment thread homeassistant/components/playstation_network/binary_sensor.py Outdated
Comment thread homeassistant/components/playstation_network/binary_sensor.py Outdated
Comment thread homeassistant/components/playstation_network/binary_sensor.py Outdated
Comment thread homeassistant/components/playstation_network/binary_sensor.py Outdated
Comment thread homeassistant/components/playstation_network/binary_sensor.py Outdated
Comment thread homeassistant/components/playstation_network/binary_sensor.py Outdated
Comment thread homeassistant/components/playstation_network/strings.json Outdated
@home-assistant home-assistant Bot marked this pull request as draft June 26, 2025 22:48
@home-assistant
Copy link
Copy Markdown
Contributor

Please take a look at the requested changes, and use the Ready for review button when you are done, thanks 👍

Learn more about our pull request process.

Comment thread homeassistant/components/playstation_network/binary_sensor.py Outdated
Comment thread homeassistant/components/playstation_network/binary_sensor.py Outdated
Comment thread homeassistant/components/playstation_network/binary_sensor.py Outdated
Comment thread homeassistant/components/playstation_network/binary_sensor.py Outdated
Comment thread homeassistant/components/playstation_network/binary_sensor.py Outdated
Comment thread homeassistant/components/playstation_network/binary_sensor.py Outdated
Comment thread homeassistant/components/playstation_network/binary_sensor.py Outdated
Comment thread homeassistant/components/playstation_network/icons.json Outdated
@JackJPowell JackJPowell marked this pull request as ready for review June 27, 2025 19:17
@home-assistant home-assistant Bot requested review from joostlek and tr4nt0r June 27, 2025 19:17
Copy link
Copy Markdown
Contributor

@tr4nt0r tr4nt0r left a comment

Choose a reason for hiding this comment

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

Update also the sensor class to use the new base class
Edit: ok, just read you want to do it in a follow-up PR

Comment thread homeassistant/components/playstation_network/binary_sensor.py Outdated
Comment thread homeassistant/components/playstation_network/entity.py
Comment thread homeassistant/components/playstation_network/entity.py Outdated
Comment thread homeassistant/components/playstation_network/strings.json Outdated
Comment thread homeassistant/components/playstation_network/strings.json
Comment thread homeassistant/components/playstation_network/entity.py Outdated
@JackJPowell JackJPowell marked this pull request as draft July 1, 2025 01:32
@JackJPowell JackJPowell marked this pull request as ready for review July 4, 2025 21:15
@home-assistant home-assistant Bot requested a review from tr4nt0r July 4, 2025 21:15
@abmantis abmantis requested review from Copilot and removed request for tr4nt0r July 4, 2025 22:04
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

This PR adds the binary sensor platform to the PlayStation Network integration, providing subscription status as a binary sensor.
Key changes:

  • Introduced binary_sensor.py and a shared entity.py to DRY up sensor and binary sensor entities.
  • Updated __init__.py, strings.json, and icons.json to register and localize the new platform.
  • Added tests and snapshots for the PlayStation Plus subscription sensor.

Reviewed Changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
tests/components/playstation_network/test_binary_sensor.py New test for binary sensor setup
tests/components/playstation_network/snapshots/*.ambr Updated sensor snapshot and added binary sensor snapshot
homeassistant/components/playstation_network/strings.json Added translations for binary sensor
homeassistant/components/playstation_network/icons.json Added icons for binary sensors
homeassistant/components/playstation_network/entity.py Shared base entity class for service‐based entities
homeassistant/components/playstation_network/binary_sensor.py Binary sensor platform implementation
homeassistant/components/playstation_network/sensor.py Refactored to use shared base entity
homeassistant/components/playstation_network/init.py Registered BINARY_SENSOR platform
Comments suppressed due to low confidence (2)

tests/components/playstation_network/test_binary_sensor.py:17

  • There are no tests covering the 'online_status' binary sensor or the 'off' state for subscription. Add test cases for both states of each binary sensor.
@pytest.fixture(autouse=True)

tests/components/playstation_network/snapshots/test_sensor.ambr:223

  • [nitpick] The friendly name uses a hyphen ('Online-ID'), which is unconventional. Use a space ('Online ID') to follow American English style and typical entity naming conventions.
    'original_name': 'Online-ID',

Comment thread homeassistant/components/playstation_network/binary_sensor.py
Comment thread homeassistant/components/playstation_network/icons.json Outdated
@home-assistant home-assistant Bot marked this pull request as draft July 5, 2025 06:21
@JackJPowell JackJPowell marked this pull request as ready for review July 5, 2025 15:03
@home-assistant home-assistant Bot requested review from frenck and tr4nt0r July 5, 2025 15:03
Copy link
Copy Markdown
Member

@frenck frenck left a comment

Choose a reason for hiding this comment

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

Thanks, @JackJPowell 👍

../Frenck

@frenck frenck dismissed joostlek’s stale review July 5, 2025 15:27

Comment addressed

@frenck frenck merged commit 736865c into home-assistant:dev Jul 5, 2025
34 checks passed
@github-actions github-actions Bot locked and limited conversation to collaborators Jul 6, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants