Add GeneralDiagnostics sensors and fault binary sensors to Matter integration#169830
Draft
markvp wants to merge 1 commit intohome-assistant:devfrom
Draft
Add GeneralDiagnostics sensors and fault binary sensors to Matter integration#169830markvp wants to merge 1 commit intohome-assistant:devfrom
markvp wants to merge 1 commit intohome-assistant:devfrom
Conversation
…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>
Contributor
|
Please take a look at the requested changes, and use the Ready for review button when you are done, thanks 👍 |
Contributor
|
Hey there @home-assistant/matter, mind taking a look at this pull request as it has been labeled with an integration ( Code owner commandsCode owners of
|
21 tasks
Contributor
There was a problem hiding this comment.
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
GeneralDiagnosticssensor discovery entries for reboot count, uptime, and boot reason. - Added
GeneralDiagnosticsbinary 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" | ||
|
|
||
|
|
21 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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):
RebootCount): Track device stability; a high reboot count may indicate a power supply issue, firmware bug, or failing hardwareUpTime, seconds,SensorDeviceClass.DURATION): Detect unexpected restarts; useful for automations that alert when uptime drops below a thresholdBootReason): 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_resetNew binary sensor entities (GeneralDiagnostics cluster,
BinarySensorDeviceClass.PROBLEM):ActiveHardwareFaults): Alert on active hardware problems (sensor failure, overheating, tamper)ActiveRadioFaults): Detect wireless hardware issues (Wi-Fi, Thread, BLE, NFC radio faults)ActiveNetworkFaults): Alert on network-level issues (connection failure, network jammed)All entities use
entity_category=EntityCategory.DIAGNOSTICandentity_registry_enabled_default=False.Related PRs:
Type of change
Additional information
Checklist
ruff format homeassistant tests)If user exposed functionality or configuration variables are added/changed:
If the code communicates with devices, web services, or third-party tools:
Updated and included derived files by running:
python3 -m script.hassfest.requirements_all.txt.Updated by running
python3 -m script.gen_requirements_all.To help with the load of incoming pull requests: