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

Add temperature units to MQTT Climate #30602

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
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
9 changes: 6 additions & 3 deletions homeassistant/components/mqtt/climate.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
ATTR_TEMPERATURE,
CONF_DEVICE,
CONF_NAME,
CONF_UNIT_OF_MEASUREMENT,
CONF_VALUE_TEMPLATE,
PRECISION_HALVES,
PRECISION_TENTHS,
Expand Down Expand Up @@ -294,7 +295,6 @@ def __init__(self, hass, config, config_entry, discovery_hash):
self._target_temp_high = None
self._target_temp_low = None
self._topic = None
self._unit_of_measurement = hass.config.units.temperature_unit
self._value_templates = None

self._setup_from_config(config)
Expand Down Expand Up @@ -570,8 +570,11 @@ def unique_id(self):

@property
def temperature_unit(self):
"""Return the unit of measurement."""
return self._unit_of_measurement
"""Return the unit this state is expressed in."""
mqtt_measure = self._config.get(CONF_UNIT_OF_MEASUREMENT)
if not mqtt_measure:
mqtt_measure = self.hass.config.units.temperature_unit
return mqtt_measure

@property
def current_temperature(self):
Expand Down