Skip to content

Add GeneralDiagnostics sensors and fault binary sensors to Matter integration#169830

Draft
markvp wants to merge 1 commit intohome-assistant:devfrom
markvp:matter-general-diagnostics
Draft

Add GeneralDiagnostics sensors and fault binary sensors to Matter integration#169830
markvp wants to merge 1 commit intohome-assistant:devfrom
markvp:matter-general-diagnostics

Conversation

@markvp
Copy link
Copy Markdown

@markvp markvp commented May 5, 2026

Breaking change

N/A — all new entities are disabled by default and use EntityCategory.DIAGNOSTIC, so existing users see no change.

Proposed change

Expose Matter GeneralDiagnostics cluster data as entities (disabled by default). Currently this information is only accessible via the "Download Diagnostics" JSON dump.

New sensor entities (GeneralDiagnostics cluster):

  • Reboot count (RebootCount): Track device stability; a high reboot count may indicate a power supply issue, firmware bug, or failing hardware
  • Uptime (UpTime, seconds, SensorDeviceClass.DURATION): Detect unexpected restarts; useful for automations that alert when uptime drops below a threshold
  • Boot reason (BootReason): Distinguish intentional reboots (software update, software reset) from problematic ones (watchdog reset, brownout). Enum values: power_on_reboot, brown_out_reset, software_watchdog_reset, hardware_watchdog_reset, software_update_completed, software_reset

New binary sensor entities (GeneralDiagnostics cluster, BinarySensorDeviceClass.PROBLEM):

  • Hardware faults (ActiveHardwareFaults): Alert on active hardware problems (sensor failure, overheating, tamper)
  • Radio faults (ActiveRadioFaults): Detect wireless hardware issues (Wi-Fi, Thread, BLE, NFC radio faults)
  • Network faults (ActiveNetworkFaults): Alert on network-level issues (connection failure, network jammed)

All entities use entity_category=EntityCategory.DIAGNOSTIC and entity_registry_enabled_default=False.

Related PRs:

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:

…egration

Adds GeneralDiagnostics cluster sensors (RebootCount, UpTime, BootReason)
and binary sensors for active fault conditions (hardware, radio, network
faults). All entities are diagnostic category, disabled by default.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings May 5, 2026 11:05
@markvp markvp requested a review from a team as a code owner May 5, 2026 11:05
Copy link
Copy Markdown
Contributor

@home-assistant home-assistant Bot left a comment

Choose a reason for hiding this comment

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

There is a merge conflict.

@home-assistant home-assistant Bot added cla-signed has-tests integration: matter Top 100 Integration is ranked within the top 100 by usage Top 200 Integration is ranked within the top 200 by usage Top 50 Integration is ranked within the top 50 by usage labels May 5, 2026
@home-assistant home-assistant Bot marked this pull request as draft May 5, 2026 11:06
@home-assistant
Copy link
Copy Markdown
Contributor

home-assistant Bot commented May 5, 2026

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.

@home-assistant
Copy link
Copy Markdown
Contributor

home-assistant Bot commented May 5, 2026

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

Code owner commands

Code owners of matter can trigger bot actions by commenting:

  • @home-assistant close Closes the pull request.
  • @home-assistant mark-draft Mark the pull request as draft.
  • @home-assistant ready-for-review Remove the draft status from the pull request.
  • @home-assistant rename Awesome new title Renames the pull request.
  • @home-assistant reopen Reopen the pull request.
  • @home-assistant unassign matter Removes the current integration label and assignees on the pull request, add the integration domain after the command.
  • @home-assistant update-branch Update the pull request branch with the base branch.
  • @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
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 extends the Matter integration’s diagnostics coverage by exposing GeneralDiagnostics attributes as Home Assistant diagnostic entities, adding new sensors for reboot/uptime/boot reason and new problem binary sensors for active faults.

Changes:

  • Added GeneralDiagnostics sensor discovery entries for reboot count, uptime, and boot reason.
  • Added GeneralDiagnostics binary sensor discovery entries for active hardware, radio, and network faults.
  • Added localized entity strings and targeted tests for the new Matter diagnostics entities.

Reviewed changes

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

Show a summary per file
File Description
homeassistant/components/matter/sensor.py Adds Matter sensor schemas and boot-reason enum mapping for GeneralDiagnostics.
homeassistant/components/matter/binary_sensor.py Adds diagnostic problem binary sensors for active fault lists.
homeassistant/components/matter/strings.json Adds entity names and boot-reason state translations.
tests/components/matter/test_sensor.py Adds targeted tests for reboot count, uptime, and boot reason sensors.
tests/components/matter/test_binary_sensor.py Adds targeted tests for active fault binary sensors.

Comment on lines +139 to +147
BOOT_REASON_MAP = {
clusters.GeneralDiagnostics.Enums.BootReasonEnum.kUnspecified: None,
clusters.GeneralDiagnostics.Enums.BootReasonEnum.kPowerOnReboot: "power_on_reboot",
clusters.GeneralDiagnostics.Enums.BootReasonEnum.kBrownOutReset: "brown_out_reset",
clusters.GeneralDiagnostics.Enums.BootReasonEnum.kSoftwareWatchdogReset: "software_watchdog_reset",
clusters.GeneralDiagnostics.Enums.BootReasonEnum.kHardwareWatchdogReset: "hardware_watchdog_reset",
clusters.GeneralDiagnostics.Enums.BootReasonEnum.kSoftwareUpdateCompleted: "software_update_completed",
clusters.GeneralDiagnostics.Enums.BootReasonEnum.kSoftwareReset: "software_reset",
clusters.GeneralDiagnostics.Enums.BootReasonEnum.kUnknownEnumValue: None,
device_class=SensorDeviceClass.DURATION,
entity_category=EntityCategory.DIAGNOSTIC,
entity_registry_enabled_default=False,
state_class=SensorStateClass.MEASUREMENT,
Comment on lines +774 to +781
state = hass.states.get("binary_sensor.m5stamp_lighting_app_radio_faults")
assert state
assert state.state == "off"

# ActiveNetworkFaults (cluster 51, attr 7) = [] (no faults)
state = hass.states.get("binary_sensor.m5stamp_lighting_app_network_faults")
assert state
assert state.state == "off"
assert state is not None
assert state.state == "unknown"


assert state
assert state.state == "off"


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

Labels

cla-signed has-tests integration: matter Quality Scale: No score Top 50 Integration is ranked within the top 50 by usage Top 100 Integration is ranked within the top 100 by usage Top 200 Integration is ranked within the top 200 by usage

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants