Skip to content

Add hvac_action property to climate entity - #154

Merged
lnagel merged 2 commits into
mainfrom
claude/hvac-action-mapping-QQ4gI
Jan 18, 2026
Merged

Add hvac_action property to climate entity#154
lnagel merged 2 commits into
mainfrom
claude/hvac-action-mapping-QQ4gI

Conversation

@lnagel

@lnagel lnagel commented Jan 18, 2026

Copy link
Copy Markdown
Owner

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.

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

codecov Bot commented Jan 18, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.46%. Comparing base (882bcdf) to head (261bc10).
⚠️ Report is 2 commits behind head on main.
✅ All tests successful. No failed tests found.

Additional details and impacted files

Impacted file tree graph

@@            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              
Files with missing lines Coverage Δ
custom_components/komfovent/climate.py 94.82% <100.00%> (+0.95%) ⬆️

@lnagel
lnagel merged commit c50946d into main Jan 18, 2026
7 checks passed
@lnagel
lnagel deleted the claude/hvac-action-mapping-QQ4gI branch January 18, 2026 09:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants