Add defrosting to climate entity (#2240)

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Co-authored-by: Franck Nijhof <git@frenck.dev>
This commit is contained in:
G Johansson 2024-07-07 18:54:51 +02:00 committed by GitHub
parent 1d2df8b0e7
commit f65f3fef94
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 28 additions and 0 deletions

View File

@ -0,0 +1,27 @@
---
author: G Johansson
authorURL: https://github.com/gjohansson-ST
title: "New HVACAction DEFROSTING"
---
The `ClimateEntity` has an `hvac_action` property, which describes what the climate entity is currently doing (which is not the same as its mode).
We have added `DEFROSTING` as a possible `HVACAction` to represent when an entity is currently defrosting.
Defrosting is when the system runs in reverse for some time to melt down accumulated ice. It occurs typically in colder environments and should not be mixed with, for example, cars that are defrosting by heating their windows.
```python
from homeassistant.components.climate.const import HVACAction
class MyClimateEntity(ClimateEntity):
"""Implementation of my climate entity."""
def hvac_action(self) -> HVACAction | None:
"""Return the current running hvac operation if supported."""
return HVACAction.DEFROSTING
```
More details can be found in the [climate entity documentation](/docs/core/entity/climate#hvac-action)
Background for the original change is in [architecture discussion #1090](https://github.com/home-assistant/architecture/discussions/1090).

View File

@ -65,6 +65,7 @@ The HVAC action describes the _current_ action. This is different from the mode,
| `HVACAction.DRYING` | Device is drying. |
| `HVACAction.FAN` | Device has fan on. |
| `HVACAction.IDLE` | Device is idle. |
| `HVACAction.DEFROSTING` | Device is defrosting. |
### Presets