def temperature_set_service(service): """Set temperature on the target thermostats.""" target_thermostats = component.extract_from_service(service) temperature = service.data[ATTR_TEMPERATURE] for thermostat in target_thermostats: thermostat.set_temperature( convert(temperature, hass.config.temperature_unit, thermostat.unit_of_measurement)) thermostat.update_ha_state(True)
def temperature_set_service(service): """Set temperature on the target thermostats.""" target_thermostats = component.extract_from_service(service) temperature = service.data[ATTR_TEMPERATURE] for thermostat in target_thermostats: thermostat.set_temperature(convert( temperature, hass.config.temperature_unit, thermostat.unit_of_measurement)) thermostat.update_ha_state(True)
def temperature(self, value, unit): """Convert temperature to user preferred unit if set.""" if not (unit in (TEMP_CELSIUS, TEMP_FAHRENHEIT) and self.temperature_unit and unit != self.temperature_unit): return value, unit try: temp = float(value) except ValueError: # Could not convert value to float return value, unit return ( round(temp_helper.convert(temp, unit, self.temperature_unit), 1), self.temperature_unit)
def _convert_for_display(self, temp): """Convert temperature into preferred units for display purposes.""" if temp is None: return None value = convert(temp, self.unit_of_measurement, self.hass.config.temperature_unit) if self.hass.config.temperature_unit is TEMP_CELSIUS: decimal_count = 1 else: # Users of fahrenheit generally expect integer units. decimal_count = 0 return round(value, decimal_count)
def _convert_for_display(self, temp): """Convert temperature into preferred units for display purposes.""" if temp is None: return None value = convert(temp, self.unit_of_measurement, self.hass.config.temperature_unit) if self.hass.config.temperature_unit is TEMP_CELCIUS: decimal_count = 1 else: # Users of fahrenheit generally expect integer units. decimal_count = 0 return round(value, decimal_count)
def temperature_set_service(service): """Set temperature on the target hvacs.""" target_hvacs = component.extract_from_service(service) temperature = util.convert( service.data.get(ATTR_TEMPERATURE), float) if temperature is None: _LOGGER.error( "Received call to %s without attribute %s", SERVICE_SET_TEMPERATURE, ATTR_TEMPERATURE) return for hvac in target_hvacs: hvac.set_temperature(convert( temperature, hass.config.temperature_unit, hvac.unit_of_measurement)) if hvac.should_poll: hvac.update_ha_state(True)
def max_temp(self): """Return the maximum temperature.""" return convert(self._thermostat.max_temp, TEMP_CELCIUS, self.unit_of_measurement)
def max_temp(self): """Return the maximum temperature.""" return convert(35, TEMP_CELSIUS, self.unit_of_measurement)
def min_temp(self): """Return the minimum temperature.""" return convert(7, TEMP_CELSIUS, self.unit_of_measurement)
def max_temp(self): """Return the maximum temperature - 30.5 means on.""" return convert(30.5, TEMP_CELSIUS, self.unit_of_measurement)
def min_temp(self): """Return the minimum temperature - 4.5 means off.""" return convert(4.5, TEMP_CELSIUS, self.unit_of_measurement)
def max_temp(self): """Return the maximum temperature.""" return convert(30, TEMP_CELCIUS, self.unit_of_measurement)
def min_temp(self): """Return the minimum temperature.""" return convert(19, TEMP_CELCIUS, self.unit_of_measurement)