Skip to content

Add binary sensor platform to Arcam FMJ#165272

Draft
jgus wants to merge 3 commits intohome-assistant:devfrom
jgus:arcam-binary-sensor
Draft

Add binary sensor platform to Arcam FMJ#165272
jgus wants to merge 3 commits intohome-assistant:devfrom
jgus:arcam-binary-sensor

Conversation

@jgus
Copy link
Contributor

@jgus jgus commented Mar 10, 2026

Add incoming video interlaced binary sensor for each zone, disabled by default, using the coordinator pattern.

This is a breakdown of #165098 per request, a follow-up to #165232, and sibling to #165271

Proposed change

Add a binary sensor that indicated whether the incoming video is interlaced

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

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

Add incoming video interlaced binary sensor for each zone,
disabled by default, using the coordinator pattern.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@home-assistant
Copy link

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

Code owner commands

Code owners of arcam_fmj 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 arcam_fmj 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, problem in config, problem in device, feature-request) to the pull request.
  • @home-assistant remove-label needs-more-information Remove a label (needs-more-information, problem in dependency, problem in custom component, problem in config, problem in device, feature-request) on the pull request.

Copy link
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 Arcam FMJ binary sensor to expose whether the incoming video signal is interlaced (per zone), implemented via the coordinator pattern and disabled by default.

Changes:

  • Introduces a new binary_sensor platform with an incoming_video_interlaced entity per zone (disabled by default).
  • Adds entity translation strings for the new binary sensor.
  • Adds test coverage for creation, value states, and coordinator signal updates.

Reviewed changes

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

File Description
homeassistant/components/arcam_fmj/__init__.py Registers the new binary_sensor platform for config entry setup.
homeassistant/components/arcam_fmj/binary_sensor.py Implements coordinator-backed binary sensor entity for interlaced input video status.
homeassistant/components/arcam_fmj/strings.json Adds translated entity name template for the new binary sensor.
tests/components/arcam_fmj/test_binary_sensor.py Adds tests for entity creation, state mapping, and coordinator-driven updates.

Copy link
Contributor

@epenet epenet left a comment

Choose a reason for hiding this comment

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

Please keep in draft until post-review comments from #165232 have been addressed

@home-assistant home-assistant bot marked this pull request as draft March 10, 2026 15:32
@home-assistant
Copy link

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.

@jgus
Copy link
Contributor Author

jgus commented Mar 10, 2026

Please keep in draft until post-review comments from #165232 have been addressed

Do those comments actually block these changes? Or can we just as easily clean them up once all actual functionality is in?

- Replace getattr with direct None check for video parameters
- Use coordinator.state instead of cached self._state to avoid stale data
- Use entity_registry_enabled_by_default fixture in tests
- Replace runtime_data access in tests with coordinator fixtures
- Use state constants (STATE_ON, STATE_OFF, etc.) instead of raw strings
- Fix conftest mock defaults to use (None, None) for audio format

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@jgus jgus marked this pull request as ready for review March 10, 2026 17:49
Copilot AI review requested due to automatic review settings March 10, 2026 17:49
@home-assistant home-assistant bot requested a review from epenet March 10, 2026 17:49
@jgus
Copy link
Contributor Author

jgus commented Mar 10, 2026

@joostlek Applied your feedback from #165271 here as well, FYI.

Copy link
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 no new comments.

@epenet epenet marked this pull request as draft March 10, 2026 18:11
@jgus jgus marked this pull request as ready for review March 10, 2026 19:15
…nary-sensor

# Conflicts:
#	tests/components/arcam_fmj/conftest.py
Copy link
Contributor

@epenet epenet left a comment

Choose a reason for hiding this comment

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

You need to fix merge conflicts, and open documentation PR

@jgus
Copy link
Contributor Author

jgus commented Mar 10, 2026

@jgus jgus marked this pull request as ready for review March 10, 2026 21:54
Copilot AI review requested due to automatic review settings March 10, 2026 21:54
@home-assistant home-assistant bot requested a review from epenet March 10, 2026 21:54
Copy link
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 no new comments.

Comment on lines +157 to +172
@pytest.fixture(name="coordinator_1")
def coordinator_1_fixture(
hass: HomeAssistant, player_setup: str
) -> ArcamFmjCoordinator:
"""Get the coordinator for zone 1."""
config_entry = hass.config_entries.async_entries("arcam_fmj")[0]
return config_entry.runtime_data.coordinators[1]


@pytest.fixture(name="coordinator_2")
def coordinator_2_fixture(
hass: HomeAssistant, player_setup: str
) -> ArcamFmjCoordinator:
"""Get the coordinator for zone 2."""
config_entry = hass.config_entries.async_entries("arcam_fmj")[0]
return config_entry.runtime_data.coordinators[2]
Copy link
Contributor

Choose a reason for hiding this comment

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

Please remove these two fixtures.
You are using them to test internal and this is not allowed

Also, please keep one of the PRs in draft (eg. sensor) until the first one is merged (eg. binary_sensor)

@home-assistant home-assistant bot marked this pull request as draft March 11, 2026 05:45
Comment on lines +75 to +77
class ArcamFmjBinarySensorEntity(
CoordinatorEntity[ArcamFmjCoordinator], BinarySensorEntity
):
Copy link
Contributor

Choose a reason for hiding this comment

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

Some of the code is duplicated with the media_player entity.
I suggest that you create a new entity.py module with a new class ArcamFmjCoordinatorEntity:

  • it should set has_entity_name
  • it should call super().__init__(coordinator)
  • it should set device_info

You can do this inside this PR, or you can do it in a preliminary PR

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.

4 participants