示例#1
0
 def test_dyson_filter_life_sensor_with_values(self):
     """Test filter sensor with values."""
     sensor = dyson.DysonFilterLifeSensor(_get_with_state())
     sensor.hass = self.hass
     sensor.entity_id = "sensor.dyson_1"
     assert not sensor.should_poll
     assert sensor.state == 100
     assert sensor.unit_of_measurement == TIME_HOURS
     assert sensor.name == "Device_name Filter Life"
     assert sensor.entity_id == "sensor.dyson_1"
     sensor.on_message("message")
示例#2
0
 def test_dyson_filter_life_sensor(self):
     """Test filter life sensor with no value."""
     sensor = dyson.DysonFilterLifeSensor(_get_device_without_state())
     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 == "hours"
     assert sensor.name == "Device_name Filter Life"
     assert sensor.entity_id == "sensor.dyson_1"
     sensor.on_message("message")