Repository navigation
Conversation
- REQUEST_TIMEOUT 5s -> 10s: slow meters (or event-loop stalls on the HA host) regularly exceeded 5s and flipped every entity unavailable. - FAILURE_THRESHOLD = 2: a single failed poll now keeps the last data instead of marking all entities unavailable; entities only go unavailable after two consecutive failures.
Newer firmware advertises the device as "BITUO TECHNIK-<model>-<sn>" instead of "EnergySensor-<model>-<sn>"; the previous filter only matched "energysensor" and silently ignored those devices.
Firmware 5.1.10 stopped reporting the TotalEnergy{phase} and
TotalEnergy fields, so the corresponding entities vanished.
Derive them from forward/reverse energy (native or synthesized);
firmware-provided values always win.
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
This PR makes the integration reliable as an always-on Home Assistant polling integration, and restores compatibility with two breaking environment changes: Home Assistant 2026.7 (zeroconf import moved) and device firmware ≥ 5.1.10 (aggregate fields removed from the payload).
It is based on the optimized line I have been running in production against five devices (SPM02-class three-phase meters) for several weeks.
Fixes
Total*/Average*aggregates, so those entities silently disappeared.normalize_meter_data()now synthesizes them from per-phase X/Y/Z values (TotalActivePower,TotalReactivePower,TotalApparentPower,TotalCurrent,TotalForwardEnergy,TotalReverseEnergy,TotalEnergy{phase},TotalEnergy,AverageVoltageLN,AverageLineCurrent). Firmware-provided values always win; a partial phase set never fabricates a total.BITUO TECHNIK-<model>-<sn>instead ofEnergySensor-<model>-<sn>; the previous filter only matchedenergysensorand silently ignored those devices.async_add_executor_job).FAILURE_THRESHOLD), and missing values reportunavailableinstead of a bogus0.async_unload_entrycleans up entry state;set_frequencyapplies to the target device or all devices.Structure
api.py(BituoApiClient), polling intocoordinator.py(DataUpdateCoordinator), pure payload logic intohelpers.pywith unit tests.tests/(helpers normalization, repository privacy guard) and a CI workflow running them.__pycache__files removed;.gitignoreadded.Notes for the maintainer
manifest.jsoncurrently pointsdocumentation/issue_trackerat my fork; happy to revert those to this repo before merge.python3 -m unittest discover -s tests— 7 tests pass;compileallclean.