Skip to content

Commit

Permalink
Improve Target Temperature feature handling
Browse files Browse the repository at this point in the history
  • Loading branch information
MizterB committed Jul 10, 2024
1 parent 82f71c3 commit 3652dfb
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 19 deletions.
36 changes: 19 additions & 17 deletions custom_components/proliphix_plus/climate.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,9 @@ def __init__(
def supported_features(self):
"""Return the supported features."""
features = ClimateEntityFeature.FAN_MODE | ClimateEntityFeature.PRESET_MODE
if self.proliphix.hvac_mode == PlxHVACMode.AUTO:
features = features | ClimateEntityFeature.TARGET_TEMPERATURE_RANGE
elif self.proliphix.hvac_mode in [PlxHVACMode.HEAT, PlxHVACMode.COOL]:
features = features | ClimateEntityFeature.TARGET_TEMPERATURE
features = features | ClimateEntityFeature.TARGET_TEMPERATURE_RANGE
features = features | ClimateEntityFeature.TARGET_TEMPERATURE

return features

@property
Expand All @@ -99,34 +98,37 @@ def current_temperature(self) -> float:
@property
def target_temperature(self) -> float:
"""Return the target temperature."""
target = self.proliphix.temperature_local
if self.proliphix.hvac_mode == PlxHVACMode.AUTO:
if self.proliphix.hvac_state in [
PlxHVACState.HEAT,
PlxHVACState.HEAT_2,
PlxHVACState.HEAT_3,
]:
target = self.proliphix.setback_heat
return self.proliphix.setback_heat
elif self.proliphix.hvac_state in [PlxHVACState.COOL, PlxHVACState.COOL_2]:
target = self.proliphix.setback_cool

if self.proliphix.hvac_mode == PlxHVACMode.HEAT:
target = self.proliphix.setback_heat

if self.proliphix.hvac_mode == PlxHVACMode.COOL:
target = self.proliphix.setback_cool

return target
return self.proliphix.setback_cool
elif self.proliphix.hvac_mode == PlxHVACMode.HEAT:
return self.proliphix.setback_heat
elif self.proliphix.hvac_mode == PlxHVACMode.COOL:
return self.proliphix.setback_cool
else:
return None

@property
def target_temperature_high(self) -> float:
"""Return the high target temperature."""
return self.proliphix.setback_cool
if self.proliphix.hvac_mode == PlxHVACMode.AUTO:
return self.proliphix.setback_cool
else:
return None

@property
def target_temperature_low(self) -> float:
"""Return the low target temperature."""
return self.proliphix.setback_heat
if self.proliphix.hvac_mode == PlxHVACMode.AUTO:
return self.proliphix.setback_heat
else:
return None

async def async_set_temperature(self, **kwargs):
"""Set new target temperature."""
Expand Down
4 changes: 2 additions & 2 deletions custom_components/proliphix_plus/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@
"requirements": [],
"ssdp": [],
"zeroconf": [],
"version": "2024.4.0"
}
"version": "2024.7.0"
}

0 comments on commit 3652dfb

Please sign in to comment.