Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 10 additions & 5 deletions custom_components/gree_custom/climate.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
from homeassistant.helpers.restore_state import RestoreEntity
from homeassistant.util.unit_conversion import TemperatureConverter

from .aiogree.api import FanSpeed, HorizontalSwingMode, VerticalSwingMode
from .aiogree.api import FanSpeed, GreeProp, HorizontalSwingMode, VerticalSwingMode
from .aiogree.const import MAX_TEMP_C, MAX_TEMP_F, MIN_TEMP_C, MIN_TEMP_F
from .aiogree.errors import GreeTurboUnavailable
from .const import (
Expand Down Expand Up @@ -125,7 +125,7 @@ async def async_setup_entry(
_LOGGER.info(
"Climate Entity will not be created because no Climate options and features are available for the device"
)
return
continue

_LOGGER.debug(
"Adding Climate Entity for device '%s'",
Expand Down Expand Up @@ -196,9 +196,10 @@ def __init__(
if any(mode != HVACMode.OFF for mode in hvac_modes):
self._attr_supported_features |= ClimateEntityFeature.TURN_ON

# Only offer a target temperature when the unit has one.
if any(
mode in hvac_modes for mode in (HVACMode.HEAT, HVACMode.COOL, HVACMode.AUTO)
):
) and self.device.supports_property(GreeProp.TARGET_TEMPERATURE):
self._attr_supported_features |= ClimateEntityFeature.TARGET_TEMPERATURE

if fan_modes:
Expand All @@ -207,13 +208,17 @@ def __init__(
else:
self._attr_fan_modes = None

if swing_modes:
# The options form leaves the swing lists out for a unit without swing,
# and the defaults would then add swing anyway.
if swing_modes and self.device.supports_property(GreeProp.SWING_VERTICAL):
self._attr_supported_features |= ClimateEntityFeature.SWING_MODE
self._attr_swing_modes = swing_modes
else:
self._attr_swing_modes = None

if swing_horizontal_modes:
if swing_horizontal_modes and self.device.supports_property(
GreeProp.SWING_HORIZONTAL
):
self._attr_supported_features |= ClimateEntityFeature.SWING_HORIZONTAL_MODE
self._attr_swing_horizontal_modes = swing_horizontal_modes
else:
Expand Down
4 changes: 2 additions & 2 deletions docs/entities.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ The main entity. Its name is the device name.
| Part | What it does |
|---|---|
| HVAC mode | Auto, Cool, Dry, Fan only, Heat, Off. You choose the list at setup. Off turns the unit off, every other mode turns it on. |
| Target temperature | 16 to 30 degrees C, or 61 to 86 degrees F. Available when Heat, Cool or Auto is in the mode list. The step is the **Temperature Step** option. In Auto mode the unit uses its own factory setting, so a temperature sent with Auto is ignored and logged as a warning. |
| Target temperature | 16 to 30 degrees C, or 61 to 86 degrees F. Available when Heat, Cool or Auto is in the mode list and the unit has a target temperature. The step is the **Temperature Step** option. In Auto mode the unit uses its own factory setting, so a temperature sent with Auto is ignored and logged as a warning. |
| Current temperature | The unit's room sensor, converted to the unit's temperature scale. Replaced by the **External Temperature Sensor** when one is set. That changes only what Home Assistant shows; the unit keeps regulating on its own sensor. |
| Current humidity | The unit's humidity sensor, when it has one. Replaced by the **External Humidity Sensor** when one is set. Display only, like the temperature. |
| Fan mode | Auto, Low, Medium-Low, Medium, Medium-High, High, plus Turbo and Quiet when the unit has them. See below. |
| Swing mode | Vertical positions and swing ranges. |
| Swing mode | Vertical positions and swing ranges, when the unit has vertical swing. |
| Horizontal swing mode | Horizontal positions and swing ranges, when the unit has them. |

Extra attribute: `current_outside_temperature`, the outdoor sensor value in the unit's temperature scale, when the unit has an outdoor sensor. Read it with `{{ state_attr('climate.your_ac', 'current_outside_temperature') }}`.
Expand Down
Loading