Skip to content

Make the HVAC action sensor an enum sensor with options - #1013

Open
zigpy-review-bot wants to merge 1 commit into
devfrom
zigpy-bot/issue-1012-hvac-action-enum
Open

zigpy-review-bot wants to merge 1 commit into
devfrom
zigpy-bot/issue-1012-hvac-action-enum

Conversation

@zigpy-review-bot

Copy link
Copy Markdown
Collaborator

Summary

The thermostat HVAC action sensor (ThermostatHVACAction, and SinopeHVACAction which subclasses it) reported HVACAction string states but was a plain sensor, so Home Assistant didn't know the possible states. It is now an enum sensor whose options are the HVACAction values (cooling, defrosting, drying, fan, heating, idle, off, preheating).

Fixes #1012

Changes

  • ThermostatHVACAction gets SensorDeviceClass.ENUM and an options property, and exposes them through EnumSensorState. EnumSensor isn't reused as a base because its options are enum names and its formatter maps ints to names; the options here are the lowercase values.
  • The sensor has no state class, so the device class change doesn't affect long-term statistics. No HA Core change is needed beyond the zha bump.
  • The 81 device snapshots containing this entity are regenerated; the only diff is device_class: null → "enum" and the added options list.

Testing

  • Added assertions on the device class and options to test_climate_hvac_action_running_state.
  • Full test suite and pre-commit (incl. mypy) pass.
  • One Opus review round (no code findings; the shared class-level options list was copied per read); no Copilot pass.

Set the ENUM device class and expose the HVACAction values as options on ThermostatHVACAction (and SinopeHVACAction), so Home Assistant knows the possible states.
@codecov

codecov Bot commented Nov 9, 2026

Copy link
Copy Markdown

Codecov Report

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

Additional details and impacted files
@@           Coverage Diff           @@
##              dev    #1013   +/-   ##
=======================================
  Coverage   97.48%   97.49%           
=======================================
  Files          61       61           
  Lines       10870    10878    +8     
=======================================
+ Hits        10597    10605    +8     
  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

new feature Adds new feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Make the HVAC action sensor an enum sensor with options

1 participant