Skip to content

Commit 7692069

Browse files
authored
Merge pull request #163 from FotoFieber/main
Fix preset-only entity detection relying on current_temperature
2 parents 197b25a + 0cae78c commit 7692069

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

custom_components/climate_scheduler/coordinator.py

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -344,9 +344,9 @@ def _time_to_minutes(time_str: str) -> int:
344344
swing_modes = state.attributes.get("swing_modes", [])
345345
preset_modes = state.attributes.get("preset_modes", [])
346346

347-
# Check if this is a preset-only entity
348-
current_temperature = state.attributes.get("current_temperature")
349-
is_preset_only = current_temperature is None
347+
# Check if this entity supports target temperature (feature bit 0 -> value 1)
348+
supported_features = state.attributes.get("supported_features", 0)
349+
is_preset_only = not bool(supported_features & 1)
350350

351351
# Apply the next node settings
352352
target_hvac_mode = next_node.get("hvac_mode")
@@ -941,19 +941,18 @@ async def _async_update_data(self) -> Dict[str, Any]:
941941
current_target = state.attributes.get("temperature")
942942
_LOGGER.info(f"{entity_id} current target: {current_target}°C")
943943

944-
# Check if this is a preset-only entity (no current_temperature sensor)
945-
current_temperature = state.attributes.get("current_temperature")
946-
is_preset_only = current_temperature is None
947-
if is_preset_only:
948-
_LOGGER.info(f"{entity_id} is preset-only (no current_temperature), will skip temperature changes")
949-
950944
# Get entity capabilities
951945
supported_features = state.attributes.get("supported_features", 0)
952946
hvac_modes = state.attributes.get("hvac_modes", [])
953947
fan_modes = state.attributes.get("fan_modes", [])
954948
swing_modes = state.attributes.get("swing_modes", [])
955949
preset_modes = state.attributes.get("preset_modes", [])
956950

951+
# Check if this entity supports target temperature (feature bit 0 -> value 1)
952+
is_preset_only = not bool(supported_features & 1)
953+
if is_preset_only:
954+
_LOGGER.info(f"{entity_id} is preset-only (supported_features={supported_features}), will skip temperature changes")
955+
957956
# Check if we're turning off - apply mode first
958957
target_hvac_mode = active_node.get("hvac_mode")
959958
_LOGGER.info(f"{entity_id} target_hvac_mode: {target_hvac_mode}, supported modes: {hvac_modes}")

0 commit comments

Comments
 (0)