예제 #1
0
    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)
예제 #2
0
    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)
예제 #3
0
    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)
예제 #4
0
    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)
예제 #5
0
    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)
예제 #6
0
    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)
예제 #7
0
 def max_temp(self):
     """Return the maximum temperature."""
     return convert(self._thermostat.max_temp, TEMP_CELCIUS,
                    self.unit_of_measurement)
예제 #8
0
 def max_temp(self):
     """Return the maximum temperature."""
     return convert(35, TEMP_CELSIUS, self.unit_of_measurement)
예제 #9
0
 def min_temp(self):
     """Return the minimum temperature."""
     return convert(7, TEMP_CELSIUS, self.unit_of_measurement)
예제 #10
0
 def max_temp(self):
     """Return the maximum temperature - 30.5 means on."""
     return convert(30.5, TEMP_CELSIUS, self.unit_of_measurement)
예제 #11
0
 def min_temp(self):
     """Return the minimum temperature - 4.5 means off."""
     return convert(4.5, TEMP_CELSIUS, self.unit_of_measurement)
예제 #12
0
 def max_temp(self):
     """Return the maximum temperature."""
     return convert(30, TEMP_CELCIUS, self.unit_of_measurement)
예제 #13
0
 def min_temp(self):
     """Return the minimum temperature."""
     return convert(19, TEMP_CELCIUS, self.unit_of_measurement)