mirror of
https://github.com/home-assistant/core.git
synced 2025-11-12 20:40:18 +00:00
Fix homekit_controller climate supported operation_list being blank (#23095)
* Fix tado supported operation modes when used with homekit_controller * Replace with list comp as requested in review * More list comps
This commit is contained in:
@@ -36,12 +36,12 @@ class HomeKitClimateDevice(HomeKitEntity, ClimateDevice):
|
||||
|
||||
def __init__(self, *args):
|
||||
"""Initialise the device."""
|
||||
super().__init__(*args)
|
||||
self._state = None
|
||||
self._current_mode = None
|
||||
self._valid_modes = []
|
||||
self._current_temp = None
|
||||
self._target_temp = None
|
||||
super().__init__(*args)
|
||||
|
||||
def get_characteristic_types(self):
|
||||
"""Define the homekit characteristics the entity cares about."""
|
||||
@@ -57,10 +57,26 @@ class HomeKitClimateDevice(HomeKitEntity, ClimateDevice):
|
||||
def _setup_heating_cooling_target(self, characteristic):
|
||||
self._features |= SUPPORT_OPERATION_MODE
|
||||
|
||||
valid_values = characteristic.get(
|
||||
'valid-values', DEFAULT_VALID_MODES)
|
||||
if 'valid-values' in characteristic:
|
||||
valid_values = [
|
||||
val for val in DEFAULT_VALID_MODES
|
||||
if val in characteristic['valid-values']
|
||||
]
|
||||
else:
|
||||
valid_values = DEFAULT_VALID_MODES
|
||||
if 'minValue' in characteristic:
|
||||
valid_values = [
|
||||
val for val in valid_values
|
||||
if val >= characteristic['minValue']
|
||||
]
|
||||
if 'maxValue' in characteristic:
|
||||
valid_values = [
|
||||
val for val in valid_values
|
||||
if val <= characteristic['maxValue']
|
||||
]
|
||||
|
||||
self._valid_modes = [
|
||||
MODE_HOMEKIT_TO_HASS.get(mode) for mode in valid_values
|
||||
MODE_HOMEKIT_TO_HASS[mode] for mode in valid_values
|
||||
]
|
||||
|
||||
def _setup_temperature_target(self, characteristic):
|
||||
|
||||
Reference in New Issue
Block a user