Skip to content

Commit

Permalink
Reads proper unit of measurement from thermostats. Honeywell T6 Pro z…
Browse files Browse the repository at this point in the history
…-wave Thermostat #144 (#338)
  • Loading branch information
elahd authored Oct 25, 2023
1 parent 202df56 commit 22ac7f0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
9 changes: 6 additions & 3 deletions custom_components/alarmdotcom/climate.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
FAN_ON,
)
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import ATTR_TEMPERATURE, TEMP_FAHRENHEIT
from homeassistant.const import ATTR_TEMPERATURE, TEMP_CELSIUS, TEMP_FAHRENHEIT
from homeassistant.helpers.entity_platform import AddEntitiesCallback, DiscoveryInfoType
from pyalarmdotcomajax.devices.registry import AllDevices_t
from pyalarmdotcomajax.devices.thermostat import Thermostat as libThermostat
Expand Down Expand Up @@ -58,8 +58,6 @@ class Climate(HardwareBaseDevice, ClimateEntity): # type: ignore
_device_type_name: str = "Thermostat"
_device: libThermostat

_attr_temperature_unit = TEMP_FAHRENHEIT # Alarm.com always returns Fahrenheit, even when user profile is set to C. Conversion happens on frontend.

_raw_attribs: libThermostat.ThermostatAttributes

def __init__(
Expand Down Expand Up @@ -223,6 +221,11 @@ async def async_set_temperature(self, **kwargs) -> None: # type: ignore

def _determine_features(self) -> None:
"""Determine which features are available for thermostat."""
#
# UNIT OF MEASUREMENT
#

self._attr_temperature_unit = TEMP_CELSIUS if self._device.attributes.uses_celsius else TEMP_FAHRENHEIT

#
# SUPPORTED FEATURES
Expand Down
4 changes: 2 additions & 2 deletions custom_components/alarmdotcom/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@
"integration_type": "hub",
"iot_class": "cloud_polling",
"issue_tracker": "https://github.com/pyalarmdotcom/alarmdotcom/issues",
"requirements": ["beautifulsoup4>=4.10.0", "pyalarmdotcomajax==0.5.7"],
"version": "3.0.8"
"requirements": ["beautifulsoup4>=4.10.0", "pyalarmdotcomajax==0.5.8"],
"version": "3.0.9"
}

0 comments on commit 22ac7f0

Please sign in to comment.