Skip to content

docs: Home Assistant integration guide for MQTT diagnostics#46

Merged
eman merged 1 commit intomainfrom
docs/mqtt-ha-integration
Dec 8, 2025
Merged

docs: Home Assistant integration guide for MQTT diagnostics#46
eman merged 1 commit intomainfrom
docs/mqtt-ha-integration

Conversation

@eman
Copy link
Copy Markdown
Owner

@eman eman commented Dec 8, 2025

Description

Adds comprehensive documentation for integrating MQTT diagnostics into Home Assistant custom components.

What's included

  • Integration pattern with MqttDiagnosticsCollector
  • Storage recommendation: Home Assistant config directory (not data store or logs)
  • Comparison of storage options with trade-offs explained
  • Integration with Home Assistant diagnostics protocol
  • Minimal working example of HA component setup
  • Periodic export schedule pattern

Motivation

Helps Home Assistant custom component developers understand best practices for exposing MQTT diagnostics to users. Provides guidance on where to store diagnostic data and how to integrate with HA's native diagnostics system.

Testing

Documentation only - no functional changes required.

…diagnostics

- Add comprehensive section on integrating MqttDiagnosticsCollector into HA custom components
- Recommend saving diagnostics to Home Assistant config directory vs. alternatives
- Explain trade-offs: config dir (recommended) vs. data store, logs, and separate files
- Include integration pattern with HA diagnostics protocol
- Provide minimal working example of HA component with integrated diagnostics
- Add periodic export schedule pattern for production components
@eman eman force-pushed the docs/mqtt-ha-integration branch from 506ac86 to aaf5cce Compare December 8, 2025 20:18
@eman eman requested a review from Copilot December 8, 2025 20:23
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 comprehensive documentation for MQTT diagnostics functionality, helping developers integrate connection monitoring into their applications, particularly Home Assistant custom components.

Key changes:

  • Introduces MqttDiagnosticsCollector for tracking connection drops, recoveries, and metrics
  • Provides storage guidance for Home Assistant integrations (config directory vs. data store/logs)
  • Includes complete working example demonstrating diagnostics collection over a 1-hour period

Reviewed changes

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

File Description
src/nwp500/mqtt_diagnostics.py New diagnostics collector module with connection tracking, metrics aggregation, and JSON export capabilities
src/nwp500/__init__.py Exports diagnostic classes for public API access
examples/mqtt_diagnostics_example.py Working example showing diagnostics integration with periodic exports and event handling
docs/MQTT_DIAGNOSTICS.rst Comprehensive guide covering diagnostics integration, troubleshooting patterns, and Home Assistant integration best practices

@eman eman merged commit 2a285cf into main Dec 8, 2025
10 checks passed
@eman eman deleted the docs/mqtt-ha-integration branch December 8, 2025 20:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants