Skip to content

Add sensor platform to Arcam FMJ#165271

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

Add sensor platform to Arcam FMJ#165271
jgus wants to merge 4 commits intohome-assistant:devfrom
jgus:arcam-sensor

Conversation

@jgus
Copy link
Contributor

@jgus jgus commented Mar 10, 2026

Add incoming video and audio diagnostic sensors for each zone (resolution, refresh rate, aspect ratio, colorspace, audio format, audio config, sample rate), disabled by default.

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

Proposed change

Add sensors that describe the properties of the incoming media.

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:

  • [x 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 and audio diagnostic sensors for each zone
(resolution, refresh rate, aspect ratio, colorspace, audio format,
audio config, sample rate), disabled by default.

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

PR Overview

This PR adds a new sensor platform to the Arcam FMJ integration. It introduces 8 diagnostic sensors per zone (16 total for zones 1 and 2), all disabled by default, exposing incoming video and audio stream properties: horizontal/vertical resolution, refresh rate, aspect ratio, colorspace, audio format, audio config, and audio sample rate.

Changes:

  • New sensor.py implementing diagnostic sensors for incoming video/audio parameters per zone, backed by the ArcamFmjCoordinator
  • Updated __init__.py to add Platform.SENSOR to the PLATFORMS list
  • Updated strings.json with entity names using Zone {zone} placeholders for all 8 sensor types
  • New test_sensor.py with tests covering sensor creation, value reading, None handling, and coordinator lifecycle (connected/disconnected)

Reviewed changes

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

File Description
homeassistant/components/arcam_fmj/sensor.py New sensor platform with 8 diagnostic sensor entity descriptions and the ArcamFmjSensorEntity class
homeassistant/components/arcam_fmj/__init__.py Adds Platform.SENSOR to the PLATFORMS list to enable sensor setup
homeassistant/components/arcam_fmj/strings.json Adds entity name translations for all 8 new sensor types using {zone} placeholder
tests/components/arcam_fmj/test_sensor.py New test file covering sensor creation, value updates, None handling, and availability lifecycle

@home-assistant home-assistant bot marked this pull request as draft March 10, 2026 15:17
@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.

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

@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 checks for video/audio parameters
- Use SensorDeviceClass.ENUM for aspect ratio, colorspace, audio format
  and audio config sensors with snake_case options and translations
- Fix audio format None handling to prevent IndexError
- Use coordinator.state instead of cached self._state for native_value
- Use entity_registry_enabled_by_default fixture in tests
- Replace runtime_data access in tests with coordinator fixtures
- Add test coverage for audio None values
- 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:47
Copilot AI review requested due to automatic review settings March 10, 2026 17:47
@jgus
Copy link
Contributor Author

jgus commented Mar 10, 2026

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

@joostlek With your merge of #165232, I see follow-up comments on that as something that should be done, but unrelated to these changes and therefore not something that should block this PR. Your thoughts?

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 1 comment.

@joostlek
Copy link
Member

Looking at the comments I think this might be a "pls fix otherwise we might need to revert that PR" type of situation.

I already gave one of the PRs a review, I think we should fix the issues raised before merging these ultimately

@epenet epenet marked this pull request as draft March 10, 2026 18:10
@jgus jgus marked this pull request as ready for review March 10, 2026 19:15
Copilot AI review requested due to automatic review settings March 10, 2026 19:15
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.

…nsor

# 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

@home-assistant home-assistant bot marked this pull request as draft March 10, 2026 19:33
jgus pushed a commit to jgus/home-assistant.io that referenced this pull request Mar 10, 2026
Documents the new diagnostic sensor entities added in
home-assistant/core#165271, covering incoming video properties
(resolution, refresh rate, aspect ratio, colorspace) and incoming
audio properties (format, configuration, sample rate) per zone.

https://claude.ai/code/session_01UnZxkNbBAS818QEdWU4qXh
@jgus jgus marked this pull request as ready for review March 10, 2026 21:03
Copilot AI review requested due to automatic review settings March 10, 2026 21:03
@home-assistant home-assistant bot requested a review from epenet March 10, 2026 21:03
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.

jgus pushed a commit to jgus/home-assistant.io that referenced this pull request Mar 10, 2026
Documents the new diagnostic sensor entities added in
home-assistant/core#165271, covering incoming video properties
(resolution, refresh rate, aspect ratio, colorspace) and incoming
audio properties (format, configuration, sample rate) per zone.

https://claude.ai/code/session_01UnZxkNbBAS818QEdWU4qXh
@jgus
Copy link
Contributor Author

jgus commented Mar 10, 2026

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

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.

Correct PR status

@home-assistant home-assistant bot marked this pull request as draft March 11, 2026 05:46

entity_description: ArcamFmjSensorEntityDescription
_attr_has_entity_name = True
_attr_entity_registry_enabled_default = False
Copy link
Contributor

Choose a reason for hiding this comment

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

It does not make sense to have these all disabled by default. the state update will have read them from device already so we gain little from disabling them.

Copy link
Contributor

Choose a reason for hiding this comment

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

It could make sense to disable all that is part of zone 2 or higher.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I agree, and that was my first choice. Someone - I thought you 😅 requested that these all be disabled, when I made my first pass at this like a year ago. Happy to enable them by default though

}
},
"incoming_audio_format": {
"name": "Zone {zone} incoming audio format",
Copy link
Contributor

Choose a reason for hiding this comment

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

We can drop these zone prefixes for entities now. I changed so the secondary zone ends up on a sub device instead.

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.

5 participants