コード例 #1
0
 def test_temperature_to_imperial(self):
     """Test temperature conversion to imperial system."""
     self.assertEqual(
         77,
         IMPERIAL_SYSTEM.temperature(77, IMPERIAL_SYSTEM.temperature_unit))
     self.assertEqual(
         77, IMPERIAL_SYSTEM.temperature(25,
                                         METRIC_SYSTEM.temperature_unit))
コード例 #2
0
 def test_temperature_to_imperial(self):
     """Test temperature conversion to imperial system."""
     self.assertEqual(
         77,
         IMPERIAL_SYSTEM.temperature(77, IMPERIAL_SYSTEM.temperature_unit))
     self.assertEqual(
         77,
         IMPERIAL_SYSTEM.temperature(25, METRIC_SYSTEM.temperature_unit))
コード例 #3
0
    def set_temperature(self, **kwargs):
        mode = kwargs.get(ATTR_HVAC_MODE)
        if mode != None:
            self.set_hvac_mode(mode)

        temp = kwargs.get(ATTR_TEMPERATURE)
        if self._device.units.temperature_unit != TEMP_FAHRENHEIT:
            if self._device.force_fahrenheit:
                # undo HA's conversion
                temp = METRIC_SYSTEM.temperature(temp, TEMP_FAHRENHEIT)
            else:
                temp = IMPERIAL_SYSTEM.temperature(
                    temp, self._device.units.temperature_unit)
        self._device.dps(DPS_TARGET, int(temp + 0.5))
コード例 #4
0
def test_temperature_to_imperial():
    """Test temperature conversion to imperial system."""
    assert IMPERIAL_SYSTEM.temperature(77,
                                       IMPERIAL_SYSTEM.temperature_unit) == 77
    assert IMPERIAL_SYSTEM.temperature(25,
                                       METRIC_SYSTEM.temperature_unit) == 77