예제 #1
0
    def test_dyson_temperature_sensor_with_values(self):
        """Test temperature sensor with values."""
        sensor = dyson.DysonTemperatureSensor(self.hass, _get_with_state(),
                                              TEMP_CELSIUS)
        sensor.entity_id = "sensor.dyson_1"
        self.assertFalse(sensor.should_poll)
        self.assertEqual(sensor.state, 21.9)
        self.assertEqual(sensor.unit_of_measurement, '°C')
        self.assertEqual(sensor.name, "Device_name temperature")
        self.assertEqual(sensor.entity_id, "sensor.dyson_1")

        sensor = dyson.DysonTemperatureSensor(self.hass, _get_with_state(),
                                              TEMP_FAHRENHEIT)
        sensor.entity_id = "sensor.dyson_1"
        self.assertFalse(sensor.should_poll)
        self.assertEqual(sensor.state, 71.3)
        self.assertEqual(sensor.unit_of_measurement, '°F')
        self.assertEqual(sensor.name, "Device_name temperature")
        self.assertEqual(sensor.entity_id, "sensor.dyson_1")
예제 #2
0
 def test_dyson_temperature_sensor(self):
     """Test temperature sensor with no value."""
     sensor = dyson.DysonTemperatureSensor(self.hass,
                                           _get_device_without_state(),
                                           TEMP_CELSIUS)
     sensor.entity_id = "sensor.dyson_1"
     self.assertFalse(sensor.should_poll)
     self.assertIsNone(sensor.state)
     self.assertEqual(sensor.unit_of_measurement, '°C')
     self.assertEqual(sensor.name, "Device_name temperature")
     self.assertEqual(sensor.entity_id, "sensor.dyson_1")
예제 #3
0
 def test_dyson_temperature_standby_monitoring(self):
     """Test temperature sensor while device is in standby monitoring."""
     sensor = dyson.DysonTemperatureSensor(_get_with_standby_monitoring(),
                                           TEMP_CELSIUS)
     sensor.hass = self.hass
     sensor.entity_id = "sensor.dyson_1"
     self.assertFalse(sensor.should_poll)
     self.assertEqual(sensor.state, STATE_OFF)
     self.assertEqual(sensor.unit_of_measurement, '°C')
     self.assertEqual(sensor.name, "Device_name Temperature")
     self.assertEqual(sensor.entity_id, "sensor.dyson_1")
예제 #4
0
 def test_dyson_temperature_standby_monitoring(self):
     """Test temperature sensor while device is in standby monitoring."""
     sensor = dyson.DysonTemperatureSensor(_get_with_standby_monitoring(),
                                           TEMP_CELSIUS)
     sensor.hass = self.hass
     sensor.entity_id = "sensor.dyson_1"
     assert not sensor.should_poll
     assert sensor.state == STATE_OFF
     assert sensor.unit_of_measurement == '°C'
     assert sensor.name == "Device_name Temperature"
     assert sensor.entity_id == "sensor.dyson_1"
예제 #5
0
    def test_dyson_temperature_sensor_with_values(self):
        """Test temperature sensor with values."""
        sensor = dyson.DysonTemperatureSensor(_get_with_state(), TEMP_CELSIUS)
        sensor.hass = self.hass
        sensor.entity_id = "sensor.dyson_1"
        assert not sensor.should_poll
        assert sensor.state == 21.9
        assert sensor.unit_of_measurement == '°C'
        assert sensor.name == "Device_name Temperature"
        assert sensor.entity_id == "sensor.dyson_1"

        sensor = dyson.DysonTemperatureSensor(_get_with_state(),
                                              TEMP_FAHRENHEIT)
        sensor.hass = self.hass
        sensor.entity_id = "sensor.dyson_1"
        assert not sensor.should_poll
        assert sensor.state == 71.3
        assert sensor.unit_of_measurement == '°F'
        assert sensor.name == "Device_name Temperature"
        assert sensor.entity_id == "sensor.dyson_1"
예제 #6
0
 def test_dyson_temperature_sensor(self):
     """Test temperature sensor with no value."""
     sensor = dyson.DysonTemperatureSensor(_get_device_without_state(),
                                           TEMP_CELSIUS)
     sensor.hass = self.hass
     sensor.entity_id = "sensor.dyson_1"
     assert not sensor.should_poll
     assert sensor.state is None
     assert sensor.unit_of_measurement == '°C'
     assert sensor.name == "Device_name Temperature"
     assert sensor.entity_id == "sensor.dyson_1"