Add hvac_action property to climate entity - #154
Merged
Conversation
Implement hvac_action property that reports the current operating state of the device using native Modbus status register (REG_STATUS) bitmasks. Maps HVAC actions based on priority: - OFF: Device power is off (REG_POWER = 0) - HEATING: Heating bit is set (BITMASK_HEATING) - COOLING: Cooling bit is set (BITMASK_COOLING) - FAN: Fan bit is set (BITMASK_FAN) - IDLE: Device is on but no active operations The implementation reuses existing bitmask constants from binary_sensor.py and requires no additional Modbus reads since REG_STATUS is already fetched by the coordinator. Tests cover all action states, priority handling, and edge cases.
Replace ternary operator with explicit if statement for FAN check to improve code readability. IDLE remains the clear fallback when device is on but no heating/cooling/fan operations are active. Add noqa comment to suppress too-many-returns linter warning since the explicit return pattern is most readable for this state machine.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #154 +/- ##
==========================================
+ Coverage 90.33% 90.46% +0.13%
==========================================
Files 18 18
Lines 1314 1332 +18
Branches 127 133 +6
==========================================
+ Hits 1187 1205 +18
Misses 95 95
Partials 32 32
|
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.
Implement hvac_action property that reports the current operating state
of the device using native Modbus status register (REG_STATUS) bitmasks.
Maps HVAC actions based on priority:
The implementation reuses existing bitmask constants from binary_sensor.py
and requires no additional Modbus reads since REG_STATUS is already
fetched by the coordinator.
Tests cover all action states, priority handling, and edge cases.