feat: power input methods — docs, staleness, HW energy, manual IP, diagnostics (#71-#75)#86
Merged
basmeerman merged 6 commits intomasterfrom Mar 19, 2026
Merged
feat: power input methods — docs, staleness, HW energy, manual IP, diagnostics (#71-#75)#86basmeerman merged 6 commits intomasterfrom
basmeerman merged 6 commits intomasterfrom
Conversation
Create docs/power-input-methods.md covering all 5 metering methods (Modbus RTU, Sensorbox, HomeWizard P1, Battery MQTT, API/MQTT feed) with reliability ranking, decision tree, per-method setup guides, comparison table, migration guide, and troubleshooting. Add cross-references from README.md, configuration.md, and installation.md. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Add staleness detection for API metering mode (type 9). When no update arrives within the configurable timeout (default 120s), all phases fall back to MaxMains as a safe default — charging continues at safe limits instead of stopping with CT_NOCOMM. When staleness detection is enabled, CT_NOCOMM is suppressed for API mode. New MQTT command: Set/MainsMeterTimeout (0=disabled, 10-3600 seconds) New ctx fields: api_mains_staleness_timer, api_mains_timeout, api_mains_stale 12 new tests covering countdown, fallback, recovery, suppression, and parser Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Extend getMainsFromHomeWizardP1() to parse total_power_import_kwh and total_power_export_kwh from the P1 API response, converting kWh to Wh. Energy data is now set on MainsMeter.Import_active_energy and Export_active_energy, making it available for the HA energy dashboard via existing MQTT publishing. Return type changed from std::pair to HomeWizardP1Result struct for cleaner interface. JSON filter and doc sizes increased to accommodate the two additional fields. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Add Set/HomeWizardIP MQTT command to bypass mDNS discovery. When set, discoverHomeWizardP1() returns the manual IP directly instead of doing mDNS lookup. Send empty payload to re-enable mDNS. This fixes intermittent mDNS failures on networks with mDNS-unfriendly routers or VLAN isolation. Also adds dispatch cases for MQTT_CMD_MAINS_METER_TIMEOUT and MQTT_CMD_HOMEWIZARD_IP in the MQTT command switch in esp32.cpp. 3 new MQTT parser tests (valid IP, empty/clear, too long). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Add per-method diagnostic counters to track metering health: - meter_timeout_count: CT_NOCOMM timeout events - meter_recovery_count: CT_NOCOMM recovery events - api_stale_count: API staleness detection events Counters are incremented in evse_tick_1s, published via MQTT as diagnostic entities with HA discovery (total_increasing state class, disabled by default). MQTT_CACHE_MAX_SLOTS bumped from 84 to 88. 7 new tests in test_metering_diagnostics.c covering init, increment, cumulative, recovery, and suppression scenarios. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Combine plan-09 additions (staleness, HomeWizard IP) with plan-06 additions (diag_profile, diag_telemetry) in mqtt_parser.h, esp32.cpp, and Makefile. All 43 test suites pass, both firmware builds succeed. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
3 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.
Summary
docs/power-input-methods.md)total_power_import_kwh/total_power_export_kwhfrom the P1 API for HA energy dashboardSet/HomeWizardIPMQTT command bypasses mDNS for networks where discovery is unreliableMeterTimeoutCount,MeterRecoveryCount,ApiStaleCountpublished as HA diagnostic entitiesTest plan
Closes #71, closes #72, closes #73, closes #74, closes #75
🤖 Generated with Claude Code