Skip to content

Name the heat and cooling meter status bit 7 FLOW_SENSOR - #1065

Open
zigpy-review-bot wants to merge 1 commit into
devfrom
zigpy-bot/audit/heat-meter-status-flow-sensor-bit
Open

zigpy-review-bot wants to merge 1 commit into
devfrom
zigpy-bot/audit/heat-meter-status-flow-sensor-bit

Conversation

@zigpy-review-bot

Copy link
Copy Markdown
Collaborator

Summary

Severity: low (the audit's estimate)

For heat and cooling meters, Smart Energy 1.4a (Table D-19) defines bit 7 of the Metering Status attribute as a flow sensor error, but ZHA reports it as REVERSE_FLOW, the bit's meaning for gas and water meters only. A heat meter with a faulty flow sensor then shows REVERSE_FLOW in the status attribute of its metering sensors.

Changes

  • DeviceStatusHeatingCooling.REVERSE_FLOW is renamed to FLOW_SENSOR. Gas and water meters keep REVERSE_FLOW.
  • async_test_metering checks that status 128 on a heat meter (metering_device_type 5) reads FLOW_SENSOR.

The value is an extra state attribute, so an automation matching REVERSE_FLOW on a heat or cooling meter would need the new name.

Testing

  • The new check fails at 2da1a5b ('REVERSE_FLOW' == 'FLOW_SENSOR') and passes with the fix.
  • tests/test_sensor.py: 108 passed. pre-commit (codespell, ruff, ruff format, mypy) passes.

Opened by the scheduled code audit; not requested by a maintainer.

Fixes #1064

Smart Energy 1.4a names bit 7 of the Metering Status attribute "Flow
Sensor" for heat and cooling meters (an error on a flow sensor); it is
"Reverse Flow" only for gas and water meters. ZHA reported it as
REVERSE_FLOW for heat and cooling meters too.
@zigpy-review-bot zigpy-review-bot added bot: code audit Found by the bot's scheduled code audit bot: unrequested PR PR: opened by the bot's issue triage, not requested by a maintainer bugfix This PR fixes a bug bot-watch: fix zigpy-review-bot follows this thread and also pushes fixes (review + fix) labels Nov 23, 2026
@codecov

codecov Bot commented Nov 23, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.48%. Comparing base (2da1a5b) to head (5c7d1ea).

Additional details and impacted files
@@           Coverage Diff           @@
##              dev    #1065   +/-   ##
=======================================
  Coverage   97.48%   97.48%           
=======================================
  Files          61       61           
  Lines       10870    10870           
=======================================
  Hits        10597    10597           
  Misses        273      273           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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

Labels

bot: code audit Found by the bot's scheduled code audit bot: unrequested PR PR: opened by the bot's issue triage, not requested by a maintainer bot-watch: fix zigpy-review-bot follows this thread and also pushes fixes (review + fix) bugfix This PR fixes a bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Heat and cooling meter status reports a flow sensor error as REVERSE_FLOW

1 participant