Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change VTherm temperature unit to HA's preferred unit. #461

Merged
merged 3 commits into from
Jun 10, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
7 changes: 2 additions & 5 deletions custom_components/versatile_thermostat/thermostat_climate.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ async def _send_regulated_temperature(self, force=False):
# regulation can use the device_temp
self.auto_regulation_use_device_temp
# and we have access to the device temp
and (device_temp := under.underlying_current_temperature) is not None
and (device_temp := self._hass.states.get(under._entity_id).attributes.get("current_temperature")) is not None
jmcollin78 marked this conversation as resolved.
Show resolved Hide resolved
# and target is not reach (ie we need regulation)
and (
(
Expand Down Expand Up @@ -900,10 +900,7 @@ def swing_modes(self) -> list[str] | None:
@property
def temperature_unit(self) -> str:
"""Return the unit of measurement."""
if self.underlying_entity(0):
return self.underlying_entity(0).temperature_unit

return self._unit
return self.hass.config.units.temperature_unit

@property
def supported_features(self):
Expand Down
4 changes: 2 additions & 2 deletions custom_components/versatile_thermostat/underlyings.py
Original file line number Diff line number Diff line change
Expand Up @@ -731,8 +731,8 @@ def cap_sent_value(self, value) -> float:
self._underlying_climate.min_temp is not None
and self._underlying_climate is not None
):
min_val = self._underlying_climate.min_temp
max_val = self._underlying_climate.max_temp
min_val = self._hass.states.get(self._entity_id).attributes.get("min_temp")
max_val = self._hass.states.get(self._entity_id).attributes.get("max_temp")
jmcollin78 marked this conversation as resolved.
Show resolved Hide resolved

new_value = max(min_val, min(value, max_val))
else:
Expand Down
Loading